scst_local: Fix a kernel oops for kernel versions < 2.6.37

Avoid that scst_local triggers "BUG: unable to handle kernel NULL
pointer dereference" on kernel versions before 2.6.37. This patch
fixes a regression introduced via patch "scst_local: Avoid
deadlock during module removal with kernel 3.6" (trunk r4566).

Reported-by: Sebastian Herbszt <herbszt@gmx.de>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5264 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2014-02-06 12:46:51 +00:00
parent be9a78a844
commit cf699a6d95

View File

@@ -960,6 +960,14 @@ static int scst_local_queuecommand_lck(struct scsi_cmnd *SCpnt,
TRACE_DBG("lun %d, cmd: 0x%02X", SCpnt->device->lun, SCpnt->cmnd[0]);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
/*
* We save a pointer to the done routine in SCpnt->scsi_done and
* we save that as tgt specific stuff below.
*/
SCpnt->scsi_done = done;
#endif
sess = to_scst_lcl_sess(scsi_get_device(SCpnt->device->host));
if (sess->unregistering) {
@@ -983,12 +991,6 @@ static int scst_local_queuecommand_lck(struct scsi_cmnd *SCpnt,
}
tgt_specific->cmnd = SCpnt;
tgt_specific->done = done;
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
/*
* We save a pointer to the done routine in SCpnt->scsi_done and
* we save that as tgt specific stuff below.
*/
SCpnt->scsi_done = done;
#endif
/*