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

cdrom: protect cdrom_device_info list by mutex

This patch protects the list of cdrom_device_info by cdrom_mutex
when the file in /proc/sys/dev/cdrom/ is written.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

authored by

Akinobu Mita and committed by
Jens Axboe
032d8d90 3c3f4e01

+2
+2
drivers/cdrom/cdrom.c
··· 3427 3427 { 3428 3428 struct cdrom_device_info *cdi; 3429 3429 3430 + mutex_lock(&cdrom_mutex); 3430 3431 for (cdi = topCdromPtr; cdi != NULL; cdi = cdi->next) { 3431 3432 if (autoclose && CDROM_CAN(CDC_CLOSE_TRAY)) 3432 3433 cdi->options |= CDO_AUTO_CLOSE; ··· 3446 3445 else 3447 3446 cdi->options &= ~CDO_CHECK_TYPE; 3448 3447 } 3448 + mutex_unlock(&cdrom_mutex); 3449 3449 } 3450 3450 3451 3451 static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp,