Skip to content

Commit

Permalink
cdrom: protect cdrom_device_info list by mutex
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Akinobu Mita authored and Jens Axboe committed Apr 21, 2008
1 parent 3c3f4e0 commit 032d8d9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/cdrom/cdrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit 032d8d9

Please sign in to comment.