From: Ursula Braun Subject: Re: [Patch net] smc: move unhash as early as possible in smc_release() Date: Mon, 7 Jan 2019 17:45:49 +0100 Message-ID: <05d4693c-35e7-a366-204b-8e375f82da08@linux.ibm.com> References: <20190106074526.4882-1-xiyou.wangcong@gmail.com> <20190107.071250.1939806747054672326.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, mhjungk@gmail.com, syzbot+fbd1e5476e4c94c7b34e@syzkaller.appspotmail.com To: David Miller , xiyou.wangcong@gmail.com Return-path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47924 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726535AbfAGQp5 (ORCPT ); Mon, 7 Jan 2019 11:45:57 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x07GchNj018790 for ; Mon, 7 Jan 2019 11:45:56 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2pv8mwybsc-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 07 Jan 2019 11:45:55 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 7 Jan 2019 16:45:54 -0000 In-Reply-To: <20190107.071250.1939806747054672326.davem@davemloft.net> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 01/07/2019 04:12 PM, David Miller wrote: > From: Cong Wang > Date: Sat, 5 Jan 2019 23:45:26 -0800 > >> In smc_release() we release smc->clcsock before unhash the smc >> sock, but a parallel smc_diag_dump() may be still reading >> smc->clcsock, therefore this could cause a use-after-free as >> reported by syzbot. >> >> Reported-and-tested-by: syzbot+fbd1e5476e4c94c7b34e@syzkaller.appspotmail.com >> Fixes: 51f1de79ad8e ("net/smc: replace sock_put worker by socket refcounting") >> Cc: Ursula Braun >> Signed-off-by: Cong Wang > > We have two patches messing around in here, seeming to deal with release > visibility and ordering problems in two different ways. > > https://patchwork.ozlabs.org/patch/1020608/ > https://patchwork.ozlabs.org/patch/1021044/ > > Reported-by: syzbot+0bf2e01269f1274b4b03@syzkaller.appspotmail.com > Reported-by: syzbot+e3132895630f957306bc@syzkaller.appspotmail.com > The patches from Myungho Jung fix a closing problem for listening SMC-sockets. The patch by Cong Wang fixes a closing problem for SMC-sockets when smc_diag_dump() is running in parallel. Both are valuable in my eyes.