Skip to content

Commit

Permalink
batman-adv: don't pass a NULL hard_iface to batadv_hardif_put
Browse files Browse the repository at this point in the history
In the case where hard_iface is NULL, the error path may pass a null
pointer to batadv_hardif_put causing a null pointer dereference error.
Avoid this by only calling the function if  hard_iface not null.

Detected by CoverityScan, CID#1466456 ("Explicit null dereferenced")

Fixes: 53dd9a6 ("batman-adv: add multicast flags netlink support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
  • Loading branch information
Colin Ian King authored and Simon Wunderlich committed Apr 22, 2018
1 parent 60cc43f commit 65cc02a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/batman-adv/multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,7 @@ batadv_mcast_netlink_get_primary(struct netlink_callback *cb,

if (!ret && primary_if)
*primary_if = hard_iface;
else
else if (hard_iface)
batadv_hardif_put(hard_iface);

return ret;
Expand Down

0 comments on commit 65cc02a

Please sign in to comment.