dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Aaron Plattner <aplattner@nvidia.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: kernel-janitors@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [patch] drm: use after free in drm_pci_exit()
Date: Fri, 14 Mar 2014 09:19:30 -0700	[thread overview]
Message-ID: <53232C12.20108@nvidia.com> (raw)
In-Reply-To: <20140120103116.GD14233@elgon.mountain>

On 01/20/2014 02:31 AM, Dan Carpenter wrote:
> We can't use "dev" after we freed it on the line before.
>
> Fixes: b3f2333de8e8 ('drm: restrict the device list for shadow attached drivers')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

I just ran into this same problem, and this change fixes it.

Tested-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>

and since he just sent me an independently-developed identical change,

Reviewed-by: John Hubbard <jhubbard@nvidia.com>

> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index 5736aaa7e86c..f7af69bcf3f4 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -468,8 +468,8 @@ void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)
>   	} else {
>   		list_for_each_entry_safe(dev, tmp, &driver->legacy_dev_list,
>   					 legacy_dev_list) {
> -			drm_put_dev(dev);
>   			list_del(&dev->legacy_dev_list);
> +			drm_put_dev(dev);
>   		}
>   	}
>   	DRM_INFO("Module unloaded\n");
> --

  reply	other threads:[~2014-03-14 16:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-20 10:31 [patch] drm: use after free in drm_pci_exit() Dan Carpenter
2014-03-14 16:19 ` Aaron Plattner [this message]
2014-03-17 10:24   ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53232C12.20108@nvidia.com \
    --to=aplattner@nvidia.com \
    --cc=airlied@linux.ie \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).