Commit 032d8d90 authored by Akinobu Mita's avatar Akinobu Mita Committed by Jens Axboe

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: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 3c3f4e01
...@@ -3427,6 +3427,7 @@ static void cdrom_update_settings(void) ...@@ -3427,6 +3427,7 @@ static void cdrom_update_settings(void)
{ {
struct cdrom_device_info *cdi; struct cdrom_device_info *cdi;
mutex_lock(&cdrom_mutex);
for (cdi = topCdromPtr; cdi != NULL; cdi = cdi->next) { for (cdi = topCdromPtr; cdi != NULL; cdi = cdi->next) {
if (autoclose && CDROM_CAN(CDC_CLOSE_TRAY)) if (autoclose && CDROM_CAN(CDC_CLOSE_TRAY))
cdi->options |= CDO_AUTO_CLOSE; cdi->options |= CDO_AUTO_CLOSE;
...@@ -3445,6 +3446,7 @@ static void cdrom_update_settings(void) ...@@ -3445,6 +3446,7 @@ static void cdrom_update_settings(void)
else else
cdi->options &= ~CDO_CHECK_TYPE; cdi->options &= ~CDO_CHECK_TYPE;
} }
mutex_unlock(&cdrom_mutex);
} }
static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp, static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment