[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230405-backlit-unscathed-fab6044bdc4c@pengutronix.de>
Date: Wed, 5 Apr 2023 10:24:03 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: Robin van der Gracht <robin@...tonic.nl>,
Oliver Hartkopp <socketcan@...tkopp.net>,
Shuangpeng Bai <sjb7183@....edu>, kernel@...gutronix.de,
linux-can@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] net: can: j1939: Fix out-of-bounds memory access in
j1939_tp_tx_dat_new
On 04.04.2023 09:31:28, Oleksij Rempel wrote:
> In the j1939_tp_tx_dat_new function, an out-of-bounds memory access
> could occur during the memcpy operation if the size of skb->cb is
> larger than the size of struct j1939_sk_buff_cb. This is because the
> memcpy operation uses the size of skb->cb, leading to a read beyond
> the struct j1939_sk_buff_cb.
>
> To address this issue, we have updated the memcpy operation to use the
> size of struct j1939_sk_buff_cb instead of the size of skb->cb. This
> ensures that the memcpy operation only reads the memory within the
> bounds of struct j1939_sk_buff_cb, preventing out-of-bounds memory
> access.
>
> Additionally, a static_assert has been added to check that the size of
> skb->cb is greater than or equal to the size of struct j1939_sk_buff_cb.
> This ensures that the skb->cb buffer is large enough to hold the
> j1939_sk_buff_cb structure.
>
> Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
> Reported-by: Shuangpeng Bai <sjb7183@....edu>
> Tested-by: Shuangpeng Bai <sjb7183@....edu>
> Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
Applied.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists