Skip to content

Commit 242408b

Browse files
mjbommargregkh
authored andcommitted
net: qrtr: fix 32-bit integer overflow in qrtr_endpoint_post()
commit 2005486 upstream. qrtr_endpoint_post() validates an incoming packet with if (!size || len != ALIGN(size, 4) + hdrlen) goto err; where size comes from the wire. On 32-bit, size_t is 32 bits and ALIGN(size, 4) wraps to 0 for size >= 0xfffffffd, so the check passes and skb_put_data(skb, data + hdrlen, size) writes past the hdrlen-sized skb and oopses the kernel. 64-bit is unaffected. This is the 32-bit residual of ad9d24c ("net: qrtr: fix OOB Read in qrtr_endpoint_post"), which fixed only the 64-bit case. Reject any size that cannot fit the buffer before the ALIGN. Fixes: ad9d24c ("net: qrtr: fix OOB Read in qrtr_endpoint_post") Cc: stable@vger.kernel.org Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260611125455.2352279-1-michael.bommarito@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8bd715a commit 242408b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/qrtr/af_qrtr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len)
491491
goto err;
492492
}
493493

494-
if (!size || len != ALIGN(size, 4) + hdrlen)
494+
if (!size || size > len || len != ALIGN(size, 4) + hdrlen)
495495
goto err;
496496

497497
if ((cb->type == QRTR_TYPE_NEW_SERVER ||

0 commit comments

Comments
 (0)