OSDN Git Service

net: dsa: tag_qca: Make sure there is headroom for tag
authorPer Forlin <per.forlin@axis.com>
Thu, 13 Feb 2020 14:37:09 +0000 (15:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:34:34 +0000 (08:34 +0100)
[ Upstream commit 04fb91243a853dbde216d829c79d9632e52aa8d9 ]

Passing tag size to skb_cow_head will make sure
there is enough headroom for the tag data.
This change does not introduce any overhead in case there
is already available headroom for tag.

Signed-off-by: Per Forlin <perfn@axis.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/dsa/tag_qca.c

index 66a9521..9c0dd31 100644 (file)
@@ -41,7 +41,7 @@ static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev)
        struct dsa_port *dp = dsa_slave_to_port(dev);
        u16 *phdr, hdr;
 
-       if (skb_cow_head(skb, 0) < 0)
+       if (skb_cow_head(skb, QCA_HDR_LEN) < 0)
                return NULL;
 
        skb_push(skb, QCA_HDR_LEN);