Message ID | 20221121112134.407362-4-glider@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1525623wrr; Mon, 21 Nov 2022 03:29:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf5jSbJSUfBzt6ziwM9JK5QocQaMK0bKiLBTcqbcwS5Ntd0O+CLELQ8dkZgnkgZ3+Efip1pj X-Received: by 2002:a05:6402:3893:b0:461:b033:90ac with SMTP id fd19-20020a056402389300b00461b03390acmr4089065edb.257.1669030167134; Mon, 21 Nov 2022 03:29:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669030167; cv=none; d=google.com; s=arc-20160816; b=ZNjXVSG4t3cbcbavjE5h4I/KEYX8olM5yhcPBt+30akr2RrEBtlrILF3klKGqJEjJA ZgW4X/UzdMtGvbJi3fHAZNnlOAljvWVifyCHJ2tEXG64LasgCm+bderNrNDmvn3KePl7 wDX6QIavyOVGPyYWj8smOHof2BRmktWl36dVCxlhCTtZqvb6KABekWCkJWeM4vuJYiTc aiaurEK9kParP1E9mRR58LOpObZAahzqDNwew2TSQG7Gu0alpgVyHS3jV7yyraYgsPD9 NmlumF6Jw9dFxyV0afcGtA0pSr078vWPyuPILsDh/z5BsvMz+ll+BbLM0WzWPpC6a9QC Tfwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=iseMGXVhmQtR+5DQv6vAmctq3FLXZ3Zx0bYYW0I3bps=; b=bCMjKQxAX78dJtbaPpmqmRu5zYnOtKPJRoTayv8RM/Iq8ux5/LiDeQuBSfI45QT4qs svEgR5kS5MBet1ZroGqEcEWDI4N1bTO29YHG2qgxFysiW+HUhFQnLwwjB48nyLXw6pRj QDIWg7OWFSE0b3r4nNI0hrerDRPZnYp/91BO8KJd78qjLemo5kMBs/vFc5C9/+KKmdvj CL1Zl0RW9xBkUdW2o1wjNvh0msC4Tpz1IOc+vcArOKRpo2Zz4gHEe7ByLYUxX6mcDGvH ifi1NRCGXx0dcooPQVVg2ndzntr9B38q5g/eQ90tTsG4FrJ/EzwkziA37IG4gJnC8goR B9jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=fvoRIPmp; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg25-20020a170907971900b007a7d37e4684si8689084ejc.803.2022.11.21.03.29.00; Mon, 21 Nov 2022 03:29:27 -0800 (PST) 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=@google.com header.s=20210112 header.b=fvoRIPmp; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229943AbiKUL0y (ORCPT <rfc822;cjcooper78@gmail.com> + 99 others); Mon, 21 Nov 2022 06:26:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230334AbiKUL0O (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 21 Nov 2022 06:26:14 -0500 Received: from mail-ej1-x649.google.com (mail-ej1-x649.google.com [IPv6:2a00:1450:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E171EBFF6F for <linux-kernel@vger.kernel.org>; Mon, 21 Nov 2022 03:21:47 -0800 (PST) Received: by mail-ej1-x649.google.com with SMTP id hb35-20020a170907162300b007ae6746f240so6381914ejc.12 for <linux-kernel@vger.kernel.org>; Mon, 21 Nov 2022 03:21:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=iseMGXVhmQtR+5DQv6vAmctq3FLXZ3Zx0bYYW0I3bps=; b=fvoRIPmpwjc9kwZJjlC8SWhtwYdajteuU8MNnEWUMvn5GkD+yGWYPUsDcdndaw8YjK fa13YD7A3DdjmU3EhEj99KaM6rOjUxJKB/d/QJYdnY6fqKOJgZkPoO8RrrWJe1U4umr+ hiUfjkhq3hMpxwynNBwHUtYJWY9QJy0HLcUfde1YnzFDialtNBgsAL/Lpaq6bDXTMM62 N5V2k9a1D0kusoUoO9/V+NmAYKbT5IpfYNf/E/G22Vwu5YTvASjATJcEIMrdADAeDQc2 MVVCkuX8C8EJypjMeMPM03N72UYeZDw46ri4QQG9SKF+2INt3aYRQ+JZ/H1xOpAorNwU 0etA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iseMGXVhmQtR+5DQv6vAmctq3FLXZ3Zx0bYYW0I3bps=; b=3Yg7EojbQephbdOOJTJIITFZSRWEsBA0xyETRTkwwPojImLeTqUVcz/1jkyR5ksvCH JsXUwDVSoYI+4Wmq0o2fAbXsGqkZsX2YUZcfKdBRGG7QC159FrWj5UivRi981p6Ap9Zo VHue7SwwcaqbryQnAHK+rPgRMBD1nGbMK1Y9e3QfoNY8v0g7Bhch7To0rftNq0W908aR qvdBdFiKjPjle7BLG08+sTZyBRuQQPIVysV+XcbVPlwr1QAzSiet+gxcW/Fa9aOli06L FF4fDhQ91QRalxeHL8LHmTDCNM0m0eDMp8DJCFjeeTujbhFeEa+whtiFjUbt7oxEu24I zwRA== X-Gm-Message-State: ANoB5pmYggKTyhxlvZfeKyo3q+rLWNX/NGwucKOMF3rOteuTkhJsrKPQ at5lKhvmDURx/UHLPb+YaHHCriGj5XA= X-Received: from glider.muc.corp.google.com ([2a00:79e0:9c:201:db68:962:2bf6:6c7]) (user=glider job=sendgmr) by 2002:a17:907:8b13:b0:781:541:6599 with SMTP id sz19-20020a1709078b1300b0078105416599mr3206798ejc.45.1669029706445; Mon, 21 Nov 2022 03:21:46 -0800 (PST) Date: Mon, 21 Nov 2022 12:21:33 +0100 In-Reply-To: <20221121112134.407362-1-glider@google.com> Mime-Version: 1.0 References: <20221121112134.407362-1-glider@google.com> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog Message-ID: <20221121112134.407362-4-glider@google.com> Subject: [PATCH 4/5] fs: hfs: initialize fsdata in hfs_file_truncate() From: Alexander Potapenko <glider@google.com> To: glider@google.com Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, tytso@mit.edu, adilger.kernel@dilger.ca, jaegeuk@kernel.org, chao@kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Eric Biggers <ebiggers@kernel.org> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750104976845517489?= X-GMAIL-MSGID: =?utf-8?q?1750104976845517489?= |
Series |
[1/5] fs: ext4: initialize fsdata in pagecache_write()
|
|
Commit Message
Alexander Potapenko
Nov. 21, 2022, 11:21 a.m. UTC
When aops->write_begin() does not initialize fsdata, KMSAN may report
an error passing the latter to aops->write_end().
Fix this by unconditionally initializing fsdata.
Suggested-by: Eric Biggers <ebiggers@kernel.org>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Alexander Potapenko <glider@google.com>
---
fs/hfs/extent.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, Nov 21, 2022 at 12:21 PM Alexander Potapenko <glider@google.com> wrote: > > When aops->write_begin() does not initialize fsdata, KMSAN may report > an error passing the latter to aops->write_end(). > > Fix this by unconditionally initializing fsdata. > > Suggested-by: Eric Biggers <ebiggers@kernel.org> > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Signed-off-by: Alexander Potapenko <glider@google.com> Dear FS maintainers, HFS/HFSPLUS are orphaned, can someone take this patch to their tree? Thanks in advance! (same for "fs: hfsplus: initialize fsdata in hfsplus_file_truncate()": https://lore.kernel.org/all/20221121112134.407362-5-glider@google.com/)
On Tue, 24 Jan 2023 11:51:30 +0100 Alexander Potapenko <glider@google.com> wrote: > On Mon, Nov 21, 2022 at 12:21 PM Alexander Potapenko <glider@google.com> wrote: > > > > When aops->write_begin() does not initialize fsdata, KMSAN may report > > an error passing the latter to aops->write_end(). > > > > Fix this by unconditionally initializing fsdata. > > > > Suggested-by: Eric Biggers <ebiggers@kernel.org> > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > > Signed-off-by: Alexander Potapenko <glider@google.com> > > Dear FS maintainers, > > HFS/HFSPLUS are orphaned, can someone take this patch to their tree? > Thanks in advance! > (same for "fs: hfsplus: initialize fsdata in hfsplus_file_truncate()": > https://lore.kernel.org/all/20221121112134.407362-5-glider@google.com/) I grabbed both. I removed the Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") because that might provoke the backport bots to backport this fix across eight years worth of kernels. Before KMSAN existed! If you intended that this be backported then please let's come up with a more precise Fixes: target and we'll add cc:stable.
On Tue, Jan 24, 2023 at 10:04 PM Andrew Morton <akpm@linux-foundation.org> wrote: > > On Tue, 24 Jan 2023 11:51:30 +0100 Alexander Potapenko <glider@google.com> wrote: > > > On Mon, Nov 21, 2022 at 12:21 PM Alexander Potapenko <glider@google.com> wrote: > > > > > > When aops->write_begin() does not initialize fsdata, KMSAN may report > > > an error passing the latter to aops->write_end(). > > > > > > Fix this by unconditionally initializing fsdata. > > > > > > Suggested-by: Eric Biggers <ebiggers@kernel.org> > > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > > > Signed-off-by: Alexander Potapenko <glider@google.com> > > > > Dear FS maintainers, > > > > HFS/HFSPLUS are orphaned, can someone take this patch to their tree? > > Thanks in advance! > > (same for "fs: hfsplus: initialize fsdata in hfsplus_file_truncate()": > > https://lore.kernel.org/all/20221121112134.407362-5-glider@google.com/) > > I grabbed both. > > I removed the > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > > because that might provoke the backport bots to backport this fix > across eight years worth of kernels. Before KMSAN existed! Right, makes sense.
diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c index 3f7e9bef98743..6d1878b99b305 100644 --- a/fs/hfs/extent.c +++ b/fs/hfs/extent.c @@ -486,7 +486,7 @@ void hfs_file_truncate(struct inode *inode) inode->i_size); if (inode->i_size > HFS_I(inode)->phys_size) { struct address_space *mapping = inode->i_mapping; - void *fsdata; + void *fsdata = NULL; struct page *page; /* XXX: Can use generic_cont_expand? */