Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Aibing Chen" <chenaibing@cmss.chinamobile.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net] net/mlx5: fix a stack over-read in the QP debugfs files
Date: Sat, 21 Nov 2026 07:50:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-226804@kernel.org> (raw)
In-Reply-To: <20261120075005.843-1-chenaibing@cmss.chinamobile.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] net/mlx5: missing Fixes trailer for dbg_read() stack over-read
  fix
--

commit c7738a815f7b3e2a3b05f4aa38b531b12c7020f2
Author: Aibing Chen <chenaibing@cmss.chinamobile.com>

> net/mlx5: fix a stack over-read in the QP debugfs files
>
> dbg_read() formats the field into char tbuf[18] and passes the return
> value of snprintf() to simple_read_from_buffer() as the number of
> available bytes.  snprintf() returns the length the output would have
> had, not the number of bytes written, so when the string does not fit
> that value is larger than the buffer: the longest QP transport string is
> "Invalid transport type" (22 characters), so with the trailing newline
> the function returns 23 while only 18 bytes were written.
>
> simple_read_from_buffer() uses that length to bound the copy to
> userspace, so reading .../qp/<qpn>/transport copies up to 23 bytes out of
> the 18 byte stack array, leaking 5 bytes of stack.
>
> Enlarge the buffer so the longest string fits and use scnprintf(), which
> returns the number of bytes actually written.
>
> Signed-off-by: Aibing Chen <chenaibing@cmss.chinamobile.com>

[Severity: Low]
This fixes the stack over-read when formatting QP string fields into tbuf.
Should this include:

  Fixes: db81a5c374b5 ("mlx5_core: Improve debugfs readability")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120075005.843-1-chenaibing@cmss.chinamobile.com?part=1

      parent reply	other threads:[~2026-11-21  7:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  7:50 [PATCH net] net/mlx5: fix a stack over-read in the QP debugfs files Aibing Chen
2026-11-20  7:53 ` netdev-bot+sinfo
2026-11-20  9:53   ` Aibing Chen
2026-11-21  7:50 ` sashiko-bot [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=sashiko-outbox-226804@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=chenaibing@cmss.chinamobile.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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