Skip to contentSkip to conversation

fs/squashfs/page_actor.h:41 squashfs_page_actor_free() error: dereferencing freed memory 'actor'

PATCH New Dan Carpenter 1 participant 1 message Aug 22, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 5650/6069 fs/squashfs/page_actor.h:41 squashfs_page_actor_free() error: dereferencing freed memory 'actor'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   6a7917c89f219f09b1d88d09f376000914a52763
commit: 5d85f9c952d85a26e1a8c7c985b67963b483cabc [5650/6069] Squashfs: Ensure all readahead pages have been used
config: i386-randconfig-141-20240822 (https://download.01.org/0day-ci/archive/20240822/[email protected]/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)

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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
fs/squashfs/page_actor.h:41 squashfs_page_actor_free() error: dereferencing freed memory 'actor'

vim +/actor +41 fs/squashfs/page_actor.h

f268eedddf3595 Phillip Lougher 2022-06-11  28  extern struct squashfs_page_actor *squashfs_page_actor_init(void **buffer,
f268eedddf3595 Phillip Lougher 2022-06-11  29  				int pages, int length);
f268eedddf3595 Phillip Lougher 2022-06-11  30  extern struct squashfs_page_actor *squashfs_page_actor_init_special(
f268eedddf3595 Phillip Lougher 2022-06-11  31  				struct squashfs_sb_info *msblk,
2258e22f05aff5 Phillip Lougher 2024-08-19  32  				struct page **page, int pages, int length,
2258e22f05aff5 Phillip Lougher 2024-08-19  33  				loff_t start_index);
9ef8eb6104527b Phillip Lougher 2022-10-20  34  static inline struct page *squashfs_page_actor_free(struct squashfs_page_actor *actor)
1f13dff09ffc8b Phillip Lougher 2022-08-22  35  {
9ef8eb6104527b Phillip Lougher 2022-10-20  36  	struct page *last_page = actor->last_page;
9ef8eb6104527b Phillip Lougher 2022-10-20  37  
1f13dff09ffc8b Phillip Lougher 2022-08-22  38  	kfree(actor->tmp_buffer);
1f13dff09ffc8b Phillip Lougher 2022-08-22  39  	kfree(actor);
                                                ^^^^^^^^^^^^

5d85f9c952d85a Phillip Lougher 2024-08-21 40
5d85f9c952d85a Phillip Lougher 2024-08-21 @41 if (actor->next_page == actor->pages)

                                                    ^^^^^^^^^^^^^^^^    ^^^^^^^^^^^^

Use after free.

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