kcm: fix a null pointer dereference in kcm_sendmsg()

In commit 98e3862ca2 ("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: 98e3862ca2 ("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>
This commit is contained in:
WANG Cong 2017-02-13 11:13:16 -08:00 коммит произвёл David S. Miller
Родитель 01f8902bcf
Коммит cd27b96bc1
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -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);