video_usercopy() enforces change of VideoText IOCTLs since 2.6.8

From: Michael Geng
Date: Thu Oct 07 2004 - 12:42:09 EST


Hello Gerd,

from kernel 2.6.7 to 2.6.8 function video_usercopy() in
videodev.c was modified in a way that IOCTLs which do not
use the _IO macros defined in linux/ioctl.h will get their
driver's ioctl function called with arg = 0.

This means that the videotext drivers (saa5246a and saa5249)
only produce segmentation faults in kernel version >= 2.6.8.

Shall we change the IOCTL definitions in include/linux/videotext.h?
This would mean that existing userspace programs will have to be
recompiled in order to work with the latest kernel version.

Nevertheless I suggest changing these IOCTLs to the new method.
I will work out a patch if you agree.

Below is the change I'm talking about:

int
video_usercopy(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg,
int (*func)(struct inode *inode, struct file *file,
unsigned int cmd, void *arg))
{
char sbuf[128];
void *mbuf = NULL;
void *parg = NULL;
int err = -EINVAL;

cmd = video_fix_command(cmd);

/* Copy arguments into temp kernel buffer */
switch (_IOC_DIR(cmd)) {
case _IOC_NONE:
===> 2.6.7:
parg = (void *)arg;
===> 2.6.8:
parg = NULL;
...

/* call driver */
err = func(inode, file, cmd, parg);

Bye,
Michael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/