flow_dissector: Correctly handle parsing FCoE
authorAlexander Duyck <aduyck@mirantis.com>
Wed, 24 Feb 2016 17:29:51 +0000 (09:29 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Feb 2016 18:58:04 +0000 (13:58 -0500)
The flow dissector bits handling FCoE didn't bother to actually validate
that the space there was enough for the FCoE header.  So we need to update
things so that if there is room we add the header and report a good result,
otherwise we do not add the header, and report the bad result.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Acked-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/flow_dissector.c

index 8bd745f7273492fb138f582fa1064dc17d19c07f..6288153d7f368382325ffacf04ca92e3f4919169 100644 (file)
@@ -340,8 +340,11 @@ mpls:
        }
 
        case htons(ETH_P_FCOE):
-               key_control->thoff = (u16)(nhoff + FCOE_HEADER_LEN);
-               /* fall through */
+               if ((hlen - nhoff) < FCOE_HEADER_LEN)
+                       goto out_bad;
+
+               nhoff += FCOE_HEADER_LEN;
+               goto out_good;
        default:
                goto out_bad;
        }