* [PATCH net] caif: Fix access to freed pernet memory
@ 2012-07-15 20:10 sjur.brandeland
2012-07-16 1:43 ` Eric W. Biederman
2012-07-17 6:06 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: sjur.brandeland @ 2012-07-15 20:10 UTC (permalink / raw)
To: davem
Cc: netdev, Eric W. Biederman, sjurbren, Dmitry Tarnyagin,
Sjur Brændeland
From: Sjur Brændeland <sjur.brandeland@stericsson.com>
unregister_netdevice_notifier() must be called before
unregister_pernet_subsys() to avoid accessing already freed
pernet memory. This fixes the following oops when doing rmmod:
Call Trace:
[<ffffffffa0f802bd>] caif_device_notify+0x4d/0x5a0 [caif]
[<ffffffff81552ba9>] unregister_netdevice_notifier+0xb9/0x100
[<ffffffffa0f86dcc>] caif_device_exit+0x1c/0x250 [caif]
[<ffffffff810e7734>] sys_delete_module+0x1a4/0x300
[<ffffffff810da82d>] ? trace_hardirqs_on_caller+0x15d/0x1e0
[<ffffffff813517de>] ? trace_hardirqs_on_thunk+0x3a/0x3
[<ffffffff81696bad>] system_call_fastpath+0x1a/0x1f
RIP
[<ffffffffa0f7f561>] caif_get+0x51/0xb0 [caif]
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
Hi Dave,
Can you please queue up this bugfix as appropriate for -net and -stable?
I guess this bug has been around since introduction of network
name spaces in CAIF, but it became visible after 3.4 and the commit:
"net: In unregister_netdevice_notifier unregister the netdevices."
Thanks,
Sjur
net/caif/caif_dev.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
index 554b312..8c83c17 100644
--- a/net/caif/caif_dev.c
+++ b/net/caif/caif_dev.c
@@ -561,9 +561,9 @@ static int __init caif_device_init(void)
static void __exit caif_device_exit(void)
{
- unregister_pernet_subsys(&caif_net_ops);
unregister_netdevice_notifier(&caif_device_notifier);
dev_remove_pack(&caif_packet_type);
+ unregister_pernet_subsys(&caif_net_ops);
}
module_init(caif_device_init);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] caif: Fix access to freed pernet memory
2012-07-15 20:10 [PATCH net] caif: Fix access to freed pernet memory sjur.brandeland
@ 2012-07-16 1:43 ` Eric W. Biederman
2012-07-17 6:06 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Eric W. Biederman @ 2012-07-16 1:43 UTC (permalink / raw)
To: sjur.brandeland; +Cc: davem, netdev, sjurbren, Dmitry Tarnyagin
sjur.brandeland@stericsson.com writes:
> From: Sjur Brændeland <sjur.brandeland@stericsson.com>
>
> unregister_netdevice_notifier() must be called before
> unregister_pernet_subsys() to avoid accessing already freed
> pernet memory. This fixes the following oops when doing rmmod:
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
The patch looks good to me.
You might want to look at error handling during caif_device_init
as well, as it looks like the same ordering issue is present.
Although unlikely to bite anyone at that point.
Eric
>
> Call Trace:
> [<ffffffffa0f802bd>] caif_device_notify+0x4d/0x5a0 [caif]
> [<ffffffff81552ba9>] unregister_netdevice_notifier+0xb9/0x100
> [<ffffffffa0f86dcc>] caif_device_exit+0x1c/0x250 [caif]
> [<ffffffff810e7734>] sys_delete_module+0x1a4/0x300
> [<ffffffff810da82d>] ? trace_hardirqs_on_caller+0x15d/0x1e0
> [<ffffffff813517de>] ? trace_hardirqs_on_thunk+0x3a/0x3
> [<ffffffff81696bad>] system_call_fastpath+0x1a/0x1f
>
> RIP
> [<ffffffffa0f7f561>] caif_get+0x51/0xb0 [caif]
>
> Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
> ---
>
> Hi Dave,
>
> Can you please queue up this bugfix as appropriate for -net and -stable?
>
> I guess this bug has been around since introduction of network
> name spaces in CAIF, but it became visible after 3.4 and the commit:
> "net: In unregister_netdevice_notifier unregister the netdevices."
>
> Thanks,
> Sjur
>
> net/caif/caif_dev.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
> index 554b312..8c83c17 100644
> --- a/net/caif/caif_dev.c
> +++ b/net/caif/caif_dev.c
> @@ -561,9 +561,9 @@ static int __init caif_device_init(void)
>
> static void __exit caif_device_exit(void)
> {
> - unregister_pernet_subsys(&caif_net_ops);
> unregister_netdevice_notifier(&caif_device_notifier);
> dev_remove_pack(&caif_packet_type);
> + unregister_pernet_subsys(&caif_net_ops);
> }
>
> module_init(caif_device_init);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] caif: Fix access to freed pernet memory
2012-07-15 20:10 [PATCH net] caif: Fix access to freed pernet memory sjur.brandeland
2012-07-16 1:43 ` Eric W. Biederman
@ 2012-07-17 6:06 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2012-07-17 6:06 UTC (permalink / raw)
To: sjur.brandeland; +Cc: netdev, ebiederm, sjurbren, dmitry.tarnyagin
From: sjur.brandeland@stericsson.com
Date: Sun, 15 Jul 2012 22:10:14 +0200
> Can you please queue up this bugfix as appropriate for -net and -stable?
Done.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-17 6:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-15 20:10 [PATCH net] caif: Fix access to freed pernet memory sjur.brandeland
2012-07-16 1:43 ` Eric W. Biederman
2012-07-17 6:06 ` David Miller
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).