From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net] ppp: unlock all_ppp_mutex before registering device Date: Mon, 15 Jan 2018 13:23:22 -0500 (EST) Message-ID: <20180115.132322.1583180792864166085.davem@davemloft.net> References: <944f4f82dcf446ad7d587cffcc983a2c31d3087d.1515597494.git.g.nault@alphalink.fr> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, paulus@samba.org, syzkaller-bugs@googlegroups.com To: g.nault@alphalink.fr Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:50006 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750782AbeAOSXX (ORCPT ); Mon, 15 Jan 2018 13:23:23 -0500 In-Reply-To: <944f4f82dcf446ad7d587cffcc983a2c31d3087d.1515597494.git.g.nault@alphalink.fr> Sender: netdev-owner@vger.kernel.org List-ID: From: Guillaume Nault Date: Wed, 10 Jan 2018 16:24:45 +0100 > ppp_dev_uninit(), which is the .ndo_uninit() handler of PPP devices, > needs to lock pn->all_ppp_mutex. Therefore we mustn't call > register_netdevice() with pn->all_ppp_mutex already locked, or we'd > deadlock in case register_netdevice() fails and calls .ndo_uninit(). > > Fortunately, we can unlock pn->all_ppp_mutex before calling > register_netdevice(). This lock protects pn->units_idr, which isn't > used in the device registration process. > > However, keeping pn->all_ppp_mutex locked during device registration > did ensure that no device in transient state would be published in > pn->units_idr. In practice, unlocking it before calling > register_netdevice() doesn't change this property: ppp_unit_register() > is called with 'ppp_mutex' locked and all searches done in > pn->units_idr hold this lock too. > > Fixes: 8cb775bc0a34 ("ppp: fix device unregistration upon netns deletion") > Reported-and-tested-by: syzbot+367889b9c9e279219175@syzkaller.appspotmail.com > Signed-off-by: Guillaume Nault Applied and queued up for -stable, thank you.