Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16c5dcb1 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller
Browse files

net: dsa: Move skb_unshare() to dsa_switch_rcv()



All DSA tag receive functions need to unshare the skb before mangling it, move
this to the generic dsa_switch_rcv() function which will allow us to make the
tag receive function return their mangled skb without caring about freeing a
NULL skb.

Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9d7f9c4f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -906,6 +906,10 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
		return 0;
	}

	skb = skb_unshare(skb, GFP_ATOMIC);
	if (!skb)
		return 0;

	return dst->rcv(skb, dev, pt, orig_dev);
}

+0 −5
Original line number Diff line number Diff line
@@ -102,10 +102,6 @@ static int brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,

	ds = dst->cpu_switch;

	skb = skb_unshare(skb, GFP_ATOMIC);
	if (skb == NULL)
		goto out;

	if (unlikely(!pskb_may_pull(skb, BRCM_TAG_LEN)))
		goto out_drop;

@@ -151,7 +147,6 @@ static int brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,

out_drop:
	kfree_skb(skb);
out:
	return 0;
}

+0 −5
Original line number Diff line number Diff line
@@ -77,10 +77,6 @@ static int dsa_rcv(struct sk_buff *skb, struct net_device *dev,
	int source_device;
	int source_port;

	skb = skb_unshare(skb, GFP_ATOMIC);
	if (skb == NULL)
		goto out;

	if (unlikely(!pskb_may_pull(skb, DSA_HLEN)))
		goto out_drop;

@@ -175,7 +171,6 @@ static int dsa_rcv(struct sk_buff *skb, struct net_device *dev,

out_drop:
	kfree_skb(skb);
out:
	return 0;
}

+0 −5
Original line number Diff line number Diff line
@@ -90,10 +90,6 @@ static int edsa_rcv(struct sk_buff *skb, struct net_device *dev,
	int source_device;
	int source_port;

	skb = skb_unshare(skb, GFP_ATOMIC);
	if (skb == NULL)
		goto out;

	if (unlikely(!pskb_may_pull(skb, EDSA_HLEN)))
		goto out_drop;

@@ -194,7 +190,6 @@ static int edsa_rcv(struct sk_buff *skb, struct net_device *dev,

out_drop:
	kfree_skb(skb);
out:
	return 0;
}

+0 −5
Original line number Diff line number Diff line
@@ -55,10 +55,6 @@ static int mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,
	int port;
	__be16 *phdr, hdr;

	skb = skb_unshare(skb, GFP_ATOMIC);
	if (!skb)
		goto out;

	if (unlikely(!pskb_may_pull(skb, MTK_HDR_LEN)))
		goto out_drop;

@@ -105,7 +101,6 @@ static int mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,

out_drop:
	kfree_skb(skb);
out:
	return 0;
}

Loading