Skip to content

Commit

Permalink
net: sched: act_tunnel_key: fix NULL pointer dereference during init
Browse files Browse the repository at this point in the history
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: ee28bb5 ("net/sched: fix memory leak in act_tunnel_key_init()")
Signed-off-by: Vlad Buslov <[email protected]>
Reviewed-by: Davide Caratti <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
w1ldptr authored and davem330 committed Feb 25, 2019
1 parent 9919a36 commit a3df633
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/sched/act_tunnel_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a3df633

Please sign in to comment.