Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp2300032pxv; Sat, 17 Jul 2021 09:34:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1hG1kkzCw6aQA+TyHMBv5J4MVXApLHk9hKopKhFjWPGIrlG5xHMlT1QhnmoL8ZVQQKb0e X-Received: by 2002:a05:6e02:2162:: with SMTP id s2mr10391692ilv.99.1626539640888; Sat, 17 Jul 2021 09:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626539640; cv=none; d=google.com; s=arc-20160816; b=AdaIvPquyf8qBdYimRtwnLDxGcr9mCTLE15Y28v9tzZkQQcZmeMoT0HV+Qea5ba69p 5dWjnrDKr1hH1uK1+pGoaI0nnAPOOQGTLn1YWgJjs7Hj930RgHrW6oWVfzrlbuUe9qVe M+DQxaae2F92YohUe8xYevnslclAqSx5pxRnWWrU3CaG6BrsTCh6bgW5a3SHSWntTSWf eg5yltErio5Qrq8arkxZ8my0+j3X1RmDtohX6ZGWL7Zbj9AmVAODWqErbyEx77cPf+8K L25y9aTqn7Bzm3RBFbdBgCYiQ1f5yxUyGX/xhwmJsjqVYlaYDXQx2+8c4d6r+QrsHLrM E5vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:mime-version :content-transfer-encoding:references:in-reply-to:subject:cc:to:from :date:dkim-signature; bh=FKpHiS169x9azDRzGN9bbvMcEmln4K0mzgvHHsRjbx4=; b=fVFiOkRx+fvBalqdHHcZ1uZDEu4ZlW/s/jMOCDkRV8MiJ3lLxTsoKED5YzE6SMhrt0 RLghS9VcNq/iFi/lCkMthm2tpOnXU3myk6fnT/ncN2l74F4iWMHLLR2tYDTI5g6bjtX+ My4OPNs98KZoeVt53YCmXuBF1JtliXA4eL0wQNmBufDn2uPNIg3+jWjbCMx3Blmr7sza fzm1t37RuIBrWhoXoWvCq4ukzbRoVhnIZSv3t1ccOrYpwB0740BvnGiS0b/a0Q+bk6Sk /JqXWuu97Kz/Ir0a2X1SbKP6L5vjAhxmQC3Ot2IEsp4ZKtKyDqmD+ss70QceNUCKUZgU QCJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fudan.edu.cn header.s=dkim header.b="HIh/zbXc"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fudan.edu.cn Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q3si3418079iob.0.2021.07.17.09.33.34; Sat, 17 Jul 2021 09:34:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fudan.edu.cn header.s=dkim header.b="HIh/zbXc"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fudan.edu.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230272AbhGQQgZ (ORCPT + 99 others); Sat, 17 Jul 2021 12:36:25 -0400 Received: from zg8tmty1ljiyny4xntqumjca.icoremail.net ([165.227.154.27]:38813 "HELO zg8tmty1ljiyny4xntqumjca.icoremail.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S229581AbhGQQgY (ORCPT ); Sat, 17 Jul 2021 12:36:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fudan.edu.cn; s=dkim; h=Received:Date:From:To:Cc:Subject: In-Reply-To:References:Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID; bh=FKpHiS169x9azDRzGN9bbvMcEmln4K0mzgvH HsRjbx4=; b=HIh/zbXcz9z9v7WoTLdCl50YpXzMXjU39W1jSiucLnf+xz0kDuVi StIfKL0cxbfuffF0MCud8865tXrwj2d3Y6PIYo63qm/Qt5TCjQUYCaA2MdO4U8Ny ndaefCap27761AynrgcwSJSn3fdX9IJL6rqxy/Js1/iCuzVW6ghS4jg= Received: by ajax-webmail-app2 (Coremail) ; Sun, 18 Jul 2021 00:32:31 +0800 (GMT+08:00) X-Originating-IP: [39.144.105.157] Date: Sun, 18 Jul 2021 00:32:31 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: "Xiyu Yang" To: "Trond Myklebust" Cc: "tanxin.ctf@gmail.com" , "davem@davemloft.net" , "chuck.lever@oracle.com" , "linux-kernel@vger.kernel.org" , "kolga@netapp.com" , "kuba@kernel.org" , "netdev@vger.kernel.org" , "bfields@fieldses.org" , "anna.schumaker@netapp.com" , "linux-nfs@vger.kernel.org" , "yuanxzhang@fudan.edu.cn" Subject: Re: Re: [PATCH] SUNRPC: Convert from atomic_t to refcount_t on rpc_clnt->cl_count X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT3.0.8 dev build 20200917(8294e55f) Copyright (c) 2002-2021 www.mailtech.cn fudan.edu.cn In-Reply-To: <1f12b3569565fa8590b45cc2fbe7c176ca7c5184.camel@hammerspace.com> References: <1626517112-42831-1-git-send-email-xiyuyang19@fudan.edu.cn> <1f12b3569565fa8590b45cc2fbe7c176ca7c5184.camel@hammerspace.com> X-SendMailWithSms: false Content-Transfer-Encoding: 7bit X-CM-CTRLDATA: 28cyeGZvb3Rlcl90eHQ9MTU4OToxMA== Content-Type: text/plain; charset=UTF-8 MIME-Version: 1.0 Message-ID: <78709d5e.49a9.17ab54fead8.Coremail.xiyuyang19@fudan.edu.cn> X-Coremail-Locale: en_US X-CM-TRANSID: XQUFCgBnbvYfBvNgEebaBA--.55915W X-CM-SenderInfo: irzsiiysuqikmy6i3vldqovvfxof0/1tbiARAFAVKp4xMhKAAAsX X-Coremail-Antispam: 1Ur529EdanIXcx71UUUUU7IcSsGvfJ3iIAIbVAYjsxI4VWxJw CS07vEb4IE77IF4wCS07vE1I0E4x80FVAKz4kxMIAIbVAFxVCaYxvI4VCIwcAKzIAtYxBI daVFxhVjvjDU= Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Sorry, I'm not sure why you need to bump a zero refcount in a normal situation. But maybe we can use refcount_inc_not_zero() API in rpc_free_auth() instead? > -----Original Messages----- > From: "Trond Myklebust" > Sent Time: 2021-07-17 22:43:26 (Saturday) > To: "tanxin.ctf@gmail.com" , "xiyuyang19@fudan.edu.cn" , "davem@davemloft.net" , "chuck.lever@oracle.com" , "linux-kernel@vger.kernel.org" , "kolga@netapp.com" , "kuba@kernel.org" , "netdev@vger.kernel.org" , "bfields@fieldses.org" , "anna.schumaker@netapp.com" , "linux-nfs@vger.kernel.org" > Cc: "yuanxzhang@fudan.edu.cn" > Subject: Re: [PATCH] SUNRPC: Convert from atomic_t to refcount_t on rpc_clnt->cl_count > > On Sat, 2021-07-17 at 18:18 +0800, Xiyu Yang wrote: > > refcount_t type and corresponding API can protect refcounters from > > accidental underflow and overflow and further use-after-free > > situations. > > > > Have you tested this patch? As far as I remember, the reason why we > never converted is that refcount_inc() gets upset and WARNs when you > bump a zero refcount, like we do very much on purpose in > rpc_free_auth(). Is that no longer the case? > > > -- > Trond Myklebust > Linux NFS client maintainer, Hammerspace > trond.myklebust@hammerspace.com > >