summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2008-03-26 14:09:01 +0300
committerJens Axboe <jens.axboe@oracle.com>2008-04-21 11:50:08 +0400
commit032d8d90ba23e1770604bbb1102ec77f5aa8ae44 (patch)
tree2b10f19df249adc98fe5a6fae5d6a5788406b3be
parent3c3f4e012ab3471e8bd19220ed897ae9700e5fdd (diff)
downloadlinux-032d8d90ba23e1770604bbb1102ec77f5aa8ae44.tar.xz
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>
-rw-r--r--drivers/cdrom/cdrom.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index fbcf4b3f8d0e..326ef1b4a4ea 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,