From: kensanya <kensanya@163.com>
To: "Bart Van Assche" <bvanassche@acm.org>
Cc: jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org,
target-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
TanZheng <tanzheng@kylinos.cn>
Subject: Re:Re: [PATCH] RDMA/srpt: fix NULL deref when sending BUSY before target_init_cmd()
Date: Wed, 22 Jul 2026 09:52:42 +0800 (CST) [thread overview]
Message-ID: <41ddb3a1.16d1.19f87866fa1.Coremail.kensanya@163.com> (raw)
In-Reply-To: <e5c8e258-8c57-40c8-88a9-04173392e9ae@acm.org>
At 2026-07-21 00:31:58, "Bart Van Assche" <bvanassche@acm.org> wrote:
>On 7/19/26 7:59 PM, kensanya@163.com wrote:
>> + rc = target_init_cmd(cmd, ch->sess, &send_ioctx->sense_data[0],
>> + scsilun_to_int(&srp_cmd->lun), 0 /* data_len */,
>> + TCM_SIMPLE_TAG, DMA_NONE, TARGET_SCF_ACK_KREF);
>> + if (rc != 0) {
>> + pr_debug("target_init_cmd() returned %d for tag %#llx\n", rc,
>> + srp_cmd->tag);
>> + goto busy;
>> + }
>
>This will cause target_send_busy() to be called on an uninitialized
>command and that isn't allowed, isn't it?
>
>Thanks,
>
>Bart.
You are right that target_send_busy() must not be used when
target_init_cmd() fails: the command is not fully set up for the
target-core completion path (e.g. cmd_cnt was not taken on
-ESHUTDOWN). That goto-busy-on-init-failure path already existed
before the reorder.
How about the following plan?
- If target_init_cmd() fails:
release the send ioctx locally via target_free_tag(ch->sess, cmd)
and do not call target_send_busy()
- If target_init_cmd() succeeds but a later step fails
(e.g. srpt_get_desc_tbl()):
keep using target_send_busy(cmd)
Thanks,
TanZheng
next prev parent reply other threads:[~2026-07-22 1:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 2:59 kensanya
2026-07-20 16:31 ` Bart Van Assche
2026-07-22 1:52 ` kensanya [this message]
2026-07-22 18:10 ` Bart Van Assche
2026-07-23 1:55 ` kensanya
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41ddb3a1.16d1.19f87866fa1.Coremail.kensanya@163.com \
--to=kensanya@163.com \
--cc=bvanassche@acm.org \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=tanzheng@kylinos.cn \
--cc=target-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®