Skip to content

Commit 65cc02a

Browse files
Colin Ian Kingsimonwunderlich
authored andcommitted
batman-adv: don't pass a NULL hard_iface to batadv_hardif_put
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>
1 parent 60cc43f commit 65cc02a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/batman-adv/multicast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ batadv_mcast_netlink_get_primary(struct netlink_callback *cb,
15361536

15371537
if (!ret && primary_if)
15381538
*primary_if = hard_iface;
1539-
else
1539+
else if (hard_iface)
15401540
batadv_hardif_put(hard_iface);
15411541

15421542
return ret;

0 commit comments

Comments
 (0)