[PATCH v1 08/10] j1939: transport: j1939_tp_send(): fix skb refcounting

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

 



We have disbalance between skb refcounting on RX and TX path. This patch
fixes the issue.

The WARN_ON_ONCE() will trigger if j1939_tp_send() is the last owner of
the skb. The skb is owned by the session now.

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

diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index 437124e87b59..6e097f75d3b7 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -1293,6 +1293,9 @@ int j1939_tp_send(struct j1939_priv *priv, struct sk_buff *skb)
 	if (!session)
 		return -ENOMEM;
 
+	/* skb is recounted in j1939_session_new() */
+	WARN_ON_ONCE(skb_unref(skb));
+
 	session->extd = extd;
 	session->transmission = true;
 	session->pkt.total = (skb->len + 6) / 7;
-- 
2.19.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