summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorVlad Buslov <vladbu@mellanox.com>2019-02-25 17:28:27 +0200
committerDavid S. Miller <davem@davemloft.net>2019-02-25 10:13:38 -0800
commita3df633a3c92bb96b06552c3f828d7c267774379 (patch)
treee88bc2c551807bd0e12efef7635ca866148fd624 /net
parent9919a363a5cb57c2b64c4803b4d2dd45e90bf230 (diff)
net: sched: act_tunnel_key: fix NULL pointer dereference during init
Metadata pointer is only initialized for action TCA_TUNNEL_KEY_ACT_SET, but it is unconditionally dereferenced in tunnel_key_init() error handler. Verify that metadata pointer is not NULL before dereferencing it in tunnel_key_init error handling code. Fixes: ee28bb56ac5b ("net/sched: fix memory leak in act_tunnel_key_init()") Signed-off-by: Vlad Buslov <vladbu@mellanox.com> Reviewed-by: Davide Caratti <dcaratti@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/sched/act_tunnel_key.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index 8b43fe0130f7..3f943de9a2c9 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -377,7 +377,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
return ret;
release_tun_meta:
- dst_release(&metadata->dst);
+ if (metadata)
+ dst_release(&metadata->dst);
err_out:
if (exists)