From: Johan Hovold <johan@kernel.org>
To: Yang Zi <2959243019@qq.com>
Cc: Alex Elder <elder@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] greybus: operation: fix NULL-deref on short request
Date: Fri, 4 Sep 2026 10:33:08 +0200 [thread overview]
Message-ID: <apqCRJXccCSZEMrn@hovoldconsulting.com> (raw)
In-Reply-To: <tencent_617A1B9F1DCD78A45A65AB7AFD8AAD84460A@qq.com>
On Fri, Sep 04, 2026 at 04:08:20PM +0800, Yang Zi wrote:
> gb_connection_recv() accepts a received message whose advertised size is
> smaller than struct gb_operation_msg_hdr. In particular, a header with a
> size of zero passes the incomplete-message check and reaches
> gb_operation_create_incoming().
>
> The subtraction used to derive the request payload size then underflows.
> When gb_operation_message_alloc() adds the header size, the result wraps
> to zero, bypassing the maximum-buffer-size check. kzalloc(0) returns
> ZERO_SIZE_PTR and gb_operation_message_init() subsequently dereferences
> it.
>
> Reject advertised sizes smaller than the message header. Also check the
> payload size before adding the header size, so that the size calculation
> cannot wrap and bypass the buffer-size limit.
>
> This issue was found using a locally modified syzkaller. The
> analysis and fix were assisted by GPT-5.6.
>
> Fixes: d90c25b0a279 ("greybus: let operation layer examine incoming data")
This one should also be backported:
Cc: stable@vger.kernel.org
> Assisted-by: Codex:gpt-5.6
> Signed-off-by: Yang Zi <2959243019@qq.com>
> ---
You should put a short change log here (after ---) when revising
patches.
No need to resend this time, but keep in mind for the future.
Reviewed-by: Johan Hovold <johan@kernel.org>
Johan
prev parent reply other threads:[~2026-09-04 8:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 10:00 [PATCH v2] greybus: operation: Fix NULL pointer dereference in gb_operation_message_alloc() Yang Zi
2026-08-28 12:21 ` Johan Hovold
2026-08-29 23:33 ` Yang Zi
2026-09-04 8:08 ` [PATCH v3] greybus: operation: fix NULL-deref on short request Yang Zi
2026-09-04 8:33 ` Johan Hovold [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=apqCRJXccCSZEMrn@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=2959243019@qq.com \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=linux-kernel@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®