[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100322231441.b7e33bf9.akpm@linux-foundation.org>
Date: Mon, 22 Mar 2010 23:14:41 -0400
From: Andrew Morton <akpm@...ux-foundation.org>
To: Julia Lawall <julia@...u.dk>
Cc: Mark McClelland <mmcclell@...foot.com>,
Mauro Carvalho Chehab <mchehab@...radead.org>,
linux-usb@...r.kernel.org, linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] drivers/media/video: avoid NULL dereference
On Sun, 21 Mar 2010 22:31:06 +0100 (CET) Julia Lawall <julia@...u.dk> wrote:
> From: Julia Lawall <julia@...u.dk>
>
> If ov is NULL, it will not be possible to take the lock in the first place,
> so move the test up earlier.
>
> ...
>
> --- a/drivers/media/video/ov511.c
> +++ b/drivers/media/video/ov511.c
> @@ -5913,14 +5913,12 @@ ov51x_disconnect(struct usb_interface *intf)
>
> PDEBUG(3, "");
>
> + if (!ov)
> + return;
> +
> mutex_lock(&ov->lock);
> usb_set_intfdata (intf, NULL);
>
> - if (!ov) {
> - mutex_unlock(&ov->lock);
> - return;
> - }
> -
> /* Free device number */
> ov511_devused &= ~(1 << ov->nr);
I think we can pretty safely assume that we never get here with ov==NULL.
Oh well, I'll leave the test there for others to ponder.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists