[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4cfa4049-aae5-51db-4ad2-b4c9db996525@acm.org>
Date: Mon, 1 Nov 2021 13:06:16 -0700
From: Bart Van Assche <bvanassche@....org>
To: Tadeusz Struk <tadeusz.struk@...aro.org>,
linux-scsi@...r.kernel.org
Cc: Christoph Hellwig <hch@....de>,
"James E . J . Bottomley" <jejb@...ux.ibm.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
linux-kernel@...r.kernel.org, stable@...r.kernel.org,
syzbot+5516b30f5401d4dcbcae@...kaller.appspotmail.com
Subject: Re: [PATCH] scsi: core: initialize cmd->cmnd before it is used
On 11/1/21 12:24 PM, Tadeusz Struk wrote:
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 572673873ddf..cd4b57747448 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1173,10 +1173,10 @@ static blk_status_t scsi_setup_scsi_cmnd(struct scsi_device *sdev,
> memset(&cmd->sdb, 0, sizeof(cmd->sdb));
> }
>
> + cmd->cmnd = scsi_req(req)->cmd;
> cmd->cmd_len = scsi_req(req)->cmd_len;
> if (cmd->cmd_len == 0)
> cmd->cmd_len = scsi_command_size(cmd->cmnd);
> - cmd->cmnd = scsi_req(req)->cmd;
> cmd->transfersize = blk_rq_bytes(req);
> cmd->allowed = scsi_req(req)->retries;
> return BLK_STS_OK;
This patch is a duplicate and has been posted before.
Please take a look at https://lore.kernel.org/linux-scsi/20210904064534.1919476-1-qiulaibin@huawei.com/.
From the replies to that email:
"> Thinking further about this: is there any code left that depends on
> scsi_setup_scsi_cmnd() setting cmd->cmd_len? Can the cmd->cmd_len
> assignment be removed from scsi_setup_scsi_cmnd()?
cmd_len should never be 0 now, so I think we can remove it."
Thanks,
Bart.
Powered by blists - more mailing lists