Thread (8 messages) flat view 8 messages, 5 authors, 2021-10-19

Re: [PATCH] scsi: sd: fix crashes in sd_resume_runtime

From: Stanley Chu <hidden>
Date: 2021-10-15 13:33:14
Also in: linux-arm-kernel, linux-scsi, lkml

Hi Miles,

On Fri, 2021-10-15 at 15:46 +0800, Miles Chen wrote:
After merging commit ed4246d37f3b ("scsi: sd: REQUEST SENSE for
BLIST_IGN_MEDIA_CHANGE devices in runtime_resume()"), I hit the
following crash on my device.

static int sd_resume_runtime(struct device *dev)
{
        struct scsi_disk *sdkp = dev_get_drvdata(dev);
        struct scsi_device *sdp = sdkp->device; // sdkp == NULL and
crash

        if (sdp->ignore_media_change) {
	...
}

I checked sd_resume() and found that sdkp is possbile to be NULL, and
there is a null pointer test in sd_resume() for this case.
To fix this crash, follow sd_resume() to test if sdkp is NULL
before dereferencing it.

LGTM.

Reviewed-by: Stanley Chu <redacted>


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help