]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
can: j1939: transport: j1939_session_fresh_new(): initialize receive buffer
authorOleksij Rempel <o.rempel@pengutronix.de>
Tue, 28 Jul 2026 05:58:35 +0000 (07:58 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 29 Jul 2026 08:15:33 +0000 (10:15 +0200)
Zero the allocated buffer in j1939_session_fresh_new() to ensure it
contains no residual data.

While there is a potential performance impact if users allocate maximum
sized ETP buffers, most real-world use cases are not noticeably affected
since the maximum known buffer size is typically around 65K.

Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
Reported-by: Ji'an Zhou <eilaimemedsnaimel@gmail.com>
Message-ID: <CAPAUci5dykCLjoijqkUtFqJFesgncrD7+S6y_V=gjbFkY2Tifg@mail.gmail.com>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://patch.msgid.link/20260728055835.1151785-3-o.rempel@pengutronix.de
Cc: stable@kernel.org
[mkl: add Message-ID]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
net/can/j1939/transport.c

index 98f96362b20f393bc011368c3738915f8ebc3833..8fcfd13e5e6f823ae97a2a9606c98d88ed07c389 100644 (file)
@@ -1581,7 +1581,7 @@ j1939_session *j1939_session_fresh_new(struct j1939_priv *priv,
        }
 
        /* alloc data area */
-       skb_put(skb, size);
+       skb_put_zero(skb, size);
        /* skb is recounted in j1939_session_new() */
        return session;
 }