提交 cd27b96b 编写于 作者: W WANG Cong 提交者: David S. Miller

kcm: fix a null pointer dereference in kcm_sendmsg()

In commit 98e3862c ("kcm: fix 0-length case for kcm_sendmsg()")
I tried to avoid skb allocation for 0-length case, but missed
a check for NULL pointer in the non EOR case.

Fixes: 98e3862c ("kcm: fix 0-length case for kcm_sendmsg()")
Reported-by: NDmitry Vyukov <dvyukov@google.com>
Cc: Tom Herbert <tom@herbertland.com>
Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
Acked-by: NTom Herbert <tom@herbertland.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 01f8902b
...@@ -1044,8 +1044,10 @@ static int kcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) ...@@ -1044,8 +1044,10 @@ static int kcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
} else { } else {
/* Message not complete, save state */ /* Message not complete, save state */
partial_message: partial_message:
kcm->seq_skb = head; if (head) {
kcm_tx_msg(head)->last_skb = skb; kcm->seq_skb = head;
kcm_tx_msg(head)->last_skb = skb;
}
} }
KCM_STATS_ADD(kcm->stats.tx_bytes, copied); KCM_STATS_ADD(kcm->stats.tx_bytes, copied);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册