]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
99306439e8757d5392fb5f7eab9500bc2fa88e9d
[thirdparty/kernel/stable-queue.git] /
1 From 8ef49f7f8244424adcf4a546dba4cbbeb0b09c09 Mon Sep 17 00:00:00 2001
2 From: Fedor Pchelkin <pchelkin@ispras.ru>
3 Date: Fri, 29 Jul 2022 17:36:55 +0300
4 Subject: can: j1939: j1939_sk_queue_activate_next_locked(): replace WARN_ON_ONCE with netdev_warn_once()
5
6 From: Fedor Pchelkin <pchelkin@ispras.ru>
7
8 commit 8ef49f7f8244424adcf4a546dba4cbbeb0b09c09 upstream.
9
10 We should warn user-space that it is doing something wrong when trying
11 to activate sessions with identical parameters but WARN_ON_ONCE macro
12 can not be used here as it serves a different purpose.
13
14 So it would be good to replace it with netdev_warn_once() message.
15
16 Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
17
18 Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
19 Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
20 Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
21 Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
22 Link: https://lore.kernel.org/all/20220729143655.1108297-1-pchelkin@ispras.ru
23 [mkl: fix indention]
24 Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26 ---
27 net/can/j1939/socket.c | 5 ++++-
28 1 file changed, 4 insertions(+), 1 deletion(-)
29
30 --- a/net/can/j1939/socket.c
31 +++ b/net/can/j1939/socket.c
32 @@ -178,7 +178,10 @@ activate_next:
33 if (!first)
34 return;
35
36 - if (WARN_ON_ONCE(j1939_session_activate(first))) {
37 + if (j1939_session_activate(first)) {
38 + netdev_warn_once(first->priv->ndev,
39 + "%s: 0x%p: Identical session is already activated.\n",
40 + __func__, first);
41 first->err = -EBUSY;
42 goto activate_next;
43 } else {