[PATCH 1/2] ch: add missing mutex_lock()/mutex_unlock() in ch_release()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The 'ch_mutex" is meant to guard against modifications of
file->private_data, so we need to take in in ch_release() as
well as in ch_open().

Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
---
 drivers/scsi/ch.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 1c5051b1c125..8f426903d7e4 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -577,9 +577,11 @@ ch_release(struct inode *inode, struct file *file)
 {
 	scsi_changer *ch = file->private_data;
 
+	mutex_lock(&ch_mutex);
 	scsi_device_put(ch->device);
 	ch->device = NULL;
 	file->private_data = NULL;
+	mutex_unlock(&ch_mutex);
 	kref_put(&ch->ref, ch_destroy);
 	return 0;
 }
-- 
2.16.4




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux