All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Knorr <kraxel@bytesex.org>
To: Mark McClelland <mark@alpha.dyndns.org>
Cc: video4linux-list@redhat.com, Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: [V4L] [PATCH/RFC] videodev.[ch] redesign
Date: Sun, 10 Feb 2002 10:11:31 +0100	[thread overview]
Message-ID: <20020210101130.A28225@bytesex.org> (raw)
In-Reply-To: <20020209194602.A23061@bytesex.org> <3C65EFF4.2000906@alpha.dyndns.org>
In-Reply-To: <3C65EFF4.2000906@alpha.dyndns.org>

> Excellent work. I have no complaints, just a few questions:
> 
> 1. Would it be better to memset the temp buffer in video_generic_ioctl() 
> rather than in the driver? I've seen so many drivers forget to do this, 
> and it's a potential (albeit very small) security hole.

The wrapper fills the buffer using copy_from_user() -- even for _IOR
ioctls because some are labeled wrong -- and the driver needs that data.
I can't zero the buffer ...

> 2. In skeleton_open(), couldn't the device_data lookup code be replaced 
> with:
> 
>    struct video_device *vdev = video_devdata(file);
>    struct device_data *dev = vdev->priv;

Good point.  Yes, that should work.

> 3. In skeleton_initdev(), shouldn't...
> 
>    dev->vdev = skeleton_template;
> 
> ...be...
> 
>    memcpy(&dev->vdev, &skeleton_template, sizeof(skeleton_template);

No.  It does the same.

> 4. Is it safe to keep even 128 bytes on the stack in 
> video_generic_ioctl()? Consider that devices might spend a relatively 
> long time blocking on VIDIOCSYNC. With 32 devices in use at once, you'd 
> be coming dangerously close to a stack overflow.

I don't see a overflow can easily happen here.  There is one kernel
strack _per process_.  Calling schedule() will also switch the stack.

> IMHO it would be better 
> to only allocate as much as MCAPTURE and SYNC need, and fall back on 
> kmalloc for the less time-critical ones (if necessary).

struct v4l2_buffer should fit onto the stack too.

  Gerd

-- 
#define	ENOCLUE 125 /* userland programmer induced race condition */

  reply	other threads:[~2002-02-10  9:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-09 18:46 [PATCH/RFC] videodev.[ch] redesign Gerd Knorr
2002-02-09 20:53 ` Oliver Neukum
2002-02-09 20:53 ` Oliver Neukum
2002-02-09 20:44   ` Gerd Knorr
2002-02-10  0:32     ` Oliver Neukum
2002-02-10  8:34       ` Gerd Knorr
2002-02-10  2:03 ` [V4L] " Alan Cox
2002-02-10  8:59   ` Gerd Knorr
2002-02-11 21:10     ` [PATCH/RFC] videodev.[ch] redesign -- take #2 Gerd Knorr
2002-02-10  3:58 ` [V4L] [PATCH/RFC] videodev.[ch] redesign Mark McClelland
2002-02-10  9:11   ` Gerd Knorr [this message]
2002-02-10 12:54     ` Mark McClelland
2002-02-11  9:55       ` Gerd Knorr
2002-02-11 11:58         ` Mark McClelland

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=20020210101130.A28225@bytesex.org \
    --to=kraxel@bytesex.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@alpha.dyndns.org \
    --cc=video4linux-list@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.