diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2017-02-13 22:13:16 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-14 21:06:37 +0300 |
commit | cd27b96bc13841ee7af25837a6ae86fee87273d6 (patch) | |
tree | b0b7bbfad0aab8b7825f6bc259d7c1736e895e1f /net/kcm | |
parent | 01f8902bcf3ff124d0aeb88a774180ebcec20ace (diff) | |
download | linux-cd27b96bc13841ee7af25837a6ae86fee87273d6.tar.xz |
kcm: fix a null pointer dereference in kcm_sendmsg()
In commit 98e3862ca2b1 ("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: 98e3862ca2b1 ("kcm: fix 0-length case for kcm_sendmsg()")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Tom Herbert <tom@herbertland.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/kcm')
-rw-r--r-- | net/kcm/kcmsock.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index 64f0e8531af0..a646f3481240 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c @@ -1044,8 +1044,10 @@ wait_for_memory: } else { /* Message not complete, save state */ partial_message: - kcm->seq_skb = head; - kcm_tx_msg(head)->last_skb = skb; + if (head) { + kcm->seq_skb = head; + kcm_tx_msg(head)->last_skb = skb; + } } KCM_STATS_ADD(kcm->stats.tx_bytes, copied); |