diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c index 4be73de5033c..50d96015c125 100644 --- a/net/can/j1939/transport.c +++ b/net/can/j1939/transport.c @@ -278,7 +278,8 @@ static void j1939_session_destroy(struct j1939_session *session) while ((skb = skb_dequeue(&session->skb_queue)) != NULL) { /* drop ref taken in j1939_session_skb_queue() */ - skb_unref(skb); + if (skb_unref(skb) && IS_ENABLED(CONFIG_DEBUG_NET)) + skb_get(skb); kfree_skb(skb); } __j1939_session_drop(session);