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

USB: usblcd: Push down BKL into driver

I'm pretty sure this can be eliminated however I couldn't prove (or find)
what stopped the device vanishing mid IOCTL_GET_HARD_VERSION. Perhaps a
USB wizard could double check that and see if the lock_kernel can go
entirely.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Alan Cox and committed by
Greg Kroah-Hartman
5cb4aeca 1160d076

+4 -2
+4 -2
drivers/usb/misc/usblcd.c
··· 146 146 return retval; 147 147 } 148 148 149 - static int lcd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 149 + static long lcd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 150 150 { 151 151 struct usb_lcd *dev; 152 152 u16 bcdDevice; ··· 158 158 159 159 switch (cmd) { 160 160 case IOCTL_GET_HARD_VERSION: 161 + lock_kernel(); 161 162 bcdDevice = le16_to_cpu((dev->udev)->descriptor.bcdDevice); 162 163 sprintf(buf,"%1d%1d.%1d%1d", 163 164 (bcdDevice & 0xF000)>>12, 164 165 (bcdDevice & 0xF00)>>8, 165 166 (bcdDevice & 0xF0)>>4, 166 167 (bcdDevice & 0xF)); 168 + unlock_kernel(); 167 169 if (copy_to_user((void __user *)arg,buf,strlen(buf))!=0) 168 170 return -EFAULT; 169 171 break; ··· 274 272 .read = lcd_read, 275 273 .write = lcd_write, 276 274 .open = lcd_open, 277 - .ioctl = lcd_ioctl, 275 + .unlocked_ioctl = lcd_ioctl, 278 276 .release = lcd_release, 279 277 }; 280 278