Commit 011f1754 authored by Colin Ian King's avatar Colin Ian King Committed by David S. Miller

rocker: fix memory leaks of fib_work on two error return paths

Currently there are two error return paths that leak memory allocated
to fib_work. Fix this by kfree'ing fib_work before returning.

Addresses-Coverity: ("Resource leak")
Fixes: 19a9d136 ("ipv4: Flag fib_info with a fib_nh using IPv6 gateway")
Fixes: dbcc4fa7 ("rocker: Fail attempts to use routes with nexthop objects")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 195b2919
...@@ -2208,10 +2208,12 @@ static int rocker_router_fib_event(struct notifier_block *nb, ...@@ -2208,10 +2208,12 @@ static int rocker_router_fib_event(struct notifier_block *nb,
if (fen_info->fi->fib_nh_is_v6) { if (fen_info->fi->fib_nh_is_v6) {
NL_SET_ERR_MSG_MOD(info->extack, "IPv6 gateway with IPv4 route is not supported"); NL_SET_ERR_MSG_MOD(info->extack, "IPv6 gateway with IPv4 route is not supported");
kfree(fib_work);
return notifier_from_errno(-EINVAL); return notifier_from_errno(-EINVAL);
} }
if (fen_info->fi->nh) { if (fen_info->fi->nh) {
NL_SET_ERR_MSG_MOD(info->extack, "IPv4 route with nexthop objects is not supported"); NL_SET_ERR_MSG_MOD(info->extack, "IPv4 route with nexthop objects is not supported");
kfree(fib_work);
return notifier_from_errno(-EINVAL); return notifier_from_errno(-EINVAL);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment