From: "Creeley, Brett" <bcreeley@amd.com>
To: Heechan Kang <gganji11@naver.com>,
Brett Creeley <brett.creeley@amd.com>,
Jason Gunthorpe <jgg@ziepe.ca>
Cc: Dave Jiang <dave.jiang@intel.com>,
Saeed Mahameed <saeedm@nvidia.com>,
Jonathan Cameron <jic23@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] fwctl: pds: Validate RPC input size before parsing
Date: Mon, 18 May 2026 11:36:01 -0700 [thread overview]
Message-ID: <d49232e8-304d-43ef-86f2-11bde2170250@amd.com> (raw)
In-Reply-To: <20260517062232.1858747-1-gganji11@naver.com>
On 5/16/2026 11:22 PM, Heechan Kang wrote:
> [You don't often get email from gganji11@naver.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> The fwctl core allocates the device-specific RPC input buffer with
> fwctl_rpc.in_len and passes that buffer to the driver callback.
>
> pdsfc_fw_rpc() casts the buffer to struct fwctl_rpc_pds and then calls
> pdsfc_validate_rpc(), which reads fields from that structure before
> checking that the input buffer is large enough to contain it. A short
> in_len can make pds_fwctl read beyond the allocation.
>
> Reject pds RPC buffers that are smaller than struct fwctl_rpc_pds before
> parsing any pds-specific fields.
>
> Fixes: 92c66ee829b9 ("pds_fwctl: add rpc and query support")
> Cc: stable@vger.kernel.org # v6.15+
> Signed-off-by: Heechan Kang <gganji11@naver.com>
> ---
> drivers/fwctl/pds/main.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/fwctl/pds/main.c b/drivers/fwctl/pds/main.c
> index 08872ee8422f..68fe254dd10a 100644
> --- a/drivers/fwctl/pds/main.c
> +++ b/drivers/fwctl/pds/main.c
> @@ -362,6 +362,9 @@ static void *pdsfc_fw_rpc(struct fwctl_uctx *uctx, enum fwctl_rpc_scope scope,
> void *out = NULL;
> int err;
>
> + if (in_len < sizeof(*rpc))
> + return ERR_PTR(-EINVAL);
> +
LGTM. Thanks for the fix.
Brett
> err = pdsfc_validate_rpc(pdsfc, rpc, scope);
> if (err)
> return ERR_PTR(err);
> --
> 2.34.1
>
next prev parent reply other threads:[~2026-05-18 18:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-17 6:22 Heechan Kang
2026-05-18 15:26 ` Dave Jiang
2026-05-18 18:36 ` Creeley, Brett [this message]
2026-05-19 14:30 ` Jason Gunthorpe
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=d49232e8-304d-43ef-86f2-11bde2170250@amd.com \
--to=bcreeley@amd.com \
--cc=brett.creeley@amd.com \
--cc=dave.jiang@intel.com \
--cc=gganji11@naver.com \
--cc=gregkh@linuxfoundation.org \
--cc=jgg@ziepe.ca \
--cc=jic23@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=saeedm@nvidia.com \
--cc=stable@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®