From: Gerd Knorr <kraxel@bytesex.org>
To: Linus Torvalds <torvalds@osdl.org>,
Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
Kernel List <linux-kernel@vger.kernel.org>,
degerrit@web.de
Subject: [patch] Re: V4L bug report - oops: video_register_device (ksymoops, objdump)
Date: Wed, 5 May 2004 09:50:17 +0200 [thread overview]
Message-ID: <20040505075017.GA2375@bytesex.org> (raw)
In-Reply-To: <40983350.4020403@web.de>
On Wed, May 05, 2004 at 02:20:32AM +0200, degerrit@web.de wrote:
> I caused an oops in unusual circumstances by accidentally "forcing" a
> video device number which was too high or already taken (don't know
> which). I assume this probably shouldn't give an oops (though it was my
> fault), so here's a bugreport...
Fixed by adding a range check for the number passed in by the driver.
The fix applies to 2.4 kernels as well.
Gerd
--- linux-2.6.6-rc2/drivers/media/video/videodev.c~ 2004-04-21 15:05:10.000000000 +0200
+++ linux-2.6.6-rc2/drivers/media/video/videodev.c 2004-05-05 09:38:20.032625621 +0200
@@ -316,7 +316,14 @@
/* pick a minor number */
down(&videodev_lock);
- if (-1 == nr) {
+ if (nr >= 0 && nr < end-base) {
+ /* use the one the driver asked for */
+ i = base+nr;
+ if (NULL != video_device[i]) {
+ up(&videodev_lock);
+ return -ENFILE;
+ }
+ } else {
/* use first free */
for(i=base;i<end;i++)
if (NULL == video_device[i])
@@ -325,13 +332,6 @@
up(&videodev_lock);
return -ENFILE;
}
- } else {
- /* use the one the driver asked for */
- i = base+nr;
- if (NULL != video_device[i]) {
- up(&videodev_lock);
- return -ENFILE;
- }
}
video_device[i]=vfd;
vfd->minor=i;
parent reply other threads:[~2004-05-05 8:04 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <40983350.4020403@web.de>]
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=20040505075017.GA2375@bytesex.org \
--to=kraxel@bytesex.org \
--cc=degerrit@web.de \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
--cc=torvalds@osdl.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