Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
---------------------------------------------------------------
commit 41111f3638d0302d96c437f22f07b42ed4fa0af5
Author: Colin Ian King <colin.king(a)canonical.com>
Date: Fri Mar 23 22:53:50 2018 +0000
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: 53c58c1e7487 ("batman-adv: add multicast flags netlink support")
Signed-off-by: Colin Ian King <colin.king(a)canonical.com>
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
---------------------------------------------------------------
41111f3638d0302d96c437f22f07b42ed4fa0af5
net/batman-adv/multicast.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index a11d3d8..a35f597 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -1536,7 +1536,7 @@ out:
if (!ret && primary_if)
*primary_if = hard_iface;
- else
+ else if (hard_iface)
batadv_hardif_put(hard_iface);
return ret;