Skip to contentSkip to conversation

New: llc_fixup_skb considers PDU len including ETH_HLEN

Bug 68501 Stephen Hemminger 2 participants 2 messages Jan 10, 2014 – Jan 14, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Begin forwarded message:

Date: Fri, 10 Jan 2014 03:24:59 -0800
From: "[email protected]" <[email protected]>
To: "[email protected]" <[email protected]>
Subject: [Bug 68501] New: llc_fixup_skb considers PDU len including ETH_HLEN

https://bugzilla.kernel.org/show_bug.cgi?id=68501

            Bug ID: 68501
           Summary: llc_fixup_skb considers PDU len including ETH_HLEN
           Product: Networking
           Version: 2.5
    Kernel Version: 3.0.75
          Hardware: All
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: high
          Priority: P1
         Component: IPV4
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

In below snip of code in llc_fixup_skb we calculate pdulen from eth_hdr(skb)->h_proto which contains total length of packet include ETH_HLEN.

<snip>
119 if (skb->protocol == htons(ETH_P_802_2)) {
120 __be16 pdulen = eth_hdr(skb)->h_proto;
121 s32 data_size = ntohs(pdulen) - llc_len;
122
123 if (data_size < 0 ||
124 !pskb_may_pull(skb, data_size))
125 return 0;

</snip>

Line 121 should be changed to

121 s32 data_size = ntohs(pdulen) - llc_len - ETH_HLEN;

Log
---
kernel: pdu len 18432(72), data_size 69
kernel: skb len 55, skb data_len 0

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.
maintainer
#1 lore raw

From: Stephen Hemminger <[email protected]>
Date: Fri, 10 Jan 2014 15:11:56 -0800

Quoted 12 lines

In below snip of code in llc_fixup_skb we calculate pdulen from eth_hdr(skb)->h_proto which contains total length of packet include ETH_HLEN.

<snip>
119 if (skb->protocol == htons(ETH_P_802_2)) {
120 __be16 pdulen = eth_hdr(skb)->h_proto;
121 s32 data_size = ntohs(pdulen) - llc_len;
122
123 if (data_size < 0 ||
124 !pskb_may_pull(skb, data_size))
125 return 0;

Quoted 6 lines

</snip>

Line 121 should be changed to

121 s32 data_size = ntohs(pdulen) - llc_len - ETH_HLEN;

This can't be right, everything I can find says that the length here is:

the 802.2 packet length - the number of bytes of the 802.2 (LLC and data) portion of the frame, excluding padding

Which imples that the ethernet header length is not included.