From patchwork Sat Jan 13 11:28:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Adam Davis X-Patchwork-Id: 13518972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2C41FC4707B for ; Sat, 13 Jan 2024 11:35:31 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rOcIS-000115-Kc; Sat, 13 Jan 2024 11:35:28 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rOcIO-00010f-4L for linux-f2fs-devel@lists.sourceforge.net; Sat, 13 Jan 2024 11:35:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Date:Subject:Cc:To:From:Message-ID:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=9hZq7TcGcl2DGxECsv0Ebzbyr1A9X1v0BNjSFl+A1aU=; b=UdRhZ29FGgSM699AURUlMcKxqm xrokQDYXHgJnvN/oMbkCFBr+FH/csG5v+wXIgA9nNDUSATCVyDBZdj1oXUrDwojHbYzK6T5CpNcrA dC09waDhs9KSBEMnhU77LS1QqqjyONMTt1g3sDuHDcbop50j93cHYvruI5OO/8duN1M8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Date: Subject:Cc:To:From:Message-ID:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=9hZq7TcGcl2DGxECsv0Ebzbyr1A9X1v0BNjSFl+A1aU=; b=QcnfzzMptB3/aV7u+h0YBEOIS3 meC8uOiVGllr1Ex+hXI4wZUF5ZzGf5gw5k7GEVvlQqjUPnDqe+RocDIGs+50rT2Kqiz54GrQwrf5C u+Xvt88nIOsOixyJQScIWRwPKQKFm0WIrrvDrW+ZwupS1Xb5fzwN7/+GgHHUsbZ0Uq3M=; Received: from out203-205-251-27.mail.qq.com ([203.205.251.27]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rOcIJ-00089b-6C for linux-f2fs-devel@lists.sourceforge.net; Sat, 13 Jan 2024 11:35:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1705145698; bh=9hZq7TcGcl2DGxECsv0Ebzbyr1A9X1v0BNjSFl+A1aU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DL45VZBd2peyLF1Wy47rjx2AonnXwFF1klgb3hVkKYSaWA7TUYCZov57pNJz6nQqB r3G91ZVmsQuUIgWwmAHFdZJ7yICNEQKpwr/+lauUPMN+HJ+ruTRy5YfaQUMPOkXSZR L7cug0cAyFE9g0yeC9v9ynQdaUHJwXTJE6kS+jTI= Received: from pek-lxu-l1.wrs.com ([111.198.225.215]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMT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INFO: MPJ6Tf5t3I/ycC2BItcBVIA= To: syzbot+a5e651ca75fa0260acd5@syzkaller.appspotmail.com Date: Sat, 13 Jan 2024 19:28:31 +0800 X-OQ-MSGID: <20240113112830.1732178-2-eadavis@qq.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <000000000000aac725060ed0b15c@google.com> References: <000000000000aac725060ed0b15c@google.com> MIME-Version: 1.0 X-Headers-End: 1rOcIJ-00089b-6C Subject: [f2fs-dev] [PATCH] f2fs: fix uaf in destroy_device_list X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Edward Adam Davis via Linux-f2fs-devel From: Edward Adam Davis Reply-To: Edward Adam Davis Cc: syzkaller-bugs@googlegroups.com, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, jaegeuk@kernel.org Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net When the call to f2fs_fill_super() fails, only the memory occupied by sbi is released, but s_fs_info is not set to NULL, this will cause the current issue to occur. Reported-and-tested-by: syzbot+a5e651ca75fa0260acd5@syzkaller.appspotmail.com Signed-off-by: Edward Adam Davis --- fs/f2fs/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index d00d21a8b53a..9939e2445b1e 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4879,6 +4879,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) free_sbi: if (sbi->s_chksum_driver) crypto_free_shash(sbi->s_chksum_driver); + sb->s_fs_info = NULL; kfree(sbi); /* give only one another chance */