* [B.A.T.M.A.N.] [PATCH maint] batman-adv: don't access unregistered net_device object
@ 2015-08-04 20:26 Antonio Quartulli
2015-08-07 16:48 ` Marek Lindner
0 siblings, 1 reply; 2+ messages in thread
From: Antonio Quartulli @ 2015-08-04 20:26 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Antonio Quartulli
In batadv_hardif_disable_interface() there is a call to
batadv_softif_destroy_sysfs() which in turns invokes
unregister_netdevice() on the soft_iface.
After this point we cannot rely on the soft_iface object
anymore because it might get free'd by the netdev periodic
routine at any time.
For this reason the netdev_upper_dev_unlink(.., soft_iface) call
is moved before the invocation of batadv_softif_destroy_sysfs() so
that we can be sure that the soft_iface object is still valid.
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---
net/batman-adv/hard-interface.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index f4a15d2..0565b20 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -528,6 +528,8 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
batadv_purge_outstanding_packets(bat_priv, hard_iface);
dev_put(hard_iface->soft_iface);
+ netdev_upper_dev_unlink(hard_iface->net_dev, hard_iface->soft_iface);
+
/* nobody uses this interface anymore */
if (!bat_priv->num_ifaces) {
batadv_gw_check_client_stop(bat_priv);
@@ -536,7 +538,6 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface,
batadv_softif_destroy_sysfs(hard_iface->soft_iface);
}
- netdev_upper_dev_unlink(hard_iface->net_dev, hard_iface->soft_iface);
hard_iface->soft_iface = NULL;
batadv_hardif_free_ref(hard_iface);
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH maint] batman-adv: don't access unregistered net_device object
2015-08-04 20:26 [B.A.T.M.A.N.] [PATCH maint] batman-adv: don't access unregistered net_device object Antonio Quartulli
@ 2015-08-07 16:48 ` Marek Lindner
0 siblings, 0 replies; 2+ messages in thread
From: Marek Lindner @ 2015-08-07 16:48 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Antonio Quartulli
[-- Attachment #1: Type: text/plain, Size: 774 bytes --]
On Tuesday, August 04, 2015 22:26:19 Antonio Quartulli wrote:
> In batadv_hardif_disable_interface() there is a call to
> batadv_softif_destroy_sysfs() which in turns invokes
> unregister_netdevice() on the soft_iface.
> After this point we cannot rely on the soft_iface object
> anymore because it might get free'd by the netdev periodic
> routine at any time.
>
> For this reason the netdev_upper_dev_unlink(.., soft_iface) call
> is moved before the invocation of batadv_softif_destroy_sysfs() so
> that we can be sure that the soft_iface object is still valid.
>
> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
> ---
> net/batman-adv/hard-interface.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Applied in revision 958aafbb.
Thanks,
Marek
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-07 16:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-04 20:26 [B.A.T.M.A.N.] [PATCH maint] batman-adv: don't access unregistered net_device object Antonio Quartulli
2015-08-07 16:48 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox