Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pktcdvd: improve BKL and compat_ioctl.c usage

The pktcdvd driver uses proper locking and does not need the BKL in the
ioctl and llseek functions of the character device, so kill both.

Moving the compat_ioctl handling from common code into the driver itself
fixes build problems when CONFIG_BLOCK is disabled.

Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Arnd Bergmann and committed by
Linus Torvalds
f80a0ca6 a36fed12

+14 -6
+14 -3
drivers/block/pktcdvd.c
··· 48 48 #include <linux/module.h> 49 49 #include <linux/types.h> 50 50 #include <linux/kernel.h> 51 + #include <linux/compat.h> 51 52 #include <linux/kthread.h> 52 53 #include <linux/errno.h> 53 54 #include <linux/spinlock.h> ··· 2985 2984 mutex_unlock(&ctl_mutex); 2986 2985 } 2987 2986 2988 - static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 2987 + static long pkt_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 2989 2988 { 2990 2989 void __user *argp = (void __user *)arg; 2991 2990 struct pkt_ctrl_command ctrl_cmd; ··· 3022 3021 return ret; 3023 3022 } 3024 3023 3024 + #ifdef CONFIG_COMPAT 3025 + static long pkt_ctl_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 3026 + { 3027 + return pkt_ctl_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); 3028 + } 3029 + #endif 3025 3030 3026 3031 static const struct file_operations pkt_ctl_fops = { 3027 - .ioctl = pkt_ctl_ioctl, 3028 - .owner = THIS_MODULE, 3032 + .open = nonseekable_open, 3033 + .unlocked_ioctl = pkt_ctl_ioctl, 3034 + #ifdef CONFIG_COMPAT 3035 + .compat_ioctl = pkt_ctl_compat_ioctl, 3036 + #endif 3037 + .owner = THIS_MODULE, 3029 3038 }; 3030 3039 3031 3040 static struct miscdevice pkt_misc = {
-3
fs/compat_ioctl.c
··· 102 102 #include <linux/nbd.h> 103 103 #include <linux/random.h> 104 104 #include <linux/filter.h> 105 - #include <linux/pktcdvd.h> 106 105 107 106 #include <linux/hiddev.h> 108 107 ··· 1125 1126 COMPATIBLE_IOCTL(PPGETPHASE) 1126 1127 COMPATIBLE_IOCTL(PPGETFLAGS) 1127 1128 COMPATIBLE_IOCTL(PPSETFLAGS) 1128 - /* pktcdvd */ 1129 - COMPATIBLE_IOCTL(PACKET_CTRL_CMD) 1130 1129 /* Big A */ 1131 1130 /* sparc only */ 1132 1131 /* Big Q for sound/OSS */