Re: [PATCH 1/2] Revert "scsi: core: Do not increase scsi_device's iorequest_cnt if dispatch failed"

From: Ming Lei
Date: Mon May 15 2023 - 04:46:38 EST


On Mon, May 15, 2023 at 03:01:55PM +0800, Wenchao Hao wrote:
> the "atomic_inc(&cmd->device->iorequest_cnt)" in scsi_queue_rq() would
> causes kernel panic, because cmd->device may be freed after returning
> from scsi_dispatch_cmd().
>
> This reverts commit cfee29ffb45b1c9798011b19d454637d1b0fe87d.
>
> Signed-off-by: Wenchao Hao <haowenchao2@xxxxxxxxxx>
> Reported-by: Ming Lei <ming.lei@xxxxxxxxxx>
> Closes:https://lore.kernel.org/linux-scsi/8e0f2d31-e6ff-ec4a-3974-450560ad49c5@xxxxxxxxxx/T/#t

Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx>

Thanks,
Ming