scsi_logging: fix a BUG
PATCH 1/1 scsi_logging: fix a BUG
The request_queue may be NULL in a request, for example when it comes from scsi_ioctl_reset.
Check it before before use.
Fixes f3fa33acca9f ("block: remove the ->rq_disk field in struct request")
Reported-by Changhui Zhong <[email protected]>
Signed-off-by Tomas Henzl <[email protected]>
--- drivers/scsi/scsi_logging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_logging.c +1 -1
@@ -30,7 +30,7 @@ static inline const char *scmd_name(const struct scsi_cmnd *scmd) {struct request *rq =scsi_cmd_to_rq ((struct scsi_cmnd *)scmd); -if (!rq->q->disk) +if (!rq->q || !rq->q->disk)return NULL ;return rq->q->disk->disk_name; }
Signature · 1 line
2.35.1
Quoted 8 lines · Tomas Henzl
The
request_queuemay be NULL in a request, for example when it comes fromscsi_ioctl_reset.
Check it before before use.Fixes f3fa33acca9f ("block: remove the ->rq_disk field in struct request")Reported-by Changhui Zhong <[email protected]>Signed-off-by Tomas Henzl <[email protected]>
As a quick fix this look good:
Reviewed-by Christoph Hellwig <[email protected]>
but I really wonder if we should print some other identifier if the disk name is not available.
Martin K. Petersen
AppliedTomas,
Quoted 2 lines
The
request_queuemay be NULL in a request, for example when it comes fromscsi_ioctl_reset. Check it before before use.
Applied to 5.18/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 8 lines · Tomas Henzl
The
request_queuemay be NULL in a request, for example when it comes fromscsi_ioctl_reset.
Check it before before use.Fixes f3fa33acca9f ("block: remove the ->rq_disk field in struct request")[...]
Applied to 5.18/scsi-fixes, thanks!
[1/1] scsi_logging: fix a BUG
https://git.kernel.org/mkp/scsi/c/f06aa52cb272
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering