netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH stable 3.11+] can: bcm: add skb destructor
@ 2014-01-28 20:42 Oliver Hartkopp
  2014-01-28 22:28 ` Eric Dumazet
  0 siblings, 1 reply; 10+ messages in thread
From: Oliver Hartkopp @ 2014-01-28 20:42 UTC (permalink / raw)
  To: Eric Dumazet, David Miller; +Cc: Linux Netdev List, Andre Naujoks

Commit 376c7311bdb6 (net: add a temporary sanity check in skb_orphan())
leads to a BUG in can_put_echo_skb() when skb_orphan() is executed.
When skbuffs created automatically in bcm_can_tx() in softirq (netrx, timer)
and userspace context the precise timing has to be met. A sock wmem accouting
is pointless for this use case.

This patch introduces an empty skb destructor like in commit 072017b41e49
(net: sctp: Add rudimentary infrastructure to account for control chunks)
to make the cyclic transmission of CAN frames work again on real CAN
netdevices. Virtual CAN interfaces do not need skb_orphan().

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>

---

diff --git a/net/can/bcm.c b/net/can/bcm.c
index 3fc737b..82af1a5 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -237,6 +237,11 @@ static const struct file_operations bcm_proc_fops = {
 	.release	= single_release,
 };
 
+static void bcm_skb_destructor(struct sk_buff *skb)
+{
+	/* no accounting needed for bcm_can_tx() */
+}
+
 /*
  * bcm_can_tx - send the (next) CAN frame to the appropriate CAN interface
  *              of the given bcm tx op
@@ -267,6 +272,7 @@ static void bcm_can_tx(struct bcm_op *op)
 	memcpy(skb_put(skb, CFSIZ), cf, CFSIZ);
 
 	/* send with loopback */
+	skb->destructor = bcm_skb_destructor;
 	skb->dev = dev;
 	skb->sk = op->sk;
 	can_send(skb, 1);

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-01-29 15:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-28 20:42 [PATCH stable 3.11+] can: bcm: add skb destructor Oliver Hartkopp
2014-01-28 22:28 ` Eric Dumazet
2014-01-28 22:49   ` Oliver Hartkopp
2014-01-28 23:51     ` Eric Dumazet
2014-01-29  7:40       ` Andre Naujoks
2014-01-29  7:46         ` David Miller
2014-01-29  8:47           ` Andre Naujoks
2014-01-29 14:53             ` Eric Dumazet
2014-01-29 15:35               ` Andre Naujoks
2014-01-29 15:48                 ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).