From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [Patch net] netrom: fix locking in nr_find_socket() Date: Sun, 30 Dec 2018 20:24:59 -0800 (PST) Message-ID: <20181230.202459.1666665500046620349.davem@davemloft.net> References: <20181229215638.10590-1-xiyou.wangcong@gmail.com> <20181229215638.10590-3-xiyou.wangcong@gmail.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: xiyou.wangcong@gmail.com Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:35882 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725953AbeLaEZA (ORCPT ); Sun, 30 Dec 2018 23:25:00 -0500 In-Reply-To: <20181229215638.10590-3-xiyou.wangcong@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Cong Wang Date: Sat, 29 Dec 2018 13:56:38 -0800 > nr_find_socket(), nr_find_peer() and nr_find_listener() lock the > sock after finding it in the global list. However, the call path > requires BH disabled for the sock lock consistently. > > Actually the locking is unnecessary at this point, we can just hold > the sock refcnt to make sure it is not gone after we unlock the global > list, and lock it later only when needed. > > Reported-and-tested-by: syzbot+f621cda8b7e598908efa@syzkaller.appspotmail.com > Signed-off-by: Cong Wang Applied and queued up for -stable.