Re: [PATCH v2 1/2] mm,page_owner: Fix refcount imbalance

From: Tetsuo Handa
Date: Wed Mar 20 2024 - 05:43:05 EST


On 2024/03/20 14:49, Oscar Salvador wrote:
> This should have the follwing on top:
>
> diff --git a/mm/page_owner.c b/mm/page_owner.c
> index 2613805cb665..e477a71d6adc 100644
> --- a/mm/page_owner.c
> +++ b/mm/page_owner.c
> @@ -222,8 +222,11 @@ static void dec_stack_record_count(depot_stack_handle_t handle,
> {
> struct stack_record *stack_record = __stack_depot_get_stack_record(handle);
>
> - if (stack_record)
> - refcount_sub_and_test(nr_base_pages, &stack_record->count);
> + if (!stack_record)
> + return;
> +
> + if (refcount_sub_and_test(nr_base_pages, &stack_record->count))
> + WARN(1, "%s refcount went to 0 for %u handle\n", __func__, handle);
> }
>
>

That fixed this problem. Thank you.

-------- Forwarded Message --------
Date: Wed, 20 Mar 2024 01:31:03 -0700
In-Reply-To: <4362246e-d804-43de-800b-a7840b70919a@xxxxxxxxxxxxxxxxxxx>
Message-ID: <000000000000410e3b061413692b@xxxxxxxxxx>
Subject: Re: [syzbot] [mm?] WARNING: refcount bug in __reset_page_owner
From: syzbot <syzbot+98c1a1753a0731df2dd4@xxxxxxxxxxxxxxxxxxxxxxxxx>
To: linux-kernel@xxxxxxxxxxxxxxx, penguin-kernel@xxxxxxxxxxxxxxxxxxx, syzkaller-bugs@xxxxxxxxxxxxxxxx

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+98c1a1753a0731df2dd4@xxxxxxxxxxxxxxxxxxxxxxxxx

Tested on:

commit: a4145ce1 Merge tag 'bcachefs-2024-03-19' of https://ev..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=131b1d66180000
kernel config: https://syzkaller.appspot.com/x/.config?x=9f47e8dfa53b0b11
dashboard link: https://syzkaller.appspot.com/bug?extid=98c1a1753a0731df2dd4
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=13972985180000

Note: testing is done by a robot and is best-effort only.