Phonet: refuse to send bigger than MTU packets
authorRémi Denis-Courmont <remi.denis-courmont@nokia.com>
Mon, 17 Nov 2008 03:48:49 +0000 (19:48 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Nov 2008 03:48:49 +0000 (19:48 -0800)
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/phonet/af_phonet.c

index defeb7a0d502ab92dcc7253f0f97e10ae341209e..7ab30f668b5a8226a6342118c96322e33f04a0c4 100644 (file)
@@ -144,8 +144,8 @@ static int pn_send(struct sk_buff *skb, struct net_device *dev,
        struct phonethdr *ph;
        int err;
 
-       if (skb->len + 2 > 0xffff) {
-               /* Phonet length field would overflow */
+       if (skb->len + 2 > 0xffff /* Phonet length field limit */ ||
+           skb->len + sizeof(struct phonethdr) > dev->mtu) {
                err = -EMSGSIZE;
                goto drop;
        }