Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4070063iob; Tue, 17 May 2022 13:13:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnu2m6KnN1IAL6iKo3oxZfYlu4oOo3rlI+dHVF5U8MEHFrFwelbf2krp9LeMi4mQiUoHno X-Received: by 2002:a17:907:86a5:b0:6f9:aa0f:a838 with SMTP id qa37-20020a17090786a500b006f9aa0fa838mr20883104ejc.340.1652818435622; Tue, 17 May 2022 13:13:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652818435; cv=none; d=google.com; s=arc-20160816; b=icBaFPTes6fhf6i6wEh2nttkW5UBTwzisJ2CV43fULR3bEWI+hrb0c4qIdEf1XZs0X 2WRuLD9awMDU4UpOtEbdVkf6UACM19fj1TRu0qkQbN/RgqBmh+PbsAuIFQZGeKr0FR3r NgulCv4iwAxR5zKfcjBs31Cwjjl965fAtQMzW8pHeXcKIWG99ec2ah8r26uoaQEXhLZr a9pnzxksgkfGo+ZzM1r8Gu+sxjO08bgx2gN5c76PsuDcUo6Zu+RxcChkFqg9y53o5s6N xC1iWehmzAbDBpIS5LYSTMIQsJrBZcQLlILYAHrszBhXJchHAS+2xS9qqIa4jgN/HLiC Ewbw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5OEZwf1a6NBQqaSeB1PoXjAnNB9RAFDi45J9mVUY6Mc=; b=FtmlAES3tXUp3MpikLSSLk9yAuY5QoOyPNOsfTgcrlhns6E3XDenpHZiG6IPJ80gdI gvA5P2C/VOBFoiTSw4e0J6CNTVbTatN8kWoIIDmxZfw8OHg23ba2PiNZiSqOZvsqFLI7 TPGeiTcu5bxlO3zjPCXd3QNcsxw+jB065wynmsYmcvgiTG0yECQ7Ct5+464LDM4vJftB 29J3iI6VvfJ6NRLNMr13TNM1A6MWzkrHb3tb5y5TyAfuU7bFZ6Zer3o+aLlo0WFX42r4 nlkTenbaxG+jimOf//stwUE/A6iSM4WSR/lmhwUCvcQ3O/2vTn04PoDPzV9WvxgCJz+P 9Q8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=QBzP1DKP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n1-20020aa7c681000000b00427d0e5c909si165412edq.414.2022.05.17.13.13.24; Tue, 17 May 2022 13:13:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@ziepe.ca header.s=google header.b=QBzP1DKP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352458AbiEQS64 (ORCPT + 99 others); Tue, 17 May 2022 14:58:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352450AbiEQS6w (ORCPT ); Tue, 17 May 2022 14:58:52 -0400 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E5EA50050 for ; Tue, 17 May 2022 11:58:48 -0700 (PDT) Received: by mail-qv1-xf30.google.com with SMTP id e20so2147967qvr.6 for ; Tue, 17 May 2022 11:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=5OEZwf1a6NBQqaSeB1PoXjAnNB9RAFDi45J9mVUY6Mc=; b=QBzP1DKPQbqGKOwIfmhQEGqpBNec/goHk3M1uethuYOR4H4TVy1TNG+78Yg/EfeA1p O+QpBBWuxfJOO+9alDPgCh5Wk9mjLu3Lbb8GCkY7c4qN8WlXwMU0bFf/egc3hRMqfjE+ EqGiD6xZ/1RHdO8SzKC36Pf9IQqc8EFp5KZQYk+z2Um4RaWmAU2y2Y4r4Mlz/khF4X+Z hay1CaKtA7G71htZGUjME3MNwvc90lKl8CGYiub7BwFlRXjiz3qFqFF7MgMpwpN6tHi9 4GdIvK/cJD17qDjaEhk+0wX+rdctJcJ9XKT12PLSxgUkl+jl5APFbAv2TRNCxKzqzF06 qorA== 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:in-reply-to; bh=5OEZwf1a6NBQqaSeB1PoXjAnNB9RAFDi45J9mVUY6Mc=; b=bk8VurLOD/NQAoJfgZzbo5BmoKJI139aCwwe5X4xY08GuC52Z8g3IrjWsK8YAWXkSt UqhkrifUcmEOiz/f+p3/SWSs0BdJRTd/IdDiPK+FSakkLnTtWd4rl5/oS9Yl0vhhiJji ztN2VuKStv1Jn1Bd68TSsoLsrHFt8b+JkEiiUeu2DTkyY4krhtpGjuqDU1ifqB3XTxMr AUZo6o9teZo9335/5RSiSMk+e0eCyQ2AFlFVJD+Ir0/rmdDLBH/7YvVwz9MdexX5siyl vFfIhL13GmuArNzLGuXwwG1MKnH4yEIKg70URnWfvymRHRBUmVo4lXhyi+DjR6XsF6tO xvmg== X-Gm-Message-State: AOAM532LvKJbr7VB9xcnJTDp0ULU4hGRUOyNV1vyhEbPbGed2wik7nUo 1eLSRp/7nIPwPxN5+YVpU3o7PA== X-Received: by 2002:ad4:5aa1:0:b0:45a:af34:4dee with SMTP id u1-20020ad45aa1000000b0045aaf344deemr21321686qvg.115.1652813927373; Tue, 17 May 2022 11:58:47 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-113-129.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.129]) by smtp.gmail.com with ESMTPSA id l18-20020a37f912000000b0069fc13ce20asm8575857qkj.59.2022.05.17.11.58.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 11:58:46 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1nr2P7-0089GX-Qd; Tue, 17 May 2022 15:58:45 -0300 Date: Tue, 17 May 2022 15:58:45 -0300 From: Jason Gunthorpe To: Wan Jiabing Cc: Paolo Bonzini , Alex Williamson , Yi Liu , Kevin Tian , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kvm/vfio: Fix potential deadlock problem in vfio Message-ID: <20220517185845.GL63055@ziepe.ca> References: <20220517023441.4258-1-wanjiabing@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220517023441.4258-1-wanjiabing@vivo.com> 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=unavailable 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-kernel@vger.kernel.org On Tue, May 17, 2022 at 10:34:41AM +0800, Wan Jiabing wrote: > Fix following coccicheck warning: > ./virt/kvm/vfio.c:258:1-7: preceding lock on line 236 > > If kvm_vfio_file_iommu_group() failed, code would goto err_fdput with > mutex_lock acquired and then return ret. It might cause potential > deadlock. Move mutex_unlock bellow err_fdput tag to fix it. > > Fixes: d55d9e7a45721 ("kvm/vfio: Store the struct file in the kvm_vfio_group") > Signed-off-by: Wan Jiabing > --- > virt/kvm/vfio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Jason Gunthorpe Thanks, Jason