mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Sagi Grimberg <sagi@grimberg.me>,
	Pavel Begunkov <asml.silence@gmail.com>,
	Bilal Hashim <AeeSec@126.com>
Cc: <linux-nvme@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] nvme-pci: validate dmabuf size and sg_table bounds in nvme_dma_buf_io_map()
Date: Wed, 2 Dec 2026 07:15:35 -0800	[thread overview]
Message-ID: <179622453550.3405999.12281382687707830304.b4-ty@kernel.org> (raw)
In-Reply-To: <179610715173.42980.4278125034253504647@126.com>

On Tue, 01 Dec 2026 14:39:11 +0800, Bilal Hashim wrote:
> In nvme_dma_buf_io_map():
> 
> 1. ctx->dmabuf->size (size_t) is divided by NVME_CTRL_PAGE_SIZE and
>    stored into a 32-bit unsigned nr_entries without checking for zero or
>    overflow, and nvme_rq_setup_dmabuf_map() indexes the buffer via the
>    32-bit bio->bi_iter.bi_offset. Reject empty dma-bufs or dma-bufs
>    larger than UINT_MAX.
> 2. When populating map->dma_list[] from the scatter-gather table, there
>    is no bounds check against nr_entries. If the sg_table total DMA
>    length exceeds nr_entries * NVME_CTRL_PAGE_SIZE, map->dma_list[i++]
>    overflows the allocated buffer. Conversely, if the sg_table total DMA
>    length is smaller than nr_entries * NVME_CTRL_PAGE_SIZE, trailing
>    entries in map->dma_list[] remain uninitialized (kvmalloc_flex() does
>    not zero-initialize) and could be programmed as arbitrary NVMe DMA
>    addresses.
> 
> [...]

Thanks, applied to nvme-7.4.

[1/1] nvme-pci: validate dmabuf size and sg_table bounds in nvme_dma_buf_io_map()
      commit: 1ff946ecf80bcbc929ba5f80812b1f4646cf19c7
--
Keith Busch <kbusch@kernel.org>


      parent reply	other threads:[~2026-12-02 15:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  6:39 Bilal Hashim
2026-12-01  7:58 ` Christoph Hellwig
2026-12-02 15:15 ` 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=179622453550.3405999.12281382687707830304.b4-ty@kernel.org \
    --to=kbusch@kernel.org \
    --cc=AeeSec@126.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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®