All of lore.kernel.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Fix bat_ogm_iv best gw refcnt after netlink dump
@ 2018-06-02 15:26 Sven Eckelmann
  2018-06-02 15:26 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v " Sven Eckelmann
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Sven Eckelmann @ 2018-06-02 15:26 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Andreas Ziegler

A reference to the best gateway is taken when the list of gateways in the
mesh is sent via netlink. This is necessary to check whether the currently
dumped entry is the currently selected gateway or not. This information is
then transferred as flag BATADV_ATTR_FLAG_BEST.

After the comparison of the current entry is done,
batadv_iv_gw_dump_entry() has to decrease the reference counter again.
Otherwise the reference will be held and thus prevents a proper shutdown of
the batman-adv interfaces (and some of the interfaces enslaved in it).

Fixes: fa3228924152 ("batman-adv: add B.A.T.M.A.N. IV bat_gw_dump implementations")
Reported-by: Andreas Ziegler <github@andreas-ziegler.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
Cc: Andreas Ziegler <github@andreas-ziegler.de>

 net/batman-adv/bat_iv_ogm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index be09a988..73bf6a93 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -2732,7 +2732,7 @@ static int batadv_iv_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
 {
 	struct batadv_neigh_ifinfo *router_ifinfo = NULL;
 	struct batadv_neigh_node *router;
-	struct batadv_gw_node *curr_gw;
+	struct batadv_gw_node *curr_gw = NULL;
 	int ret = 0;
 	void *hdr;
 
@@ -2780,6 +2780,8 @@ static int batadv_iv_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
 	ret = 0;
 
 out:
+	if (curr_gw)
+		batadv_gw_node_put(curr_gw);
 	if (router_ifinfo)
 		batadv_neigh_ifinfo_put(router_ifinfo);
 	if (router)
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v best gw refcnt after netlink dump
  2018-06-02 15:26 [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Fix bat_ogm_iv best gw refcnt after netlink dump Sven Eckelmann
@ 2018-06-02 15:26 ` Sven Eckelmann
  2018-06-03 10:54   ` Marek Lindner
                     ` (2 more replies)
  2018-06-03 10:53 ` [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Fix bat_ogm_iv " Marek Lindner
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 8+ messages in thread
From: Sven Eckelmann @ 2018-06-02 15:26 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Sven Eckelmann, Andreas Ziegler

A reference to the best gateway is taken when the list of gateways in the
mesh is sent via netlink. This is necessary to check whether the currently
dumped entry is the currently selected gateway or not. This information is
then transferred as flag BATADV_ATTR_FLAG_BEST.

After the comparison of the current entry is done,
batadv_v_gw_dump_entry() has to decrease the reference counter again.
Otherwise the reference will be held and thus prevents a proper shutdown of
the batman-adv interfaces (and some of the interfaces enslaved in it).

Fixes: 15315a94ad98 ("batman-adv: add B.A.T.M.A.N. V bat_gw_dump implementations")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
Cc: Andreas Ziegler <github@andreas-ziegler.de>

 net/batman-adv/bat_v.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
index ec93337e..6baec4e6 100644
--- a/net/batman-adv/bat_v.c
+++ b/net/batman-adv/bat_v.c
@@ -927,7 +927,7 @@ static int batadv_v_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
 {
 	struct batadv_neigh_ifinfo *router_ifinfo = NULL;
 	struct batadv_neigh_node *router;
-	struct batadv_gw_node *curr_gw;
+	struct batadv_gw_node *curr_gw = NULL;
 	int ret = 0;
 	void *hdr;
 
@@ -995,6 +995,8 @@ static int batadv_v_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
 	ret = 0;
 
 out:
+	if (curr_gw)
+		batadv_gw_node_put(curr_gw);
 	if (router_ifinfo)
 		batadv_neigh_ifinfo_put(router_ifinfo);
 	if (router)
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Fix bat_ogm_iv best gw refcnt after netlink dump
  2018-06-02 15:26 [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Fix bat_ogm_iv best gw refcnt after netlink dump Sven Eckelmann
  2018-06-02 15:26 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v " Sven Eckelmann
@ 2018-06-03 10:53 ` Marek Lindner
  2018-06-03 13:02 ` Andreas Ziegler
  2018-06-03 13:14 ` Sven Eckelmann
  3 siblings, 0 replies; 8+ messages in thread
From: Marek Lindner @ 2018-06-03 10:53 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 895 bytes --]

On Saturday, June 2, 2018 11:26:34 PM HKT Sven Eckelmann wrote:
> A reference to the best gateway is taken when the list of gateways in the
> mesh is sent via netlink. This is necessary to check whether the currently
> dumped entry is the currently selected gateway or not. This information is
> then transferred as flag BATADV_ATTR_FLAG_BEST.
> 
> After the comparison of the current entry is done,
> batadv_iv_gw_dump_entry() has to decrease the reference counter again.
> Otherwise the reference will be held and thus prevents a proper shutdown of
> the batman-adv interfaces (and some of the interfaces enslaved in it).
> 
> Fixes: fa3228924152 ("batman-adv: add B.A.T.M.A.N. IV bat_gw_dump
> implementations") Reported-by: Andreas Ziegler <github@andreas-ziegler.de>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>

Acked-by: Marek Lindner <mareklindner@neomailbox.ch>

Cheers,
Marek


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v best gw refcnt after netlink dump
  2018-06-02 15:26 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v " Sven Eckelmann
@ 2018-06-03 10:54   ` Marek Lindner
  2018-06-03 13:02   ` dev
  2018-06-03 13:15   ` Sven Eckelmann
  2 siblings, 0 replies; 8+ messages in thread
From: Marek Lindner @ 2018-06-03 10:54 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 834 bytes --]

On Saturday, June 2, 2018 11:26:35 PM HKT Sven Eckelmann wrote:
> A reference to the best gateway is taken when the list of gateways in the
> mesh is sent via netlink. This is necessary to check whether the currently
> dumped entry is the currently selected gateway or not. This information is
> then transferred as flag BATADV_ATTR_FLAG_BEST.
> 
> After the comparison of the current entry is done,
> batadv_v_gw_dump_entry() has to decrease the reference counter again.
> Otherwise the reference will be held and thus prevents a proper shutdown of
> the batman-adv interfaces (and some of the interfaces enslaved in it).
> 
> Fixes: 15315a94ad98 ("batman-adv: add B.A.T.M.A.N. V bat_gw_dump
> implementations") Signed-off-by: Sven Eckelmann <sven@narfation.org>

Acked-by: Marek Lindner <mareklindner@neomailbox.ch>

Cheers,
Marek


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Fix bat_ogm_iv best gw refcnt after netlink dump
  2018-06-02 15:26 [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Fix bat_ogm_iv best gw refcnt after netlink dump Sven Eckelmann
  2018-06-02 15:26 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v " Sven Eckelmann
  2018-06-03 10:53 ` [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Fix bat_ogm_iv " Marek Lindner
@ 2018-06-03 13:02 ` Andreas Ziegler
  2018-06-03 13:14 ` Sven Eckelmann
  3 siblings, 0 replies; 8+ messages in thread
From: Andreas Ziegler @ 2018-06-03 13:02 UTC (permalink / raw)
  To: Sven Eckelmann; +Cc: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 1816 bytes --]

Tested-by: Andreas Ziegler <dev@andreas-ziegler.de>

Sven Eckelmann schrieb am 02.06.2018 um 17:26:
> A reference to the best gateway is taken when the list of gateways in the
> mesh is sent via netlink. This is necessary to check whether the currently
> dumped entry is the currently selected gateway or not. This information is
> then transferred as flag BATADV_ATTR_FLAG_BEST.
> 
> After the comparison of the current entry is done,
> batadv_iv_gw_dump_entry() has to decrease the reference counter again.
> Otherwise the reference will be held and thus prevents a proper shutdown of
> the batman-adv interfaces (and some of the interfaces enslaved in it).
> 
> Fixes: fa3228924152 ("batman-adv: add B.A.T.M.A.N. IV bat_gw_dump implementations")
> Reported-by: Andreas Ziegler <github@andreas-ziegler.de>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> Cc: Andreas Ziegler <github@andreas-ziegler.de>
> 
>  net/batman-adv/bat_iv_ogm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
> index be09a988..73bf6a93 100644
> --- a/net/batman-adv/bat_iv_ogm.c
> +++ b/net/batman-adv/bat_iv_ogm.c
> @@ -2732,7 +2732,7 @@ static int batadv_iv_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
>  {
>  	struct batadv_neigh_ifinfo *router_ifinfo = NULL;
>  	struct batadv_neigh_node *router;
> -	struct batadv_gw_node *curr_gw;
> +	struct batadv_gw_node *curr_gw = NULL;
>  	int ret = 0;
>  	void *hdr;
>  
> @@ -2780,6 +2780,8 @@ static int batadv_iv_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
>  	ret = 0;
>  
>  out:
> +	if (curr_gw)
> +		batadv_gw_node_put(curr_gw);
>  	if (router_ifinfo)
>  		batadv_neigh_ifinfo_put(router_ifinfo);
>  	if (router)
> 


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4002 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v best gw refcnt after netlink dump
  2018-06-02 15:26 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v " Sven Eckelmann
  2018-06-03 10:54   ` Marek Lindner
@ 2018-06-03 13:02   ` dev
  2018-06-03 13:15   ` Sven Eckelmann
  2 siblings, 0 replies; 8+ messages in thread
From: dev @ 2018-06-03 13:02 UTC (permalink / raw)
  To: Sven Eckelmann; +Cc: b.a.t.m.a.n

Tested-by: Andreas Ziegler <dev@andreas-ziegler.de>


Sven Eckelmann schrieb am 02.06.2018 um 17:26:
> A reference to the best gateway is taken when the list of gateways in the
> mesh is sent via netlink. This is necessary to check whether the currently
> dumped entry is the currently selected gateway or not. This information is
> then transferred as flag BATADV_ATTR_FLAG_BEST.
> 
> After the comparison of the current entry is done,
> batadv_v_gw_dump_entry() has to decrease the reference counter again.
> Otherwise the reference will be held and thus prevents a proper shutdown of
> the batman-adv interfaces (and some of the interfaces enslaved in it).
> 
> Fixes: 15315a94ad98 ("batman-adv: add B.A.T.M.A.N. V bat_gw_dump implementations")
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> Cc: Andreas Ziegler <github@andreas-ziegler.de>
> 
>  net/batman-adv/bat_v.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c
> index ec93337e..6baec4e6 100644
> --- a/net/batman-adv/bat_v.c
> +++ b/net/batman-adv/bat_v.c
> @@ -927,7 +927,7 @@ static int batadv_v_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
>  {
>  	struct batadv_neigh_ifinfo *router_ifinfo = NULL;
>  	struct batadv_neigh_node *router;
> -	struct batadv_gw_node *curr_gw;
> +	struct batadv_gw_node *curr_gw = NULL;
>  	int ret = 0;
>  	void *hdr;
>  
> @@ -995,6 +995,8 @@ static int batadv_v_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq,
>  	ret = 0;
>  
>  out:
> +	if (curr_gw)
> +		batadv_gw_node_put(curr_gw);
>  	if (router_ifinfo)
>  		batadv_neigh_ifinfo_put(router_ifinfo);
>  	if (router)
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Fix bat_ogm_iv best gw refcnt after netlink dump
  2018-06-02 15:26 [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Fix bat_ogm_iv best gw refcnt after netlink dump Sven Eckelmann
                   ` (2 preceding siblings ...)
  2018-06-03 13:02 ` Andreas Ziegler
@ 2018-06-03 13:14 ` Sven Eckelmann
  3 siblings, 0 replies; 8+ messages in thread
From: Sven Eckelmann @ 2018-06-03 13:14 UTC (permalink / raw)
  To: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]

On Samstag, 2. Juni 2018 17:26:34 CEST Sven Eckelmann wrote:
> A reference to the best gateway is taken when the list of gateways in the
> mesh is sent via netlink. This is necessary to check whether the currently
> dumped entry is the currently selected gateway or not. This information is
> then transferred as flag BATADV_ATTR_FLAG_BEST.
> 
> After the comparison of the current entry is done,
> batadv_iv_gw_dump_entry() has to decrease the reference counter again.
> Otherwise the reference will be held and thus prevents a proper shutdown of
> the batman-adv interfaces (and some of the interfaces enslaved in it).
> 
> Fixes: fa3228924152 ("batman-adv: add B.A.T.M.A.N. IV bat_gw_dump implementations")
> Reported-by: Andreas Ziegler <github@andreas-ziegler.de>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> Cc: Andreas Ziegler <github@andreas-ziegler.de>

Added as 46360d203c62 [1]

Kind regards,
	Sven

[1] https://git.open-mesh.org/batman-adv.git/commit/46360d203c627e71a27d1f8f551c819c7f2353fd


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v best gw refcnt after netlink dump
  2018-06-02 15:26 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v " Sven Eckelmann
  2018-06-03 10:54   ` Marek Lindner
  2018-06-03 13:02   ` dev
@ 2018-06-03 13:15   ` Sven Eckelmann
  2 siblings, 0 replies; 8+ messages in thread
From: Sven Eckelmann @ 2018-06-03 13:15 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Andreas Ziegler

[-- Attachment #1: Type: text/plain, Size: 960 bytes --]

On Samstag, 2. Juni 2018 17:26:35 CEST Sven Eckelmann wrote:
> A reference to the best gateway is taken when the list of gateways in the
> mesh is sent via netlink. This is necessary to check whether the currently
> dumped entry is the currently selected gateway or not. This information is
> then transferred as flag BATADV_ATTR_FLAG_BEST.
> 
> After the comparison of the current entry is done,
> batadv_v_gw_dump_entry() has to decrease the reference counter again.
> Otherwise the reference will be held and thus prevents a proper shutdown of
> the batman-adv interfaces (and some of the interfaces enslaved in it).
> 
> Fixes: 15315a94ad98 ("batman-adv: add B.A.T.M.A.N. V bat_gw_dump implementations")
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> Cc: Andreas Ziegler <github@andreas-ziegler.de>

Added as 2b422b580818 [1].

Kind regards,
	Sven

[1] https://git.open-mesh.org/batman-adv.git/commit/2b422b5808183d1084b450b89d9a085a13dd6d2c

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-06-03 13:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-02 15:26 [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Fix bat_ogm_iv best gw refcnt after netlink dump Sven Eckelmann
2018-06-02 15:26 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v " Sven Eckelmann
2018-06-03 10:54   ` Marek Lindner
2018-06-03 13:02   ` dev
2018-06-03 13:15   ` Sven Eckelmann
2018-06-03 10:53 ` [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Fix bat_ogm_iv " Marek Lindner
2018-06-03 13:02 ` Andreas Ziegler
2018-06-03 13:14 ` Sven Eckelmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.