提交 9cef310f 编写于 作者: A Alex Juncu 提交者: David S. Miller

llc: llc_cmsg_rcv was getting called after sk_eat_skb.

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: NAlexandru Juncu <ajuncu@ixiacom.com>
Signed-off-by: NKunjan Naik <knaik@ixiacom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a03ffcf8
...@@ -833,15 +833,15 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -833,15 +833,15 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
copied += used; copied += used;
len -= 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)) { if (!(flags & MSG_PEEK)) {
sk_eat_skb(sk, skb, 0); sk_eat_skb(sk, skb, 0);
*seq = 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 */ /* Partial read */
if (used + offset < skb->len) if (used + offset < skb->len)
continue; continue;
...@@ -857,6 +857,12 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -857,6 +857,12 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
} }
if (llc_sk(sk)->cmsg_flags) if (llc_sk(sk)->cmsg_flags)
llc_cmsg_rcv(msg, skb); llc_cmsg_rcv(msg, skb);
if (!(flags & MSG_PEEK)) {
sk_eat_skb(sk, skb, 0);
*seq = 0;
}
goto out; goto out;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册