Re: general protection fault in skb_segment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Dec 30, 2017 at 7:54 PM, Willem de Bruijn
<willemdebruijn.kernel@xxxxxxxxx> 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").
--
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Networking Development]     [Linux OMAP]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux