[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 04/52] drm: Set final_kfree in drm_dev_alloc


  • To: Daniel Vetter <daniel.vetter@xxxxxxxx>, DRI Development <dri-devel@xxxxxxxxxxxxxxxxxxxxx>
  • From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • Date: Wed, 19 Feb 2020 12:03:32 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FAaJif/uA5V/if8azbw0a6CGDjdkCXq7ZGxeEYA9r58=; b=OdRYuFCSmJnRjjs42/3C/TVsKJ0ggpidAwfkrSITdujLtLfLR54b/87gP93iP/53Cb3TaqfQToZ7KOOXzoBJwt8JpmTdLkvmK24ls6+FuP76qj2CPVgXwrgj4AdIZt8vcZS4ksyY0Bj10++0GO1rrGcrIfbJalz4MwqjasYjAsUJm/GWifNTFmgCtltIQm0VsHhMVU0L1mBXQx0gY9zMF0zM/z1gIyI8YSgKMl2EKMZrOdBYQIAK7cP+FVOyNYlDJoAFAHOKuLgIovJTf0W6/AYoRfD6bjZiL5lSyK1WTRzNBRxQcMCxVJrf/EoO7mHAOXk4WXiV4SZT4jq1M8z/lA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M5dok2ALRM+7CGL2wXr0eBfM5AxNC/emkghPavjyXy3v5dSV0hf+PARDYJrbFa7DIs5x0mqGqQX4tuQlSZT5w7T5SynX/mE98u5hWI6678WHO1cC4GLQI1lNB5q2sFFBge1NLoQXZvRD7CDP70jmQqeKw5REt1NNxB2GgYZMl1TP+oAHiX/mnxaK7/L6a7bNLF0dHj0F5gZHTmRa5Xf8paEGrA9x5gyxAXCwSSPdVTfFQ1rhzVXGlDBOBnDIadpgViiwn3UZeNK3okvuv0JY26WC5IqQTLVx/e856L8Oo3go9V96RLO2Lqs+aV/nfiZUCkBadBW/OLWpYBQDlbzxFQ==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Oleksandr_Andrushchenko@xxxxxxxx;
  • Cc: Daniel Vetter <daniel@xxxxxxxx>, David Airlie <airlied@xxxxxxxx>, Intel Graphics Development <intel-gfx@xxxxxxxxxxxxxxxxxxxxx>, Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>, Maxime Ripard <mripard@xxxxxxxxxx>, Gerd Hoffmann <kraxel@xxxxxxxxxx>, Thomas Zimmermann <tzimmermann@xxxxxxx>, Daniel Vetter <daniel.vetter@xxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 19 Feb 2020 12:03:37 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHV5w5groS5vlmjMU293YOjHXqBFKgiaxYA
  • Thread-topic: [PATCH 04/52] drm: Set final_kfree in drm_dev_alloc

On 2/19/20 12:20 PM, Daniel Vetter wrote:
> I also did a full review of all callers, and only the xen driver
> forgot to call drm_dev_put in the failure path. Fix that up too.
>
> v2: I noticed that xen has a drm_driver.release hook, and uses
> drm_dev_alloc(). We need to remove the kfree from
> xen_drm_drv_release().
>
> bochs also has a release hook, but leaked the drm_device ever since
>
> commit 0a6659bdc5e8221da99eebb176fd9591435e38de
> Author: Gerd Hoffmann <kraxel@xxxxxxxxxx>
> Date:   Tue Dec 17 18:04:46 2013 +0100
>
>      drm/bochs: new driver
>
> This patch here fixes that leak.
>
> Same for virtio, started leaking with
>
> commit b1df3a2b24a917f8853d43fe9683c0e360d2c33a
> Author: Gerd Hoffmann <kraxel@xxxxxxxxxx>
> Date:   Tue Feb 11 14:58:04 2020 +0100
>
>      drm/virtio: add drm_driver.release callback.
>
> Cc: Gerd Hoffmann <kraxel@xxxxxxxxxx>
> Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
>
> Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>
Thank you,
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> Cc: Maxime Ripard <mripard@xxxxxxxxxx>
> Cc: Thomas Zimmermann <tzimmermann@xxxxxxx>
> Cc: David Airlie <airlied@xxxxxxxx>
> Cc: Daniel Vetter <daniel@xxxxxxxx>
> Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
> ---
>   drivers/gpu/drm/drm_drv.c           | 3 +++
>   drivers/gpu/drm/xen/xen_drm_front.c | 2 +-
>   2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 3e5627d6eba6..9e62e28bbc62 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -39,6 +39,7 @@
>   #include <drm/drm_color_mgmt.h>
>   #include <drm/drm_drv.h>
>   #include <drm/drm_file.h>
> +#include <drm/drm_managed.h>
>   #include <drm/drm_mode_object.h>
>   #include <drm/drm_print.h>
>   
> @@ -819,6 +820,8 @@ struct drm_device *drm_dev_alloc(struct drm_driver 
> *driver,
>               return ERR_PTR(ret);
>       }
>   
> +     drmm_add_final_kfree(dev, dev);
> +
>       return dev;
>   }
>   EXPORT_SYMBOL(drm_dev_alloc);
> diff --git a/drivers/gpu/drm/xen/xen_drm_front.c 
> b/drivers/gpu/drm/xen/xen_drm_front.c
> index 4be49c1aef51..d22b5da38935 100644
> --- a/drivers/gpu/drm/xen/xen_drm_front.c
> +++ b/drivers/gpu/drm/xen/xen_drm_front.c
> @@ -461,7 +461,6 @@ static void xen_drm_drv_release(struct drm_device *dev)
>       drm_mode_config_cleanup(dev);
>   
>       drm_dev_fini(dev);
> -     kfree(dev);
>   
>       if (front_info->cfg.be_alloc)
>               xenbus_switch_state(front_info->xb_dev,
> @@ -561,6 +560,7 @@ static int xen_drm_drv_init(struct xen_drm_front_info 
> *front_info)
>   fail_modeset:
>       drm_kms_helper_poll_fini(drm_dev);
>       drm_mode_config_cleanup(drm_dev);
> +     drm_dev_put(drm_dev);
>   fail:
>       kfree(drm_info);
>       return ret;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.