aboutsummaryrefslogtreecommitdiffstats
path: root/net/llc
diff options
context:
space:
mode:
authorAlex Juncu <ajuncu@ixiacom.com>2011-12-15 23:01:25 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-06 14:14:06 -0800
commit7eac8f9de24674cc55ee9797d05447bbfbdf1a96 (patch)
tree7c39b437e9413b5f09847c01e47729ad1508f01f /net/llc
parente2f377870311c6e2ecf77e1ed6bbcb175ce0dde9 (diff)
downloadkernel_samsung_espresso10-7eac8f9de24674cc55ee9797d05447bbfbdf1a96.zip
kernel_samsung_espresso10-7eac8f9de24674cc55ee9797d05447bbfbdf1a96.tar.gz
kernel_samsung_espresso10-7eac8f9de24674cc55ee9797d05447bbfbdf1a96.tar.bz2
llc: llc_cmsg_rcv was getting called after sk_eat_skb.
[ Upstream commit 9cef310fcdee12b49b8b4c96fd8f611c8873d284 ] Received non stream protocol packets were calling llc_cmsg_rcv that used a skb after that skb was released by sk_eat_skb. This caused received STP packets to generate kernel panics. Signed-off-by: Alexandru Juncu <ajuncu@ixiacom.com> Signed-off-by: Kunjan Naik <knaik@ixiacom.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net/llc')
-rw-r--r--net/llc/af_llc.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index dfd3a64..a18e6c3 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -833,15 +833,15 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
copied += used;
len -= used;
+ /* For non stream protcols we get one packet per recvmsg call */
+ if (sk->sk_type != SOCK_STREAM)
+ goto copy_uaddr;
+
if (!(flags & MSG_PEEK)) {
sk_eat_skb(sk, skb, 0);
*seq = 0;
}
- /* For non stream protcols we get one packet per recvmsg call */
- if (sk->sk_type != SOCK_STREAM)
- goto copy_uaddr;
-
/* Partial read */
if (used + offset < skb->len)
continue;
@@ -857,6 +857,12 @@ copy_uaddr:
}
if (llc_sk(sk)->cmsg_flags)
llc_cmsg_rcv(msg, skb);
+
+ if (!(flags & MSG_PEEK)) {
+ sk_eat_skb(sk, skb, 0);
+ *seq = 0;
+ }
+
goto out;
}