Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1629447lql; Wed, 13 Mar 2024 03:59:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXx7NSYwE3EraAbTwMWBn6M2VCMQXg1sXOPlmc7F2RPjfVY1Ta5XMiEDK4Azb6apFfKpgzcodZUsWez5yJFNFK8qP22RWeTr1xtnmPgSg== X-Google-Smtp-Source: AGHT+IED1Oz8GumzZgWu1mwy3alyZSiE+idZESnFKo2L4+IWEd2nM35VL1nSCe/ACT64MoeDJQKZ X-Received: by 2002:a05:6512:20f:b0:513:30fb:d64 with SMTP id a15-20020a056512020f00b0051330fb0d64mr7043750lfo.44.1710327563083; Wed, 13 Mar 2024 03:59:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710327563; cv=pass; d=google.com; s=arc-20160816; b=RQ0ci20YCbJ7T/kUjYu/i8I1IQQkYmiTrygaQeTJMrIEAxraeg3Z9anSqbXpo60hs/ 63gzyu6jjk/a3e7Dvm4bzn1JpAW7vUbe+kw4hAA4GTySX73scvXuVy7YDshO9q+vmPG9 VHBNlFMNX710HN5c3udqMikoS0Vu5+kBaIPNTwRGz/ilKUPoHpArCStW9BO0/ct9Kmqe mC8FDx0ZdkguQZmqC6l1BFL1N4vPlswpK5r1r5pRouznAQ5ETC5/hY4GUNUqbbjRI8KF uraY0FkyLqzadctqkqWr8dFLtX4maiUoZZPjlwQtctrX60d0YKbyxhqad39Ixv4PZRUP T5vw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=n6OiDuamBBAXOaKBTYclnqW/lnJ6yR3NtB8qHgG2gks=; fh=RchhPMWMpofakgq7CPg+KI7CyjAimeo5ssNN0wK8InY=; b=QomhB/l60/g78a6cZYoGrChM9CXvSS/La4V++RKozWuJERQApJ0wB3rgCX3Ilxfzjm QdfUrEkyV489kyO8wUYzh+iJsL3hBECpjARw6OxbGAuHZJFc4og1J6F868/kMFmyAWs/ UgIdCri2B0xeQMjyDklkqxoQ0220MBrKe/RlITUNJ1wMwsDoaJimLIl9yz2UY1FPz4J4 +MGso3CnaijL7WC22sQQ2ZqpA7NLalSNxbAPsIQyE/Hw+e+pJGE01ob6+pmMXqpXB8wq ekHPruGpabwlVVIAD6uMnCOyIBN3VUVWEH9GwhDe+HEAdowkc5a0iUXq3hxqklvXPRmH PrFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="aM5z6/uh"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-101377-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101377-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id r21-20020a170906c29500b00a45c9959918si4278303ejz.144.2024.03.13.03.59.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 03:59:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101377-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="aM5z6/uh"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-101377-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101377-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C433F1F223A1 for ; Wed, 13 Mar 2024 10:59:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 643BD3F9E8; Wed, 13 Mar 2024 10:58:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aM5z6/uh" Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47CC93D552; Wed, 13 Mar 2024 10:58:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710327518; cv=none; b=j04q/X+9nzKfu6S3K2w5nF4r0g4X1Ye8u45oXMrrlsjysXYoFjyKYiimeAC7EZeYoTrtOjzt8HubOCuac72FtmOZE5KZ/9V7nT2CG51UduW+sEfsBy/iJQSOSMzJCeNrTOrw/QpzdVeazNUudltkKErGaN57Eg7u1NWYZbleXdI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710327518; c=relaxed/simple; bh=gAtcr9DRDtLEExSTM8iIcsQhUaU6gIAgK/w6NrX+LZg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XEsC7gebzUHVKijRilcvLZTdB40fxwtoyHoRTRQb0DuKrtQPvn8IJ4NKDgK4GEQXS3VCumu0RhmEeMXgYfH/Vv1j2MbhfgRIxtplaVvf3wGCheq7zymDblTYxZNNWpYpngXkpyh4Y0Af4GQyQrKtOeHikx+bG0CLIe+VYHgrb+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aM5z6/uh; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6e6ade6a66aso844262b3a.3; Wed, 13 Mar 2024 03:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710327517; x=1710932317; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n6OiDuamBBAXOaKBTYclnqW/lnJ6yR3NtB8qHgG2gks=; b=aM5z6/uhMg2Gu9ev29Aa3Js1pu8LWJal2SXAJ2el8qAGFwVUSQZ6OKX8BQYyZ0yuue YhyiTqvGC7vmYHIHbNZqmbJwjbxVxojcZaVxf+D+ETppkXDu7lcIVyG/jrZXhMtim7tF C8fkrqfVnaZUxZYWT96dx8Ke4GoL7wuxQIAuQF05XfIuqV9859YGDMN0kJcB5zWG2Qzk dVwzvQLhOzMejgCKSYLKkMm+I7OfjFluwt36oeJtUCODZWMaWNBICmn0aRncKbxXYHFx qBRxLGoGqPVwXxAEbqREQYQ3wXopwl5T8gvxvkrEKtKVBqhl/UOPACZTzHkKELu9b1z6 8TXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710327517; x=1710932317; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n6OiDuamBBAXOaKBTYclnqW/lnJ6yR3NtB8qHgG2gks=; b=lTd7Fj3Wn975l/ssjCKUoQL6UyQwAbqUnIBT0sUG5NVAjhQ8KekiRVaXqLy21j37uA UvoAnVe7gccqlOU4H1vwM60tLhfe97viwT2zXZdNWh4HkSk/XuUm4SwH+c4fKDHDaqbb VLvqgW7uyjoZRsJBgZLpFfJ340Wouk6XCpO23I943IXwuYt56k7AfCRSUBOnduXd3mAH RdHcNLYNuwdtkGijtE3hjLrB32AmV6jXiY5kY2ibUijMg98v2974UfkE56G6wXidrLMM mTKaDp4fdcIbnHu8LZjHuyFiOIIMSRXmix8r83B9oZiBDMeN3JtM+erW0warbTI3g34w eenA== X-Forwarded-Encrypted: i=1; AJvYcCVpRMazo/ZRFOOgOBF0MqpruzZSIgkCcbQMjw/xhWmV3XKediml0NVRBjm6TAm8l1PEPA7wC8I0vmzL8xcUXVIipUSqer8+IWOGrbrfX/Iv7cX3K6sr0AW9pwuiOnwwA8uBxmO5W4FWBN0= X-Gm-Message-State: AOJu0YyIwxMGv1i8qzu0V4AbtFJquqdzyW0Zf9h2FwxKgu8XwKlawh01 O9lr2leTQGzD+V9Y6BgyqTfzHjvHFCwTgNHK2MnACohkqzIG4EEh X-Received: by 2002:a05:6a00:2382:b0:6e5:bb8:dc1c with SMTP id f2-20020a056a00238200b006e50bb8dc1cmr2159870pfc.2.1710327516575; Wed, 13 Mar 2024 03:58:36 -0700 (PDT) Received: from carrot.. (i223-217-148-4.s42.a014.ap.plala.or.jp. [223.217.148.4]) by smtp.gmail.com with ESMTPSA id m5-20020aa78a05000000b006e6ab7cb10esm2338844pfa.186.2024.03.13.03.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 03:58:35 -0700 (PDT) From: Ryusuke Konishi To: Andrew Morton Cc: syzbot , syzkaller-bugs@googlegroups.com, linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] nilfs2: prevent kernel bug at submit_bh_wbc() Date: Wed, 13 Mar 2024 19:58:27 +0900 Message-Id: <20240313105827.5296-3-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240313105827.5296-1-konishi.ryusuke@gmail.com> References: <0000000000002df264056a35b16b@google.com> <20240313105827.5296-1-konishi.ryusuke@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Fix a bug where nilfs_get_block() returns a successful status when searching and inserting the specified block both fail inconsistently. If this inconsistent behavior is not due to a previously fixed bug, then an unexpected race is occurring, so return a temporary error -EAGAIN instead. This prevents callers such as __block_write_begin_int() from requesting a read into a buffer that is not mapped, which would cause the BUG_ON check for the BH_Mapped flag in submit_bh_wbc() to fail. Signed-off-by: Ryusuke Konishi Fixes: 1f5abe7e7dbc ("nilfs2: replace BUG_ON and BUG calls triggerable from ioctl") Cc: stable@vger.kernel.org --- fs/nilfs2/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 9c334c722fc1..5a888b2c1803 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -112,7 +112,7 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff, "%s (ino=%lu): a race condition while inserting a data block at offset=%llu", __func__, inode->i_ino, (unsigned long long)blkoff); - err = 0; + err = -EAGAIN; } nilfs_transaction_abort(inode->i_sb); goto out; -- 2.34.1