[PATCH v1 6/6] j1939: transport: j1939_xtp_rx_dat_one: add sanity check for j1939_session_skb_find()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



j1939_session_skb_find() may return NULL.

Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
---
 net/can/j1939/transport.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index 9872082254c4..cda1db7a46a1 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -1703,6 +1703,12 @@ static void j1939_xtp_rx_dat_one(struct j1939_session *session,
 		goto out_session_unlock;
 	}
 	se_skb = j1939_session_skb_find(session);
+	if (!se_skb) {
+		netdev_warn(priv->ndev, "%s: 0x%p: no skb found\n", __func__,
+			    session);
+		goto out_session_unlock;
+	}
+
 	skcb = j1939_skb_to_cb(se_skb);
 	offset = packet * 7 - skcb->offset;
 	nbytes = se_skb->len - offset;
-- 
2.20.1




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux