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

Commit 8764ab2c authored by Steffen Klassert's avatar Steffen Klassert Committed by David S. Miller
Browse files

net: check for refcount if pop a stacked dst_entry



xfrm triggers a warning if dst_pop() drops a refcount
on a noref dst. This patch changes dst_pop() to
skb_dst_pop(). skb_dst_pop() drops the refcnt only
on a refcounted dst. Also we don't clone the child
dst_entry, so it is not refcounted and we can use
skb_dst_set_noref() in xfrm_output_one().

Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4f4aeb7f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -250,11 +250,11 @@ static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)
 * Linux networking.  Thus, destinations are stackable.
 */

static inline struct dst_entry *dst_pop(struct dst_entry *dst)
static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
{
	struct dst_entry *child = dst_clone(dst->child);
	struct dst_entry *child = skb_dst(skb)->child;

	dst_release(dst);
	skb_dst_drop(skb);
	return child;
}

+2 −2
Original line number Diff line number Diff line
@@ -95,13 +95,13 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
			goto error_nolock;
		}

		dst = dst_pop(dst);
		dst = skb_dst_pop(skb);
		if (!dst) {
			XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR);
			err = -EHOSTUNREACH;
			goto error_nolock;
		}
		skb_dst_set(skb, dst);
		skb_dst_set_noref(skb, dst);
		x = dst->xfrm;
	} while (x && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL));