From: Andrew Morton <akpm@linux-foundation.org>
To: Julia Lawall <julia@diku.dk>
Cc: Mark McClelland <mmcclell@bigfoot.com>,
Mauro Carvalho Chehab <mchehab@infradead.org>,
linux-usb@vger.kernel.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drivers/media/video: avoid NULL dereference
Date: Mon, 22 Mar 2010 23:14:41 -0400 [thread overview]
Message-ID: <20100322231441.b7e33bf9.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.1003212230380.12371@ask.diku.dk>
On Sun, 21 Mar 2010 22:31:06 +0100 (CET) Julia Lawall <julia@diku.dk> wrote:
> From: Julia Lawall <julia@diku.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.
next prev parent reply other threads:[~2010-03-23 6:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-21 21:31 [PATCH] drivers/media/video: avoid NULL dereference Julia Lawall
2010-03-23 3:14 ` Andrew Morton [this message]
2010-03-23 6:22 ` Julia Lawall
2010-03-23 6:24 ` Julia Lawall
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=20100322231441.b7e33bf9.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=mmcclell@bigfoot.com \
/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