From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E01F1D14B; Mon, 18 Dec 2023 14:07:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="cio/7Rao" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B70DC433C7; Mon, 18 Dec 2023 14:07:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1702908478; bh=H/f4zKYC9mNnA4Zfnh/+om64AgFWeHsbHrLr357JOnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cio/7RaokYrPYO2KtOPAyoi75uSRACQPn126TD17/WEZD60Wohsc8q5fSIepMHR7l yK34m2zenF3EJuz61idfyT6T6NYNY9s7VWJBz38Cd/4ASF6cP5uDdmZQXTrmJFsbsm 05lVVbr27AO07oW5Qo0B7JGC2h86uffNjnhZIt4c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hangyu Hua , Vivek Goyal , Jingbo Xu , Miklos Szeredi Subject: [PATCH 5.10 25/62] fuse: dax: set fc->dax to NULL in fuse_dax_conn_free() Date: Mon, 18 Dec 2023 14:51:49 +0100 Message-ID: <20231218135047.369020876@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231218135046.178317233@linuxfoundation.org> References: <20231218135046.178317233@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hangyu Hua commit 7f8ed28d1401320bcb02dda81b3c23ab2dc5a6d8 upstream. 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 Acked-by: Vivek Goyal Reviewed-by: Jingbo Xu Cc: # v5.10 Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/dax.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -1228,6 +1228,7 @@ void fuse_dax_conn_free(struct fuse_conn if (fc->dax) { fuse_free_dax_mem_ranges(&fc->dax->free_ranges); kfree(fc->dax); + fc->dax = NULL; } }