summaryrefslogtreecommitdiff
path: root/net/can/j1939/socket.c
diff options
context:
space:
mode:
authorOleksij Rempel <o.rempel@pengutronix.de>2020-08-07 13:51:56 +0300
committerMarc Kleine-Budde <mkl@pengutronix.de>2020-08-14 13:38:47 +0300
commitb43e3a82bc432c1caaed8950e7662c143470c54c (patch)
tree91aedb80a797b99504588187afdde196016b439c /net/can/j1939/socket.c
parent38ba8b9241f5848a49b80fddac9ab5f4692e434e (diff)
downloadlinux-b43e3a82bc432c1caaed8950e7662c143470c54c.tar.xz
can: j1939: transport: j1939_simple_recv(): ignore local J1939 messages send not by J1939 stack
In current J1939 stack implementation, we process all locally send messages as own messages. Even if it was send by CAN_RAW socket. To reproduce it use following commands: testj1939 -P -r can0:0x80 & cansend can0 18238040#0123 This step will trigger false positive not critical warning: j1939_simple_recv: Received already invalidated message With this patch we add additional check to make sure, related skb is own echo message. Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol") Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.kernel.org/r/20200807105200.26441-2-o.rempel@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net/can/j1939/socket.c')
-rw-r--r--net/can/j1939/socket.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c
index b634b680177f..ad973370de12 100644
--- a/net/can/j1939/socket.c
+++ b/net/can/j1939/socket.c
@@ -398,6 +398,7 @@ static int j1939_sk_init(struct sock *sk)
spin_lock_init(&jsk->sk_session_queue_lock);
INIT_LIST_HEAD(&jsk->sk_session_queue);
sk->sk_destruct = j1939_sk_sock_destruct;
+ sk->sk_protocol = CAN_J1939;
return 0;
}