diff options
author | Florian Westphal <fw@strlen.de> | 2019-06-26 20:40:45 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-07-28 08:27:13 +0200 |
commit | f45b2574be524484496e69e8b8a29fbe8a85fcfc (patch) | |
tree | bb51f386e8f223ac14514f63c847201151a44183 /net/mpls | |
parent | 599ff8d7b3f3fb133c34489a9502fbadba9ceebe (diff) | |
download | linux-stable-f45b2574be524484496e69e8b8a29fbe8a85fcfc.tar.gz linux-stable-f45b2574be524484496e69e8b8a29fbe8a85fcfc.tar.bz2 linux-stable-f45b2574be524484496e69e8b8a29fbe8a85fcfc.zip |
net: make skb_dst_force return true when dst is refcounted
[ Upstream commit b60a77386b1d4868f72f6353d35dabe5fbe981f2 ]
netfilter did not expect that skb_dst_force() can cause skb to lose its
dst entry.
I got a bug report with a skb->dst NULL dereference in netfilter
output path. The backtrace contains nf_reinject(), so the dst might have
been cleared when skb got queued to userspace.
Other users were fixed via
if (skb_dst(skb)) {
skb_dst_force(skb);
if (!skb_dst(skb))
goto handle_err;
}
But I think its preferable to make the 'dst might be cleared' part
of the function explicit.
In netfilter case, skb with a null dst is expected when queueing in
prerouting hook, so drop skb for the other hooks.
v2:
v1 of this patch returned true in case skb had no dst entry.
Eric said:
Say if we have two skb_dst_force() calls for some reason
on the same skb, only the first one will return false.
This now returns false even when skb had no dst, as per Erics
suggestion, so callers might need to check skb_dst() first before
skb_dst_force().
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/mpls')
0 files changed, 0 insertions, 0 deletions