]> git.ipfire.org Git - thirdparty/linux.git/commit
fwctl: pds: Validate RPC input size before parsing
authorHeechan Kang <gganji11@naver.com>
Sun, 17 May 2026 06:22:32 +0000 (15:22 +0900)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 19 May 2026 13:44:32 +0000 (10:44 -0300)
commite7537735028c3ad4b0bfc02ff8fa2a1a28aa04fe
treec69991aaf8b9965b3ff82509214d727dcf888f6f
parent5200f5f493f79f14bbdc349e402a40dfb32f23c8
fwctl: pds: Validate RPC input size before parsing

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")
Link: https://patch.msgid.link/r/20260517062232.1858747-1-gganji11@naver.com
Cc: stable@vger.kernel.org # v6.15+
Signed-off-by: Heechan Kang <gganji11@naver.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/fwctl/pds/main.c