From nobody Sun Apr 5 13:23:59 2026 Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) (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 D8EA23446BE for ; Tue, 24 Mar 2026 02:30:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774319452; cv=none; b=h/OYw/e6E9YkVPrJqKV5RdOLanXTF/XzNXLgn6Vo8JJyhdUNmJYu9OB+4pCrDfR8o8DuFdvoFnViupeUcG5CT/KLX+LIsPYnGSGAy0ru7LbMTedBgibpv+yeA4sv5FMe2ij8e6Hs6N6z9DxWpMH2YMfeGIb4dsqQoxfWpo/bb8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774319452; c=relaxed/simple; bh=QfPKJ8HolwM+cHK7K6e3b/ZsTkZ3AHoNTYGb4gEUwE0=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=acD6Z/MXclj3MqW1yYZkllPXxNgVBOaPssllm+67NQKmHjXwjgN970sotCmd56vi6A4SItsLYFw+PD3Ptq6Y+55kg538Z6qKbioecopGB7sIKH0v+kfok+74o3mEPzCOAIVnVqoaNNu9BntZSW/Gi5ne86aXb8Y6IpWHs4a5CTA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.210.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-7d7e835f956so7977242a34.0 for ; Mon, 23 Mar 2026 19:30:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774319450; x=1774924250; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mtzZs6yEPu1K8kDTGJRYwmAs0yeq3iKQlcbReBTFgmE=; b=dwXdnqMZN9frPBXH8FZYpdBqUXiu6lUOwIle4Iunc0KpZ5ezUIAoSQnYoRBxMWKlLF lZ6WNBvO03jqNqht5K6nkokuqe1aFsGApZDiu0DFL4f3g1/pB+EyyEP91to0W2xZsub4 BlKbpJ046n5cCoWf84M3NZQ819bFkVSPTwOmgLMoQYShi3DGyApC7AVbdnxVuexl2ZkM XH1//+ifpRS4kDR4rZDNKcwQpLsw9OmsMECrSS/ump635m3XHwCGkRwTqNeStaNP/bGK HHCV9T7H1hYHW86s4AhVGnaht/Oh2pOHx/LpxDueSP5vtzZ2H/hpm1MHzOey1FsKZ678 pDVA== X-Gm-Message-State: AOJu0Ywbt6AoKgvDlj2fK7lPkeKFyWjpkYGHqACjVR831HswUaWhQZ6M r/eDHLgzSn1UQZLoa914dZBAFiMF4Mav+mF4G08pYGDhvEHeVromRmvjatLTIYxR68MGtr1aynn yMWPqK5ooburMPjU6WFFa9DWBj+SxkdfCSiY869WS4jXwz4qHyRNl9TDLmoM= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:f008:b0:67d:e90f:99d1 with SMTP id 006d021491bc7-67de90f9df3mr5181466eaf.66.1774319449853; Mon, 23 Mar 2026 19:30:49 -0700 (PDT) Date: Mon, 23 Mar 2026 19:30:49 -0700 In-Reply-To: <69c19ef0.050a0220.3bf4de.00a9.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69c1f759.a70a0220.3cae05.0006.GAE@google.com> Subject: Forwarded: [PATCH] gfs2: fix hung task in gfs2_jhead_process_page From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] gfs2: fix hung task in gfs2_jhead_process_page Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.gi= t master filemap_get_folio() can return an ERR_PTR if the folio is not present in the page cache. This can happen when a crafted or corrupted GFS2 filesystem image is mounted and journal recovery is triggered. gfs2_jhead_process_page() calls filemap_get_folio() without checking the return value, and passes the result directly to folio_wait_locked(). When an ERR_PTR is passed to folio_wait_locked(), the kernel task gets stuck in uninterruptible sleep (state D) forever, triggering the hung task watchdog. Fix this by checking the return value of filemap_get_folio(). If the folio is not found, record the error via filemap_set_wb_err() so that gfs2_find_jhead() picks it up through filemap_check_wb_err() and returns a proper error code to the caller. Without this, gfs2_find_jhead() would return success despite the failure, leading to further issues during mount such as duplicate kmem_cache creation. Reported-by: syzbot+9013411dc43f3582823a@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D9013411dc43f3582823a Signed-off-by: Deepanshu Kartikey --- fs/gfs2/lops.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 797931eb5845..a832904a09e3 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c @@ -467,6 +467,12 @@ static void gfs2_jhead_process_page(struct gfs2_jdesc = *jd, unsigned long index, =20 folio =3D filemap_get_folio(jd->jd_inode->i_mapping, index); =20 + if (IS_ERR(folio)) { + filemap_set_wb_err(jd->jd_inode->i_mapping, PTR_ERR(folio)); + *done =3D true; + return; + } + folio_wait_locked(folio); if (!folio_test_uptodate(folio)) *done =3D true; --=20 2.43.0