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

mbcs: cdev lock_kernel() pushdown

This driver would appear to have no internal locking at all.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>

+5
+5
drivers/char/mbcs.c
··· 24 24 #include <linux/mm.h> 25 25 #include <linux/uio.h> 26 26 #include <linux/mutex.h> 27 + #include <linux/smp_lock.h> 27 28 #include <asm/io.h> 28 29 #include <asm/uaccess.h> 29 30 #include <asm/system.h> ··· 383 382 struct mbcs_soft *soft; 384 383 int minor; 385 384 385 + lock_kernel(); 386 386 minor = iminor(ip); 387 387 388 + /* Nothing protects access to this list... */ 388 389 list_for_each_entry(soft, &soft_list, list) { 389 390 if (soft->nasid == minor) { 390 391 fp->private_data = soft->cxdev; 392 + unlock_kernel(); 391 393 return 0; 392 394 } 393 395 } 394 396 397 + unlock_kernel(); 395 398 return -ENODEV; 396 399 } 397 400