mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 04:48:04 +09:00
target/pscsi: Fix NULL pointer dereference in get_device_type
commit 215a8fe419 upstream.
This patch fixes a NULL pointer dereference OOPs with pSCSI backends
within target_core_stat.c code. The bug is caused by a configfs attr
read if no pscsi_dev_virt->pdv_sd has been configured.
Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2078161617
commit
3bb09afbce
@@ -1112,7 +1112,7 @@ static u32 pscsi_get_device_type(struct se_device *dev)
|
||||
struct pscsi_dev_virt *pdv = PSCSI_DEV(dev);
|
||||
struct scsi_device *sd = pdv->pdv_sd;
|
||||
|
||||
return sd->type;
|
||||
return (sd) ? sd->type : TYPE_NO_LUN;
|
||||
}
|
||||
|
||||
static sector_t pscsi_get_blocks(struct se_device *dev)
|
||||
|
||||
Reference in New Issue
Block a user