Re: [syzbot] [kernel?] linux-next test error: KASAN: slab-use-after-free Write in binder_add_device

From: Carlos Llamas
Date: Thu Jan 23 2025 - 11:49:34 EST


On Thu, Jan 23, 2025 at 01:32:29PM +0100, Aleksandr Nogikh wrote:
> The problem began to appear after:
>
> commit 12d909cac1e1c4147cc3417fee804ee12fc6b984
> Author: Li Li <dualli@xxxxxxxxxx>
> Date: Wed Dec 18 13:29:34 2024 -0800
>
> binderfs: add new binder devices to binder_devices
>

Correct. I tried to mark this commit with a #syz blame or something but
I couldn't find anything. The problem here is we add binderfs devices to
the binder_devices list but we don't remove them when these are kfreed
e.g. during umount.

This is then fairly easy to reproduce, something like:
$ mount -t binder binder /dev/binderfs
$ umount /dev/binderfs
$ mount -t binder binder /dev/binderfs

It should be a simply fix. I'll send a patch later today.

Thanks,
--
Carlos Llamas