* [PATCH][next] batman-adv: don't pass a NULL hard_iface to batadv_hardif_put
@ 2018-03-23 22:53 Colin King
2018-03-24 9:36 ` [B.A.T.M.A.N.] " Sven Eckelmann
2018-03-26 12:57 ` Simon Wunderlich
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2018-03-23 22:53 UTC (permalink / raw)
To: Marek Lindner, Simon Wunderlich, Antonio Quartulli,
David S . Miller, b.a.t.m.a.n, netdev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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: 53dd9a68ba68 ("batman-adv: add multicast flags netlink support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
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 de3a055f7dd8..bd0ea374d043 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -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;
--
2.15.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH][next] batman-adv: don't pass a NULL hard_iface to batadv_hardif_put
2018-03-23 22:53 [PATCH][next] batman-adv: don't pass a NULL hard_iface to batadv_hardif_put Colin King
@ 2018-03-24 9:36 ` Sven Eckelmann
2018-03-26 12:57 ` Simon Wunderlich
1 sibling, 0 replies; 3+ messages in thread
From: Sven Eckelmann @ 2018-03-24 9:36 UTC (permalink / raw)
To: b.a.t.m.a.n
Cc: Colin King, Marek Lindner, Simon Wunderlich, Antonio Quartulli,
David S . Miller, netdev, kernel-janitors, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 901 bytes --]
On Freitag, 23. März 2018 23:53:50 CET Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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: 53dd9a68ba68 ("batman-adv: add multicast flags netlink support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> net/batman-adv/multicast.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Queued up for David in batadv/net-next as d5863c47d725 [1]
Now I only have to find out why I didn't receive the mail about this
from coverity.
Thanks,
Sven
[1] https://git.open-mesh.org/linux-merge.git/commit/d5863c47d7255448ec01713cbdb4f94b370d86ad
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] batman-adv: don't pass a NULL hard_iface to batadv_hardif_put
2018-03-23 22:53 [PATCH][next] batman-adv: don't pass a NULL hard_iface to batadv_hardif_put Colin King
2018-03-24 9:36 ` [B.A.T.M.A.N.] " Sven Eckelmann
@ 2018-03-26 12:57 ` Simon Wunderlich
1 sibling, 0 replies; 3+ messages in thread
From: Simon Wunderlich @ 2018-03-26 12:57 UTC (permalink / raw)
To: Colin King, David S . Miller
Cc: Marek Lindner, Antonio Quartulli, b.a.t.m.a.n, netdev,
kernel-janitors, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1381 bytes --]
Hi,
this looks good. David, would you pick this patch directly? Otherwise, I can
send a pull request, but right now we would only have this single patch for
net-next.
Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Acked-by: Sven Eckelmann <sven@narfation.org>
(just discussed with Sven offline)
Thank you,
Simon
On Friday, March 23, 2018 10:53:50 PM CEST Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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: 53dd9a68ba68 ("batman-adv: add multicast flags netlink support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> 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 de3a055f7dd8..bd0ea374d043 100644
> --- a/net/batman-adv/multicast.c
> +++ b/net/batman-adv/multicast.c
> @@ -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;
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-26 13:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-23 22:53 [PATCH][next] batman-adv: don't pass a NULL hard_iface to batadv_hardif_put Colin King
2018-03-24 9:36 ` [B.A.T.M.A.N.] " Sven Eckelmann
2018-03-26 12:57 ` Simon Wunderlich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).