aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-11-04 13:49:49 +0100
committerDavid S. Miller <davem@davemloft.net>2015-11-04 21:59:22 -0500
commitf63ce5b6fa5e9a0faf7a0e1ef2993a502878c78a (patch)
tree6a6a060254017f2bcdbab98ee66dd94fcfe6eae9 /include/net
parentnet/core: ensure features get disabled on new lower devs (diff)
downloadlinux-dev-f63ce5b6fa5e9a0faf7a0e1ef2993a502878c78a.tar.xz
linux-dev-f63ce5b6fa5e9a0faf7a0e1ef2993a502878c78a.zip
tun_dst: Fix potential NULL dereference
In tun_dst_unclone() the return value of skb_metadata_dst() is checked for being NULL after it is dereferenced. Fix this by moving the dereference after the NULL check. Found by the Coverity scanner (CID 1338068). Fixes: fc4099f17240 ("openvswitch: Fix egress tunnel info.") Cc: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/dst_metadata.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/net/dst_metadata.h b/include/net/dst_metadata.h
index ce009710120c..6816f0fa5693 100644
--- a/include/net/dst_metadata.h
+++ b/include/net/dst_metadata.h
@@ -63,12 +63,13 @@ static inline struct metadata_dst *tun_rx_dst(int md_size)
static inline struct metadata_dst *tun_dst_unclone(struct sk_buff *skb)
{
struct metadata_dst *md_dst = skb_metadata_dst(skb);
- int md_size = md_dst->u.tun_info.options_len;
+ int md_size;
struct metadata_dst *new_md;
if (!md_dst)
return ERR_PTR(-EINVAL);
+ md_size = md_dst->u.tun_info.options_len;
new_md = metadata_dst_alloc(md_size, GFP_ATOMIC);
if (!new_md)
return ERR_PTR(-ENOMEM);