diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c index 4be73de5033c..bff135a62712 100644 --- a/net/can/j1939/transport.c +++ b/net/can/j1939/transport.c @@ -261,6 +261,7 @@ static void __j1939_session_drop(struct j1939_session *session) static void j1939_session_destroy(struct j1939_session *session) { struct sk_buff *skb; + struct j1939_sk_buff_cb *skcb; if (session->transmission) { if (session->err) @@ -278,7 +279,11 @@ 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); + skcb = j1939_skb_to_cb(skb); + if (skcb->flags & J1939_ECU_LOCAL_SRC) + skb_unref(skb); + + printk("refcnt: %d, skb: %p, %s\n", refcount_read(&skb->users), skb, __func__); kfree_skb(skb); } __j1939_session_drop(session); @@ -341,6 +346,7 @@ static void j1939_session_skb_drop_old(struct j1939_session *session) if ((do_skcb->offset + do_skb->len) < offset_start) { __skb_unlink(do_skb, &session->skb_queue); /* drop ref taken in j1939_session_skb_queue() */ + printk("refcnt: %d, skb: %p, %s\n", refcount_read(&do_skb->users), do_skb, __func__); skb_unref(do_skb); spin_unlock_irqrestore(&session->skb_queue.lock, flags); @@ -365,6 +371,7 @@ void j1939_session_skb_queue(struct j1939_session *session, skcb->flags |= J1939_ECU_LOCAL_SRC; skb_get(skb); + printk("refcnt: %d, skb: %p, %s\n", refcount_read(&skb->users), skb, __func__); skb_queue_tail(&session->skb_queue, skb); }