Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp214008rdb; Thu, 30 Nov 2023 02:55:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFI30RlFwidaiYNMraSx0AQ0X18cCGLsy0lYp6qO1QsLMGm38Cjlt9JUfvzPOKtFUFiatnv X-Received: by 2002:a05:6808:114c:b0:3af:26e3:92e with SMTP id u12-20020a056808114c00b003af26e3092emr26600293oiu.28.1701341715927; Thu, 30 Nov 2023 02:55:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701341715; cv=none; d=google.com; s=arc-20160816; b=IuRgf1ToyXQVZnOQtPWlP0xTre768vbcTopJC9Rt6qNrrZ/SmhXh8ELDTgtjjYV4Hf b3H1XyHfuC40BIbB30KyEk9sCdWVWHiBAOei2g9lrlofqMCk9MOCXiPKmqT0zDLDi43J v209YYorSHX/TgtB8nDP9cFgtNvxL2yPH6/h4WgRP1MxgMUsjkOlN/P1pcQj2WzgXSet +COU/AUc5/Hs1Mryyk53X/s1G304ut8czREjbeHtpIfAvxsjN3MC32mJFWOMs4LX7XWa 6SOS9W0g5HkyFoyelqIVZsPggzsOAMueXxPdFyzsm0nH6m1rWV5BTIRjoqRlNmP64FA/ Ce3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=XR+8gmLSge88d7ltQNeWVsM7hJthxDwuclCE1+JMykY=; fh=04AKkOkceNyHkp/e4vTQjpEVM+hsGbZpT4cfuuy4cKw=; b=haL0goP1f1wO06HDqiwh+IyIc0Son5bcV7eB5qcNJAdp0+OTqD1L/Z//ZJdHv547xz Vxl8+dtCJj+GkmSG2wpcB7K4/LlNCHQtOo5LugGa1WXwU6WagheGB1SkHR8iNJ+P7Dhu VGdyZncpRqvCwyZ0W5F+CWPPlMxpCel8jVNMQK61jVMis93FjzWmiKyECvgh9SHBzkK8 wPhTWWjGadRcblFSV/FEzkTtr1BEiCFQ0YSdvx1VHUQB+HSlFFBSvIfuJXfRbOERn3C9 m2H1eu05D9ThBUqMYuFQlkWdMkCU7ugRLK2KWXvx8u0GgPQzQdH8sMzw0J+gFH1Y09+2 loqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b=aVNu1BwF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id a3-20020a630b43000000b005859e22461csi1087277pgl.817.2023.11.30.02.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 02:55:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@szeredi.hu header.s=google header.b=aVNu1BwF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=szeredi.hu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 3FF32802934C; Thu, 30 Nov 2023 02:55:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345080AbjK3Kys (ORCPT + 99 others); Thu, 30 Nov 2023 05:54:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235128AbjK3Kyr (ORCPT ); Thu, 30 Nov 2023 05:54:47 -0500 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0B4810D1 for ; Thu, 30 Nov 2023 02:54:52 -0800 (PST) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-54b450bd014so766400a12.3 for ; Thu, 30 Nov 2023 02:54:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; t=1701341691; x=1701946491; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=XR+8gmLSge88d7ltQNeWVsM7hJthxDwuclCE1+JMykY=; b=aVNu1BwFr5byo3AtgdAC0b9vqLdwFrf7remEgGA29tzUf4H4WQuljv79cK7Mwwz7L+ CxNTCv9aNu3puo536sPNwqp1QP+Av2Zk9MQoPmOY6S8fQxfIYqeZwCfR5apH8Afv+smv Y/kNkt3g5GriW1jzt/VakJFOHJoCNPLc305Tw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701341691; x=1701946491; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XR+8gmLSge88d7ltQNeWVsM7hJthxDwuclCE1+JMykY=; b=vQIEa+DA9fQm2rC+XGtnjUKlGv3jsKiE66zK/9aI7QealLj0prCMsBv+Hsc2OYJppc 1zIi6jrshJfdikhxSAwjYH8+eZdNYPATiYep5IW1RreVPQT2AYv5xNLMefnu5yBes77U WROBNWM0kdoKHOE33YZ9P7LD41USz77FpRQ9RNXNXuLxs4B9EUvSWFRLk4F2S9hP+RRi P7iWuGklwRjGBtRTFyTF1VEu7Fgw4/TtQpGB3jFrp3nP0knM7r+XESz9MB9bLg3CU0bn jAaGfbwHInWx/X0ZgePZqBbpLz2QoSlrmxzCTagwrynB2ej+ogLNdaYt3cMmlax4r/fq 7hTw== X-Gm-Message-State: AOJu0YwRFB/wRS72KbxC/ucsiGAnlUUBJPmIbOKYUwy2trWdn4GCSqdv 6PjfsmCOyJqBodiVMNOx+2z8swvYWhSPEKgF5Cunvw== X-Received: by 2002:a17:906:cec7:b0:a10:8db4:bcf3 with SMTP id si7-20020a170906cec700b00a108db4bcf3mr8968339ejb.9.1701341691027; Thu, 30 Nov 2023 02:54:51 -0800 (PST) MIME-Version: 1.0 References: <20231116075726.28634-1-hbh25y@gmail.com> In-Reply-To: <20231116075726.28634-1-hbh25y@gmail.com> From: Miklos Szeredi Date: Thu, 30 Nov 2023 11:54:39 +0100 Message-ID: Subject: Re: [PATCH] fs: fuse: dax: set fc->dax to NULL in fuse_dax_conn_free() To: Hangyu Hua Cc: vgoyal@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 30 Nov 2023 02:55:13 -0800 (PST) On Thu, 16 Nov 2023 at 08:57, Hangyu Hua wrote: > > fuse_dax_conn_free() will be called when fuse_fill_super_common() fails > after fuse_dax_conn_alloc(). Then deactivate_locked_super() in > virtio_fs_get_tree() will call virtio_kill_sb() to release the discarded > superblock. This will call fuse_dax_conn_free() again in fuse_conn_put(), > resulting in a possible double free. > > Fixes: 1dd539577c42 ("virtiofs: add a mount option to enable dax") > Signed-off-by: Hangyu Hua > --- > fs/fuse/dax.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c > index 23904a6a9a96..12ef91d170bb 100644 > --- a/fs/fuse/dax.c > +++ b/fs/fuse/dax.c > @@ -1222,6 +1222,7 @@ void fuse_dax_conn_free(struct fuse_conn *fc) > if (fc->dax) { > fuse_free_dax_mem_ranges(&fc->dax->free_ranges); > kfree(fc->dax); > + fc->dax = NULL; Is there a reason not to simply remove the fuse_dax_conn_free() call from the cleanup path in fuse_fill_super_common()? Thanks, Miklos > } > } > > -- > 2.34.1 >