Skip to content

Commit a3df633

Browse files
w1ldptrdavem330
authored andcommitted
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: 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]>
1 parent 9919a36 commit a3df633

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/sched/act_tunnel_key.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
377377
return ret;
378378

379379
release_tun_meta:
380-
dst_release(&metadata->dst);
380+
if (metadata)
381+
dst_release(&metadata->dst);
381382

382383
err_out:
383384
if (exists)

0 commit comments

Comments
 (0)