[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALx6S37U6zYd1Pr6B3OfAXYBPXhGeLTrwFX6s1b7aR-BRnbLmg@mail.gmail.com>
Date: Mon, 13 Feb 2017 11:18:10 -0800
From: Tom Herbert <tom@...bertland.com>
To: Cong Wang <xiyou.wangcong@...il.com>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
dvyukov@...gle.com
Subject: Re: [Patch net] kcm: fix a null pointer dereference in kcm_sendmsg()
On Mon, Feb 13, 2017 at 11:13 AM, Cong Wang <xiyou.wangcong@...il.com> wrote:
> 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@...gle.com>
> Cc: Tom Herbert <tom@...bertland.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>
Acked-by: Tom Herbert <tom@...bertland.com>
> ---
> net/kcm/kcmsock.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
> index 64f0e85..a646f34 100644
> --- a/net/kcm/kcmsock.c
> +++ b/net/kcm/kcmsock.c
> @@ -1044,8 +1044,10 @@ static int kcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
> } 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);
> --
> 2.5.5
>
Powered by blists - more mailing lists