Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2893452iog; Mon, 20 Jun 2022 07:03:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sHcqpkQ3WVN4oC6WfCRmSM/dLjWE8G8dXka9LhzDWYBNsuVteKPpx6Pnuwdj3YrahFmRTF X-Received: by 2002:a17:906:9c96:b0:711:6c3:c9d7 with SMTP id fj22-20020a1709069c9600b0071106c3c9d7mr20070000ejc.60.1655733794615; Mon, 20 Jun 2022 07:03:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655733794; cv=none; d=google.com; s=arc-20160816; b=J8g5nnMtXVmhVRxuZeplG0UeIkiZFbIzLj8t4b6TOgzDn4JTymUGn5UKLUmk/el1T0 sqYyL3vr2d7oX1PJTY5GGl4p+y8cnaoiL5/g+1LU4sCCzHS5Ji92JxegDnAEamwzyA90 Vk0Yfch2SJWXVTHmypI3HqQnP1XgfNZEMrrTD1bShwnWtiQfds+g92/5mGs9tFVLkJ0Q eVkVdkF6ZnGXHEYoo+m96cxOGAtqwSSEcZwJeHAixg2iO1Y62MVZr9LsUdYuuOpIdt9E WdMlBl2epqz3D3dX7USswznd5PgadLOuMmPbajmG/j5XhkZmYsmpSap0i4Jqn5YQLQwB V2KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bpkWVggJ3SSUB8ub063CuI93Ce8O0+lE1lmNavRnw/U=; b=Dq2W0FL5dgrzJeARP3djS8v3WgkfJfgSRplvU7zzj7J5V5/G1F2dmFe9Ywr/nDvcFI 4kTa+lGDaWdsqKsLWjl+bo44Ei/1FjfD3aBtN2sPr50e1VWUK+gh/ZqU4eAJ5GUgh5rc qj7WeFSiOLVjYwoy3jZ7WjEtqcdMoZ8uRRPQ7qvrkrVi+EQx7wVQPZkDimaEyYYa9diG flzgnALfwkCXIac2HDZYrUnkHx99kAaZ6RPyBQcH4gALJYlmWEMpEEz+xsG6tG7Wm3tC +yRkvSPbtVCvb5APe6tIXycdita3Dc1GXM9/pY/y8Rt2dANeVOaqqL+MJF/oSHo9Zx+g OqNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vf/iYq9D"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rl24-20020a170907217800b00705f0351fb1si12043263ejb.703.2022.06.20.07.02.47; Mon, 20 Jun 2022 07:03:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vf/iYq9D"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348727AbiFTOBn (ORCPT + 99 others); Mon, 20 Jun 2022 10:01:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354999AbiFTOAE (ORCPT ); Mon, 20 Jun 2022 10:00:04 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35AA23B3FD for ; Mon, 20 Jun 2022 06:26:05 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id v1so21062567ejg.13 for ; Mon, 20 Jun 2022 06:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=bpkWVggJ3SSUB8ub063CuI93Ce8O0+lE1lmNavRnw/U=; b=vf/iYq9DpWz4A9mtQbIq4dg+t8LKJf93XXM3RhHu/GHf8CYhssYFp7miEDq8W3c0Fl ao9NKWI8A9jq+Wqb9JkOCjf8/oHc586a8exo/yPyJOIAJYRswYbEIVrewpvjuMlRtcvv CR2QfMue63UCqJArO6q+SMYpJU29d83H0Y4S3k4lRaNiJfkVVV+UQKz+CexOvxuCeTG4 J2cmK7WlOvb3TKiyEKJPwCvZfsJf16/vT1Q/NVQxUA/mGWCtzshY4I4coUYNN45IWdZB txhWZkWbpQZVWpTXCWROu1N2Z/L2MPY552xGOi2ehwrJs2e5+4AwlYX3UwATMOxwmph/ PQOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=bpkWVggJ3SSUB8ub063CuI93Ce8O0+lE1lmNavRnw/U=; b=1TSJH7vC9EmpjKbU4KEx4Fnnmqs+oW4jzcd99qETIYnFF5ClGvO4FS06HKCmG6T/cg BtYZRFjEJf+2EYI2b950li+D69oieaQ0YSRaBdgzKKTErwDW8m1hSYoBk2bASMQzuDxy UKP8rPk0ubtd24gdmN5cAO7ECa16eIMc3QT0Pj2aIWrMTJyocXpcDzfwsiXRM97aNeOP XPtO8y4A9VMLd2UQMK8LQpIM/Y/VD1Y/VRLpqXOLCbH5Y/O2vHoeFI8hSjsQz241wvzl NN7TByhL/+vrV9Vn9omGldapPx6B4y3hpAQkHv1Gs3JG+hAcXTKT6l8nJX/qC8AjeHWP emPA== X-Gm-Message-State: AJIora9iubRMpRbd2Kq9UH7n4T78VUKhvwemhywnoKxLVaTQ2JPqOokn /n02B6CZUrOKBVuDyD+cZnWcnA== X-Received: by 2002:a17:907:97c9:b0:71d:67ea:42ca with SMTP id js9-20020a17090797c900b0071d67ea42camr13845804ejc.7.1655731563861; Mon, 20 Jun 2022 06:26:03 -0700 (PDT) Received: from myrica (cpc92880-cmbg19-2-0-cust679.5-4.cable.virginm.net. [82.27.106.168]) by smtp.gmail.com with ESMTPSA id h7-20020a17090634c700b006febce7081esm6063456ejb.177.2022.06.20.06.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jun 2022 06:26:03 -0700 (PDT) Date: Mon, 20 Jun 2022 14:25:39 +0100 From: Jean-Philippe Brucker To: Zhangfei Gao Cc: Yang Shen , Herbert Xu , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-crypto@vger.kernel.org, linux-accelerators@lists.ozlabs.org Subject: Re: [PATCH] uacce: fix concurrency of fops_open and uacce_remove Message-ID: References: <20220610123423.27496-1-zhangfei.gao@linaro.org> <53b9acef-ad32-d0aa-fa1b-a7cb77a0d088@linaro.org> <1fab1f9a-5c6c-8190-829b-4bacf15eb306@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1fab1f9a-5c6c-8190-829b-4bacf15eb306@linaro.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, Jun 17, 2022 at 10:23:13PM +0800, Zhangfei Gao wrote: > @@ -312,12 +345,20 @@ static ssize_t available_instances_show(struct device > *dev, >                      char *buf) >  { >      struct uacce_device *uacce = to_uacce_device(dev); > +    ssize_t ret; > > -    if (!uacce->ops->get_available_instances) > -        return -ENODEV; > +    mutex_lock(&uacce_mutex); > +    if (!uacce->ops || !uacce->ops->get_available_instances) { Doesn't the sysfs group go away with uacce_remove()? We shouldn't need this check Thanks, Jean