diff mbox

[3/3] ipmr_free_table() should be called under taken rtnl_lock

Message ID 559BF613.7090904@virtuozzo.com
State Changes Requested
Headers show

Commit Message

Vasily Averin July 7, 2015, 3:53 p.m. UTC
ipmr_free_table() calls unregister_netdevice_many() inside
and changes net_todo_list protected by rtnl_lock

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 net/ipv6/ip6mr.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Vasily Averin July 7, 2015, 5:25 p.m. UTC | #1
On 07.07.2015 20:13, Cong Wang wrote:
> On Tue, Jul 7, 2015 at 8:53 AM, Vasily Averin <vvs@virtuozzo.com> wrote:
>> ipmr_free_table() calls unregister_netdevice_many() inside
>> and changes net_todo_list protected by rtnl_lock
> 
> Did you see any real bug?

No, it was result of manual code review.

> ipmr_free_table() is called in failure path, in this case there is no
> device registered yet, so unregister should be just a nop?

However may be it's better to mark this place for future anyway?
Vasily Averin July 7, 2015, 5:53 p.m. UTC | #2
On 07.07.2015 20:30, Cong Wang wrote:
> On Tue, Jul 7, 2015 at 10:25 AM, Vasily Averin <vvs@virtuozzo.com> wrote:
>> On 07.07.2015 20:13, Cong Wang wrote:
>>> On Tue, Jul 7, 2015 at 8:53 AM, Vasily Averin <vvs@virtuozzo.com> wrote:
>>>> ipmr_free_table() calls unregister_netdevice_many() inside
>>>> and changes net_todo_list protected by rtnl_lock
>>>
>>> Did you see any real bug?
>>
>> No, it was result of manual code review.
>>
>>> ipmr_free_table() is called in failure path, in this case there is no
>>> device registered yet, so unregister should be just a nop?
>>
>> However may be it's better to mark this place for future anyway?
> 
> Then add a comment there. ;)

As you can see I'm not familiar with this code,
so I would like to ask you to do it. :)
diff mbox

Patch

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 74ceb73..9108636 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -250,7 +250,9 @@  static int __net_init ip6mr_rules_init(struct net *net)
 	return 0;
 
 err2:
+	rtnl_lock();
 	ip6mr_free_table(mrt);
+	rtnl_unlock();
 err1:
 	fib_rules_unregister(ops);
 	return err;