From: Andrey Utkin <andrey.krieger.utkin@gmail.com>
To: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
acme@ghostprotocols.net, netdev@vger.kernel.org
Cc: davem@davemloft.net, Andrey Utkin <andrey.krieger.utkin@gmail.com>
Subject: [PATCH] appletalk: Set skb with destructor
Date: Sun, 6 Jul 2014 14:56:56 +0300 [thread overview]
Message-ID: <1404647816-7564-1-git-send-email-andrey.krieger.utkin@gmail.com> (raw)
In-Reply-To: <20140705202821.GA25880@mwanda>
The sock ref counting is off so there is a kernel panic when you run
`atalkd`. See https://bugzilla.kernel.org/show_bug.cgi?id=79441
This fix is similar to 0ae89beb283a ('can: add destructor for self
generated skbs')
Reported-by: Ed Martin <edman007@edman007.com>
Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com>
---
net/appletalk/ddp.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 01a1082..3d8ab34 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1399,6 +1399,11 @@ drop:
return NET_RX_DROP;
}
+static inline void atalk_skb_destructor(struct sk_buff *skb)
+{
+ sock_put(skb->sk);
+}
+
/**
* atalk_rcv - Receive a packet (in skb) from device dev
* @skb - packet received
@@ -1489,6 +1494,8 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
goto drop;
/* Queue packet (standard) */
+ sock_hold(sock);
+ skb->destructor = atalk_skb_destructor;
skb->sk = sock;
if (sock_queue_rcv_skb(sock, skb) < 0)
@@ -1644,6 +1651,8 @@ static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr
if (!skb)
goto out;
+ sock_hold(sk);
+ skb->destructor = atalk_skb_destructor;
skb->sk = sk;
skb_reserve(skb, ddp_dl->header_length);
skb_reserve(skb, dev->hard_header_len);
--
1.8.3.2
next prev parent reply other threads:[~2014-07-06 11:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-05 4:28 Andrey Utkin
2014-07-05 20:28 ` Dan Carpenter
2014-07-06 11:56 ` Andrey Utkin [this message]
2014-07-06 21:42 ` Eric Dumazet
2014-07-07 8:03 ` Andrey Utkin
2014-07-07 8:57 ` Eric Dumazet
2014-07-07 9:26 ` Eric Dumazet
2014-07-07 10:02 ` Andrey Utkin
2014-07-07 16:56 ` Eric Dumazet
2014-07-07 18:57 ` Andrey Utkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1404647816-7564-1-git-send-email-andrey.krieger.utkin@gmail.com \
--to=andrey.krieger.utkin@gmail.com \
--cc=acme@ghostprotocols.net \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®