[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADvbK_dRb8=D2GODA4aFsWzHr6Ka+Nd=1u4zBVSTdh6FqtGo7w@mail.gmail.com>
Date: Sat, 30 Dec 2017 21:51:18 +0800
From: Xin Long <lucien.xin@...il.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: syzbot <syzbot+fee64147a25aecd48055@...kaller.appspotmail.com>,
David Miller <davem@...emloft.net>,
LKML <linux-kernel@...r.kernel.org>, linux-sctp@...r.kernel.org,
Network Development <netdev@...r.kernel.org>,
Neil Horman <nhorman@...driver.com>,
syzkaller-bugs@...glegroups.com,
Vladislav Yasevich <vyasevich@...il.com>,
Marcelo Ricardo Leitner <marcelo.leitner@...il.com>
Subject: Re: general protection fault in skb_segment
On Sat, Dec 30, 2017 at 7:54 PM, Willem de Bruijn
<willemdebruijn.kernel@...il.com> wrote:
>> So this is a packet socket writing something that apparently looks
>> like an SCTP packet, is only 42 bytes long, but has GSO set in its
>> virtio_net_hdr struct.
>>
>> It crashes in skb_segment seemingly on a NULL list_skb.
>>
>> (gdb) list *(skb_segment+0x2a4)
>> 0xffffffff8167cc24 is in skb_segment (net/core/skbuff.c:3566).
>> 3561 if (hsize < 0)
>> 3562 hsize = 0;
>> 3563 if (hsize > len || !sg)
>> 3564 hsize = len;
>> 3565
>> 3566 if (!hsize && i >= nfrags && skb_headlen(list_skb) &&
>> 3567 (skb_headlen(list_skb) == len || sg)) {
>> 3568 BUG_ON(skb_headlen(list_skb) > len);
>> 3569
>> 3570 i = 0;
>
> It appears to be a packet that consists only of an sctp header.
> sctp_gso_segment pulls the header before calling skb_segment,
> after which hsize == skb_headlen(head_skb) == 0 and nfrags == 0.
>
> This check avoids the crash, but still triggers an skb_warn_bad_offload
> on return in __skb_gso_segment
>
> @@ -45,6 +45,13 @@ static struct sk_buff *sctp_gso_segment(struct sk_buff *skb,
> struct sk_buff *segs = ERR_PTR(-EINVAL);
> struct sctphdr *sh;
>
> + if (!skb_has_frag_list(skb))
> + goto out;
>
Shouldn't this check be in skb_segment(), right after if (mss ==
GSO_BY_FRAGS), like
if (unlikely(mss == GSO_BY_FRAGS)) {
if (unlikely(!list_skb))
goto err;
len = list_skb->len;
as the fix of commit 3953c46c3ac7 ("sk_buff: allow segmenting based on
frag sizes").
Powered by blists - more mailing lists