[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1305734559.2991.50.camel@edumazet-laptop>
Date: Wed, 18 May 2011 18:02:39 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next-2.6] net: make sure rtnl is held in
rtnl_fill_ifinfo()
Le mercredi 18 mai 2011 à 11:35 +0200, Eric Dumazet a écrit :
> Commit e67f88dd12f610 (net: dont hold rtnl mutex during netlink dump
> callbacks) added a problem in rtnl_fill_ifinfo() not being always called
> with RTNL held, which is racy.
>
> 1) This patch extends rtnl_mutex helper functions so that :
>
> rtnl_lock() is able to BUG_ON() if recursively called.
> [This was only provided if LOCKDEP was on]
>
> rtnl_is_locked() is able to check if current thread owns rtnl_mutex
> [ASSERT_RTNL() gets this added feature too]
>
> 2) Add one ASSERT_RTNL() in rtnl_fill_ifinfo()
>
> 3) Make sure rtnl is held in rtnl_dump_ifinfo()
>
> Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
> --
Hmm, please disregard, there is a lock depency problem here
netlink_dump() does a mutex_lock(nlk->cb_mutex)
So if we try to lock rtnl_mutex later in rtnl_dump_ifinfo(), we can
deadlock with another task doing the reverse.
(first lock rtnl_mutex, then nlk->cb_mutex)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists