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 1FF0B4C83 for ; Mon, 16 Jan 2023 16:32:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74F7BC433EF; Mon, 16 Jan 2023 16:32:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673886777; bh=L8iSiOOe3xAf1h/v0+0aD/8dcs0sLHw2BN+quSTVRG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZbNHtlFcWEtqPAfppMoevyhXLgcFsGCbAD9e5mxORVsXtgyPx4NOUk8jBpYqAXARk x9D7PH1CoC2rKko9JpsVNdWAuANe3aE5BoVsJS3Txmdpo9HnhdeKlUvQP/CstBci8v T4vwurYsDzsgcM3qGSm1yyDVog4i+IxMBV7N3Q4g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Biggers , syzbot+9767be679ef5016b6082@syzkaller.appspotmail.com, Alexander Potapenko , Eric Biggers , Theodore Tso , stable@kernel.org, Sasha Levin Subject: [PATCH 5.4 559/658] fs: ext4: initialize fsdata in pagecache_write() Date: Mon, 16 Jan 2023 16:50:47 +0100 Message-Id: <20230116154935.070899927@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116154909.645460653@linuxfoundation.org> References: <20230116154909.645460653@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Alexander Potapenko [ Upstream commit 956510c0c7439e90b8103aaeaf4da92878c622f0 ] When aops->write_begin() does not initialize fsdata, KMSAN reports an error passing the latter to aops->write_end(). Fix this by unconditionally initializing fsdata. Cc: Eric Biggers Fixes: c93d8f885809 ("ext4: add basic fs-verity support") Reported-by: syzbot+9767be679ef5016b6082@syzkaller.appspotmail.com Signed-off-by: Alexander Potapenko Reviewed-by: Eric Biggers Link: https://lore.kernel.org/r/20221121112134.407362-1-glider@google.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Sasha Levin --- fs/ext4/verity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/verity.c b/fs/ext4/verity.c index 0c67b7060eb4..9879ea046e5a 100644 --- a/fs/ext4/verity.c +++ b/fs/ext4/verity.c @@ -79,7 +79,7 @@ static int pagecache_write(struct inode *inode, const void *buf, size_t count, size_t n = min_t(size_t, count, PAGE_SIZE - offset_in_page(pos)); struct page *page; - void *fsdata; + void *fsdata = NULL; int res; res = pagecache_write_begin(NULL, inode->i_mapping, pos, n, 0, -- 2.35.1