All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: squashfs: fix leaked page locks when page actor allocation fails
Date: Mon, 28 Sep 2026 06:21:19 +0800	[thread overview]
Message-ID: <202609280655.spyNjO2a-lkp@intel.com> (raw)
In-Reply-To: <202609280655.spyNjO2a-lkp@intel.com>

Hi Nguyen,

kernel test robot noticed the following build warnings:



url:    https://github.com/intel-lab-lkp/linux/commits/Nguyen-Ngoc-Thang/squashfs-fix-leaked-page-locks-when-page-actor-allocation-fails/20260927-130541
base:   
patch link:    https://lore.kernel.org/r/202609280655.spyNjO2a-lkp%40intel.com
config: x86_64-randconfig-1003-20260928 (https://download.01.org/0day-ci/archive/20260928/202609280655.spyNjO2a-lkp@intel.com/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
rustc: rustc 1.96.0 (ac68faa20 2026-05-25)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260928/202609280655.spyNjO2a-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609280655.spyNjO2a-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/squashfs/file_direct.c:121:1: warning: unused label 'out' [-Wunused-label]
     121 | out:
         | ^~~~
   1 warning generated.


vim +/out +121 fs/squashfs/file_direct.c

0d455c12c642864 Phillip Lougher         2013-11-13   20  
0d455c12c642864 Phillip Lougher         2013-11-13   21  /* Read separately compressed datablock directly into page cache */
2a7aea59cf4dd4a Matthew Wilcox (Oracle  2024-12-20   22) int squashfs_readpage_block(struct folio *folio, u64 block, int bsize,
a3f94cb99a854fa Phillip Lougher         2018-08-02   23  		int expected)
0d455c12c642864 Phillip Lougher         2013-11-13   24  {
2a7aea59cf4dd4a Matthew Wilcox (Oracle  2024-12-20   25) 	struct page *target_page = &folio->page;
2a7aea59cf4dd4a Matthew Wilcox (Oracle  2024-12-20   26) 	struct inode *inode = folio->mapping->host;
0d455c12c642864 Phillip Lougher         2013-11-13   27  	struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
12427de9439d68b Phillip Lougher         2023-11-13   28  	loff_t file_end = (i_size_read(inode) - 1) >> PAGE_SHIFT;
09cbfeaf1a5a67b Kiryl Shutsemau         2016-04-01   29  	int mask = (1 << (msblk->block_log - PAGE_SHIFT)) - 1;
7f73fcde4d93072 Phillip Lougher         2024-08-19   30  	loff_t start_index = folio->index & ~mask;
12427de9439d68b Phillip Lougher         2023-11-13   31  	loff_t end_index = start_index | mask;
d31638ff6c5437c Phillip Lougher         2024-10-21   32  	loff_t index;
d31638ff6c5437c Phillip Lougher         2024-10-21   33  	int i, pages, bytes, res = -ENOMEM;
7f73fcde4d93072 Phillip Lougher         2024-08-19   34  	struct page **page, *last_page;
0d455c12c642864 Phillip Lougher         2013-11-13   35  	struct squashfs_page_actor *actor;
0d455c12c642864 Phillip Lougher         2013-11-13   36  	void *pageaddr;
0d455c12c642864 Phillip Lougher         2013-11-13   37  
0d455c12c642864 Phillip Lougher         2013-11-13   38  	if (end_index > file_end)
0d455c12c642864 Phillip Lougher         2013-11-13   39  		end_index = file_end;
0d455c12c642864 Phillip Lougher         2013-11-13   40  
0d455c12c642864 Phillip Lougher         2013-11-13   41  	pages = end_index - start_index + 1;
0d455c12c642864 Phillip Lougher         2013-11-13   42  
14694888db2c1f7 Fabian Frederick        2014-08-06   43  	page = kmalloc_array(pages, sizeof(void *), GFP_KERNEL);
0d455c12c642864 Phillip Lougher         2013-11-13   44  	if (page == NULL)
0d455c12c642864 Phillip Lougher         2013-11-13   45  		return res;
0d455c12c642864 Phillip Lougher         2013-11-13   46  
0d455c12c642864 Phillip Lougher         2013-11-13   47  	/* Try to grab all the pages covered by the Squashfs block */
d31638ff6c5437c Phillip Lougher         2024-10-21   48  	for (i = 0, index = start_index; index <= end_index; index++) {
d31638ff6c5437c Phillip Lougher         2024-10-21   49  		page[i] = (index == folio->index) ? target_page :
2a7aea59cf4dd4a Matthew Wilcox (Oracle  2024-12-20   50) 			grab_cache_page_nowait(folio->mapping, index);
0d455c12c642864 Phillip Lougher         2013-11-13   51  
1bb1a07afad9730 Phillip Lougher         2022-06-11   52  		if (page[i] == NULL)
0d455c12c642864 Phillip Lougher         2013-11-13   53  			continue;
0d455c12c642864 Phillip Lougher         2013-11-13   54  
0d455c12c642864 Phillip Lougher         2013-11-13   55  		if (PageUptodate(page[i])) {
0d455c12c642864 Phillip Lougher         2013-11-13   56  			unlock_page(page[i]);
09cbfeaf1a5a67b Kiryl Shutsemau         2016-04-01   57  			put_page(page[i]);
1bb1a07afad9730 Phillip Lougher         2022-06-11   58  			continue;
0d455c12c642864 Phillip Lougher         2013-11-13   59  		}
0d455c12c642864 Phillip Lougher         2013-11-13   60  
1bb1a07afad9730 Phillip Lougher         2022-06-11   61  		i++;
0d455c12c642864 Phillip Lougher         2013-11-13   62  	}
0d455c12c642864 Phillip Lougher         2013-11-13   63  
1bb1a07afad9730 Phillip Lougher         2022-06-11   64  	pages = i;
1bb1a07afad9730 Phillip Lougher         2022-06-11   65  
f268eedddf3595e Phillip Lougher         2022-06-11   66  	/*
f268eedddf3595e Phillip Lougher         2022-06-11   67  	 * Create a "page actor" which will kmap and kunmap the
f268eedddf3595e Phillip Lougher         2022-06-11   68  	 * page cache pages appropriately within the decompressor
f268eedddf3595e Phillip Lougher         2022-06-11   69  	 */
2258e22f05aff58 Phillip Lougher         2024-08-19   70  	actor = squashfs_page_actor_init_special(msblk, page, pages, expected,
2258e22f05aff58 Phillip Lougher         2024-08-19   71  						start_index << PAGE_SHIFT);
f268eedddf3595e Phillip Lougher         2022-06-11   72  	if (actor == NULL)
3d998ec2d6828d8 Nguyen Ngoc Thang       2026-09-27   73  		goto mark_errored;
f268eedddf3595e Phillip Lougher         2022-06-11   74  
0d455c12c642864 Phillip Lougher         2013-11-13   75  	/* Decompress directly into the page cache buffers */
0d455c12c642864 Phillip Lougher         2013-11-13   76  	res = squashfs_read_data(inode->i_sb, block, bsize, NULL, actor);
f268eedddf3595e Phillip Lougher         2022-06-11   77  
7f73fcde4d93072 Phillip Lougher         2024-08-19   78  	last_page = squashfs_page_actor_free(actor);
f268eedddf3595e Phillip Lougher         2022-06-11   79  
0d455c12c642864 Phillip Lougher         2013-11-13   80  	if (res < 0)
0d455c12c642864 Phillip Lougher         2013-11-13   81  		goto mark_errored;
0d455c12c642864 Phillip Lougher         2013-11-13   82  
84e0e03b308816a Phillip Lougher         2024-08-23   83  	if (res != expected || IS_ERR(last_page)) {
a3f94cb99a854fa Phillip Lougher         2018-08-02   84  		res = -EIO;
a3f94cb99a854fa Phillip Lougher         2018-08-02   85  		goto mark_errored;
a3f94cb99a854fa Phillip Lougher         2018-08-02   86  	}
a3f94cb99a854fa Phillip Lougher         2018-08-02   87  
1bb1a07afad9730 Phillip Lougher         2022-06-11   88  	/* Last page (if present) may have trailing bytes not filled */
09cbfeaf1a5a67b Kiryl Shutsemau         2016-04-01   89  	bytes = res % PAGE_SIZE;
7f73fcde4d93072 Phillip Lougher         2024-08-19   90  	if (end_index == file_end && last_page && bytes) {
7f73fcde4d93072 Phillip Lougher         2024-08-19   91  		pageaddr = kmap_local_page(last_page);
09cbfeaf1a5a67b Kiryl Shutsemau         2016-04-01   92  		memset(pageaddr + bytes, 0, PAGE_SIZE - bytes);
1bb1a07afad9730 Phillip Lougher         2022-06-11   93  		kunmap_local(pageaddr);
0d455c12c642864 Phillip Lougher         2013-11-13   94  	}
0d455c12c642864 Phillip Lougher         2013-11-13   95  
0d455c12c642864 Phillip Lougher         2013-11-13   96  	/* Mark pages as uptodate, unlock and release */
0d455c12c642864 Phillip Lougher         2013-11-13   97  	for (i = 0; i < pages; i++) {
0d455c12c642864 Phillip Lougher         2013-11-13   98  		flush_dcache_page(page[i]);
0d455c12c642864 Phillip Lougher         2013-11-13   99  		SetPageUptodate(page[i]);
0d455c12c642864 Phillip Lougher         2013-11-13  100  		unlock_page(page[i]);
0d455c12c642864 Phillip Lougher         2013-11-13  101  		if (page[i] != target_page)
09cbfeaf1a5a67b Kiryl Shutsemau         2016-04-01  102  			put_page(page[i]);
0d455c12c642864 Phillip Lougher         2013-11-13  103  	}
0d455c12c642864 Phillip Lougher         2013-11-13  104  
0d455c12c642864 Phillip Lougher         2013-11-13  105  	kfree(page);
0d455c12c642864 Phillip Lougher         2013-11-13  106  
0d455c12c642864 Phillip Lougher         2013-11-13  107  	return 0;
0d455c12c642864 Phillip Lougher         2013-11-13  108  
0d455c12c642864 Phillip Lougher         2013-11-13  109  mark_errored:
bbf45b7e6855556 Matthew Wilcox (Oracle  2024-04-20  110) 	/* Decompression failed.  Target_page is
0d455c12c642864 Phillip Lougher         2013-11-13  111  	 * dealt with by the caller
0d455c12c642864 Phillip Lougher         2013-11-13  112  	 */
0d455c12c642864 Phillip Lougher         2013-11-13  113  	for (i = 0; i < pages; i++) {
6d565409503f4e1 Phillip Lougher         2013-11-24  114  		if (page[i] == NULL || page[i] == target_page)
0d455c12c642864 Phillip Lougher         2013-11-13  115  			continue;
0d455c12c642864 Phillip Lougher         2013-11-13  116  		flush_dcache_page(page[i]);
0d455c12c642864 Phillip Lougher         2013-11-13  117  		unlock_page(page[i]);
09cbfeaf1a5a67b Kiryl Shutsemau         2016-04-01  118  		put_page(page[i]);
0d455c12c642864 Phillip Lougher         2013-11-13  119  	}
0d455c12c642864 Phillip Lougher         2013-11-13  120  
0d455c12c642864 Phillip Lougher         2013-11-13 @121  out:

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

       reply	other threads:[~2026-09-27 22:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27 22:21 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-09-27 19:52 squashfs: fix leaked page locks when page actor allocation fails kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202609280655.spyNjO2a-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.