Skip to content

Commit

Permalink
changer: BKL pushdown
Browse files Browse the repository at this point in the history
Add lock_kernel() calls to ch_open(), though the existing locking looks
adequate.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
  • Loading branch information
Jonathan Corbet committed Jun 20, 2008
1 parent dea3f66 commit b0061a0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/scsi/ch.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/chio.h> /* here are all the ioctls */
#include <linux/mutex.h>
#include <linux/idr.h>
#include <linux/smp_lock.h>

#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
Expand Down Expand Up @@ -571,16 +572,19 @@ ch_open(struct inode *inode, struct file *file)
scsi_changer *ch;
int minor = iminor(inode);

lock_kernel();
spin_lock(&ch_index_lock);
ch = idr_find(&ch_index_idr, minor);

if (NULL == ch || scsi_device_get(ch->device)) {
spin_unlock(&ch_index_lock);
unlock_kernel();
return -ENXIO;
}
spin_unlock(&ch_index_lock);

file->private_data = ch;
unlock_kernel();
return 0;
}

Expand Down

0 comments on commit b0061a0

Please sign in to comment.