mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Yifei Chu <Chuyf26@linux.alibaba.com>
Cc: axboe@kernel.dk, hch@lst.de, sagi@grimberg.me,
	roys@lightbitslabs.com, yhlee@isslab.korea.ac.kr,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] nvme-tcp: reject C2HData for a non-read command
Date: Tue, 8 Sep 2026 13:59:08 -0600	[thread overview]
Message-ID: <aqBpDGHdRAAyAI4u@kbusch-mbp> (raw)
In-Reply-To: <178842720109.1034236.7954869548413684234@linux.alibaba.com>

On Thu, Sep 03, 2026 at 05:20:01PM +0800, Yifei Chu wrote:
> A malicious or buggy controller can send C2HData PDUs in response to a
> WRITE command.  nvme_tcp_handle_c2h_data() accepts them as long as the
> request has payload bytes and a current bio, which is true for writes,
> so the receive path ends up copying the incoming data into the
> request's iterator.  That iterator was initialized from rq_data_dir(rq)
> in nvme_tcp_init_iter(), i.e. ITER_SOURCE for a write, and
> _copy_to_iter() refuses to copy into a source iterator: it triggers its
> WARN_ON_ONCE() and returns 0, the short copy fails with -EFAULT, and
> the connection is torn down into error recovery.  The write never
> completes: every reconnect reissues it and a malicious target answers
> with C2HData again, keeping the controller in a permanent
> reset/reconnect loop.  With panic_on_warn this is an outright crash.
> 
> C2HData carries data transferred from the controller to the host and
> is only valid for commands that read data from the device; write data
> travels host to controller in H2CData PDUs solicited by R2T.  This was
> reproduced against a target modified to reply to a WRITE with C2HData:
> the host logs
> 
>     WARNING: CPU: 0 PID: ... at lib/iov_iter.c _copy_to_iter
>     Workqueue: nvme_tcp_wq nvme_tcp_io_work [nvme_tcp]
> 
> and the controller cycles through reset/reconnect without the write
> ever completing.

This is already closed:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=f83af377c148f6ad94b41c0e8313f12adf45e1c1

      parent reply	other threads:[~2026-09-08 19:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-21  9:28 [PATCH] " Chuyf26
2026-08-22 21:25 ` Sagi Grimberg
2026-09-03  9:20   ` [PATCH v2] " Yifei Chu
2026-09-06  0:05     ` Sagi Grimberg
2026-09-08 19:59     ` Keith Busch [this message]

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=aqBpDGHdRAAyAI4u@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=Chuyf26@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=roys@lightbitslabs.com \
    --cc=sagi@grimberg.me \
    --cc=yhlee@isslab.korea.ac.kr \
    /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®