Patchwork [04/14] netlink: don't orphan skb in netlink_trim()

login
register
mail settings
Submitter Patrick McHardy
Date April 17, 2013, 4:46 p.m.
Message ID <1366217229-22705-5-git-send-email-kaber@trash.net>
Download mbox | patch
Permalink /patch/237314/
State Awaiting Upstream
Headers show

Comments

Patrick McHardy - April 17, 2013, 4:46 p.m.
Netlink doesn't account skbs to the sending socket, so the there's no
need to orphan the skb before trimming it.

Removing the skb_orphan() call is required for mmap'ed netlink, which uses
a netlink specific skb destructor that must not be invoked before the
final freeing of the skb.

Signed-off-by: Patrick McHardy <kaber@trash.net>
---
 net/netlink/af_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 978a61f..26779c2 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -851,7 +851,7 @@  static struct sk_buff *netlink_trim(struct sk_buff *skb, gfp_t allocation)
 {
 	int delta;
 
-	skb_orphan(skb);
+	WARN_ON(skb->sk != NULL);
 
 	delta = skb->end - skb->tail;
 	if (delta * 2 < skb->truesize)