Message ID | 20220324134603.28463-1-thenzl@redhat.com |
---|---|
State | New |
Headers | show |
Series | scsi_logging: fix a BUG | expand |
On Thu, Mar 24, 2022 at 02:46:03PM +0100, Tomas Henzl wrote: > 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 <czhong@redhat.com> > Signed-off-by: Tomas Henzl <thenzl@redhat.com> As a quick fix this look good: Reviewed-by: Christoph Hellwig <hch@lst.de> but I really wonder if we should print some other identifier if the disk name is not available.
Tomas, > The request_queue may be NULL in a request, for example when it comes > from scsi_ioctl_reset. Check it before before use. Applied to 5.18/scsi-staging, thanks!
On Thu, 24 Mar 2022 14:46:03 +0100, Tomas Henzl wrote: > 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") > > > [...] Applied to 5.18/scsi-fixes, thanks! [1/1] scsi_logging: fix a BUG https://git.kernel.org/mkp/scsi/c/f06aa52cb272
diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c index 1f8f80b2dbfc..a9f8de5e9639 100644 --- a/drivers/scsi/scsi_logging.c +++ b/drivers/scsi/scsi_logging.c @@ -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; }
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 <czhong@redhat.com> Signed-off-by: Tomas Henzl <thenzl@redhat.com> --- drivers/scsi/scsi_logging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)