From nobody Sun Feb 8 05:26:56 2026 Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.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 A9842277C9A for ; Thu, 8 Jan 2026 11:48:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767872896; cv=none; b=tO/ZxD27xJZFym5WqQZFuBoy7/6Dx1fsOFl4sfOuq196vXHteqpPHAilMVOOlILgrnIEETWtc5yefeIYNbIDWk907/viYVC+1kL82UEv7MhuCBwcRQ3IPh2Gt/qimfcJM4omdVP3GXpAhuonte2cGwt9BCBMRULlfcgbSbAZgxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767872896; c=relaxed/simple; bh=tUvZszoUT2yVR8xWtzXjuur6AOdJMDTp1F+uiCxybhc=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=ccuU+XvHxIvUrwJBLEJCIKLTaQUdioRjHfooz3vmCMrgUHTKA6JrFXDY3iS382NY6zT4atiHf3t1GSMagjCUpYEzkmftA2fLMZnMvsBN5vZ5SWQuRMs+eyedNnRtSaSlaZVJ4LdVPJf+7A/T/b54LvB9TCCxGlGPcBGfqQqHmV4= 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.160.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-oa1-f70.google.com with SMTP id 586e51a60fabf-3f4bc7318aeso3410913fac.3 for ; Thu, 08 Jan 2026 03:48:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767872891; x=1768477691; 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=DigObhtg2XDqYCZqgal3wrP+TSMJwf69w1vUzBu6WBg=; b=jyhAxHthzaU2L42s5djn27xdvr7Or2YgIih+I4n8FAsr96e9vDY93yHmwD0yM9vyCH /9gjwt5Bt05WbC1oVpZ51hejvsOqeEsakFeRLseOrL9kvS6dvAhPyT2FRuTxs4T1rDHd 1ZMCUmXfkRrVe1CJVrBMdvH7sOhCzU7I5M1Orjv673qSOpa0LTZn4eUP0dNGfYn5KGS6 A1AfG6rHvVCXEjVyttQHPpqCOXWlqZRRZacQZWJgKBNQ0gG0JS3iT4fwvSPD0nOg5eR1 Tg5GF6t+WKjlxNg9mR8+nAE6uIgVC4g0oSEXxqG2PulskWzc44xkUgLDZZ7es99seQf6 1sVw== X-Gm-Message-State: AOJu0YwXaabi2+KS1lHeE1Y69U9D1u0CRzF0T/b+Dh11C6oAHLf7bIh+ 2A0wdfr7gsi5Qgq0riQOy9N/W0Ly2ATn4GSHF3JaYmFKW6vuWrlNfNk5qVtHLLm0+v5vLEsXjCS xOM+89DTL2R0Xvc+lyZKGhKg1XgBz1EDMlXjSmrKGmsjFmFfU4pDh76tH0Z0= X-Google-Smtp-Source: AGHT+IErbCQQUQDxAE5lzvMH8apuCu2VeeD1KE/CdGX5tZO/31Jsj3/epqYp7XyJQ/m8KqusobIUR8f4fPHdej+31EjUGo0ZeeiC 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:2007:b0:65d:3c7:b63 with SMTP id 006d021491bc7-65f54f7b13fmr1825056eaf.39.1767872891157; Thu, 08 Jan 2026 03:48:11 -0800 (PST) Date: Thu, 08 Jan 2026 03:48:11 -0800 In-Reply-To: <68e9715a.050a0220.1186a4.000d.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <695f997b.050a0220.1c677c.0397.GAE@google.com> Subject: Forwarded: [PATCH] try fix 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] try fix Author: wangjinchao600@gmail.com #syz test Signed-off-by: Jinchao Wang --- fs/hugetlbfs/inode.c | 34 +++++++++++++++++++++++----------- include/linux/hugetlb.h | 2 +- include/linux/pagemap.h | 6 ++++++ 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 3b4c152c5c73..e903344aa0ec 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -653,17 +653,16 @@ static void hugetlb_vmtruncate(struct inode *inode, l= off_t offset) remove_inode_hugepages(inode, offset, LLONG_MAX); } =20 -static void hugetlbfs_zero_partial_page(struct hstate *h, - struct address_space *mapping, - loff_t start, - loff_t end) +static int hugetlbfs_zero_partial_page(struct hstate *h, + struct address_space *mapping, + loff_t start, loff_t end) { pgoff_t idx =3D start >> huge_page_shift(h); struct folio *folio; =20 folio =3D filemap_lock_hugetlb_folio(h, mapping, idx); if (IS_ERR(folio)) - return; + return PTR_ERR(folio); =20 start =3D start & ~huge_page_mask(h); end =3D end & ~huge_page_mask(h); @@ -674,6 +673,7 @@ static void hugetlbfs_zero_partial_page(struct hstate *= h, =20 folio_unlock(folio); folio_put(folio); + return 0; } =20 static long hugetlbfs_punch_hole(struct inode *inode, loff_t offset, loff_= t len) @@ -683,6 +683,7 @@ static long hugetlbfs_punch_hole(struct inode *inode, l= off_t offset, loff_t len) struct hstate *h =3D hstate_inode(inode); loff_t hpage_size =3D huge_page_size(h); loff_t hole_start, hole_end; + int rc; =20 /* * hole_start and hole_end indicate the full pages within the hole. @@ -698,12 +699,18 @@ static long hugetlbfs_punch_hole(struct inode *inode,= loff_t offset, loff_t len) return -EPERM; } =20 +repeat: i_mmap_lock_write(mapping); =20 /* If range starts before first full page, zero partial page. */ - if (offset < hole_start) - hugetlbfs_zero_partial_page(h, mapping, - offset, min(offset + len, hole_start)); + if (offset < hole_start) { + rc =3D hugetlbfs_zero_partial_page(h, mapping, offset, + min(offset + len, hole_start)); + if (rc =3D=3D -EAGAIN) { + i_mmap_unlock_write(mapping); + goto repeat; + } + } =20 /* Unmap users of full pages in the hole. */ if (hole_end > hole_start) { @@ -714,9 +721,14 @@ static long hugetlbfs_punch_hole(struct inode *inode, = loff_t offset, loff_t len) } =20 /* If range extends beyond last full page, zero partial page. */ - if ((offset + len) > hole_end && (offset + len) > hole_start) - hugetlbfs_zero_partial_page(h, mapping, - hole_end, offset + len); + if ((offset + len) > hole_end && (offset + len) > hole_start) { + rc =3D hugetlbfs_zero_partial_page(h, mapping, hole_end, + offset + len); + if (rc =3D=3D -EAGAIN) { + i_mmap_unlock_write(mapping); + goto repeat; + } + } =20 i_mmap_unlock_write(mapping); =20 diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 019a1c5281e4..ad55b9dada0a 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -814,7 +814,7 @@ static inline unsigned int blocks_per_huge_page(struct = hstate *h) static inline struct folio *filemap_lock_hugetlb_folio(struct hstate *h, struct address_space *mapping, pgoff_t idx) { - return filemap_lock_folio(mapping, idx << huge_page_order(h)); + return filemap_lock_folio_nowait(mapping, idx << huge_page_order(h)); } =20 #include diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 31a848485ad9..b9d818a9409b 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -825,6 +825,12 @@ static inline struct folio *filemap_lock_folio(struct = address_space *mapping, return __filemap_get_folio(mapping, index, FGP_LOCK, 0); } =20 +static inline struct folio *filemap_lock_folio_nowait(struct address_space= *mapping, + pgoff_t index) +{ + return __filemap_get_folio(mapping, index, FGP_LOCK | FGP_NOWAIT, 0); +} + /** * filemap_grab_folio - grab a folio from the page cache * @mapping: The address space to search --=20 2.43.0