From: Akinobu Mita Date: Wed, 26 Mar 2008 11:09:01 +0000 (+0100) Subject: cdrom: protect cdrom_device_info list by mutex X-Git-Tag: v2.6.26-rc1~1115^2~13 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=032d8d90ba23e1770604bbb1102ec77f5aa8ae44;p=linux-2.6-omap-h63xx.git 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 Signed-off-by: Jens Axboe --- diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index fbcf4b3f8d0..326ef1b4a4e 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -3427,6 +3427,7 @@ static void cdrom_update_settings(void) { struct cdrom_device_info *cdi; + mutex_lock(&cdrom_mutex); for (cdi = topCdromPtr; cdi != NULL; cdi = cdi->next) { if (autoclose && CDROM_CAN(CDC_CLOSE_TRAY)) cdi->options |= CDO_AUTO_CLOSE; @@ -3445,6 +3446,7 @@ static void cdrom_update_settings(void) else cdi->options &= ~CDO_CHECK_TYPE; } + mutex_unlock(&cdrom_mutex); } static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp,