mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-02 00:24:12 +08:00
target/pscsi: Fix bug with REPORT_LUNs handling for SCSI passthrough
This patch fixes a regression bug in pscsi_transport_complete() callback
code where *pt was being NULL dereferenced during REPORT_LUNS handling,
that was introduced with the spc/sbc refactoring in:
commit 1fd032ee10
Author: Christoph Hellwig <hch@infradead.org>
Date: Sun May 20 11:59:15 2012 -0400
target: move code for CDB emulation
As this is a special case for pscsi_parse_cdb() to call spc_parse_cdb() to
allow TCM to handle REPORT_LUN emulation, pscsi_plugin_task will have not
been allocated..
So now in pscsi_transport_complete() just check for existence of *pt and
return for this special case.
Reported-by: Alex Elsayed <eternaleye+usenet@gmail.com>
Cc: Alex Elsayed <eternaleye+usenet@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
parent
5b7517f814
commit
1d2a2cd95e
@ -673,8 +673,15 @@ static int pscsi_transport_complete(struct se_cmd *cmd, struct scatterlist *sg)
|
||||
struct scsi_device *sd = pdv->pdv_sd;
|
||||
int result;
|
||||
struct pscsi_plugin_task *pt = cmd->priv;
|
||||
unsigned char *cdb = &pt->pscsi_cdb[0];
|
||||
unsigned char *cdb;
|
||||
/*
|
||||
* Special case for REPORT_LUNs handling where pscsi_plugin_task has
|
||||
* not been allocated because TCM is handling the emulation directly.
|
||||
*/
|
||||
if (!pt)
|
||||
return 0;
|
||||
|
||||
cdb = &pt->pscsi_cdb[0];
|
||||
result = pt->pscsi_result;
|
||||
/*
|
||||
* Hack to make sure that Write-Protect modepage is set if R/O mode is
|
||||
|
Loading…
Reference in New Issue
Block a user