batman-adv: Fix bat_ogm_iv best gw refcnt after netlink dump
Sven Eckelmann
maintainerPATCH 1/2 batman-adv: Fix bat_ogm_iv best gw refcnt after netlink dump
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).
---
Cc: Andreas Ziegler <[email protected]>
net/batman-adv/bat_iv_ogm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/batman-adv/bat_iv_ogm.c +3 -1
@@ -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)
Signature · 1 line
2.17.0
Sven Eckelmann
maintainerPATCH 2/2 batman-adv: Fix bat_v best gw refcnt after netlink dump
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).
---
Cc: Andreas Ziegler <[email protected]>
net/batman-adv/bat_v.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/batman-adv/bat_v.c +3 -1
@@ -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)
Signature · 1 line
2.17.0
Quoted 5 lines · HKT Sven Eckelmann
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.
Quoted 8 lines
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_dumpimplementations") Reported-by: Andreas Ziegler <[email protected]>
Signed-off-by Sven Eckelmann <[email protected]>
Cheers,
Marek
Re: [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v best gw refcnt after netlink dump
In reply to Sven EckelmannQuoted 5 lines · HKT Sven Eckelmann
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.
Quoted 7 lines
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_dumpimplementations") Signed-off-by: Sven Eckelmann <[email protected]>
Cheers,
Marek
Sven Eckelmann schrieb am 02.06.2018 um 17:26:
Quoted 42 lines
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 <[email protected]>Signed-off-by Sven Eckelmann <[email protected]>---
Cc: Andreas Ziegler <[email protected]>net/batman-adv/bat_iv_ogm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)net/batman-adv/bat_iv_ogm.c +3
-1@@ -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)
Re: [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v best gw refcnt after netlink dump
In reply to Sven EckelmannSven Eckelmann schrieb am 02.06.2018 um 17:26:
Quoted 41 lines
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 <[email protected]>---
Cc: Andreas Ziegler <[email protected]>net/batman-adv/bat_v.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)net/batman-adv/bat_v.c +3
-1@@ -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)
Sven Eckelmann
maintainerQuoted 10 lines · 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).
Quoted 5 lines
Fixes fa3228924152 ("batman-adv: add B.A.T.M.A.N. IV bat_gw_dump implementations")Reported-by Andreas Ziegler <[email protected]>Signed-off-by Sven Eckelmann <[email protected]>---
Cc: Andreas Ziegler <[email protected]>
Added as 46360d203c62 [1]
Kind regards,
Sven
[1] https://git.open-mesh.org/batman-adv.git/commit/46360d203c627e71a27d1f8f551c819c7f2353fd
Sven Eckelmann
maintainerRe: [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Fix bat_v best gw refcnt after netlink dump
In reply to Sven EckelmannQuoted 10 lines · 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).
Quoted 4 lines
Fixes 15315a94ad98 ("batman-adv: add B.A.T.M.A.N. V bat_gw_dump implementations")Signed-off-by Sven Eckelmann <[email protected]>---
Cc: Andreas Ziegler <[email protected]>
Added as 2b422b580818 [1].
Kind regards,
Sven
[1] https://git.open-mesh.org/batman-adv.git/commit/2b422b5808183d1084b450b89d9a085a13dd6d2c