From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935254AbcA1IfM (ORCPT ); Thu, 28 Jan 2016 03:35:12 -0500 Received: from mga02.intel.com ([134.134.136.20]:32582 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932344AbcA1IfK (ORCPT ); Thu, 28 Jan 2016 03:35:10 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,357,1449561600"; d="scan'208";a="899937656" From: Gregory Herrero To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org, kaber@trash.net, linux-kernel@vger.kernel.org, Gregory Herrero Subject: [PATCH] ipv6: release idev lock before calling ipv6_ifa_notify() Date: Thu, 28 Jan 2016 09:34:52 +0100 Message-Id: <1453970092-10605-1-git-send-email-gregory.herrero@intel.com> X-Mailer: git-send-email 2.6.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ipv6_ifa_notify() may need to acquire idev->lock, for example when calling __ipv6_dev_ac_inc() from addrconf_join_anycast() in __ipv6_ifa_notify(). So caller must release idev->lock before calling ipv6_ifa_notify() to avoid a deadlock. Fix a checkpatch warning present in the same area to make checkpatch happy. Signed-off-by: Gregory Herrero --- net/ipv6/addrconf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 38eedde..af7fc84 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -2302,8 +2302,11 @@ static void manage_tempaddrs(struct inet6_dev *idev, ift->flags &= ~IFA_F_DEPRECATED; spin_unlock(&ift->lock); - if (!(flags&IFA_F_TENTATIVE)) + if (!(flags & IFA_F_TENTATIVE)) { + read_unlock_bh(&idev->lock); ipv6_ifa_notify(0, ift); + read_lock_bh(&idev->lock); + } } if ((create || list_empty(&idev->tempaddr_list)) && @@ -3583,7 +3586,9 @@ static void addrconf_dad_begin(struct inet6_ifaddr *ifp) /* Because optimistic nodes can use this address, * notify listeners. If DAD fails, RTM_DELADDR is sent. */ + read_unlock_bh(&idev->lock); ipv6_ifa_notify(RTM_NEWADDR, ifp); + read_lock_bh(&idev->lock); } } -- 2.6.2