[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+fCnZd2b70N6nXTyWO2UYivh_U7Wey==XWURpFy7B_x8xEFHQ@mail.gmail.com>
Date: Sat, 2 Nov 2024 00:26:30 +0100
From: Andrey Konovalov <andreyknvl@...il.com>
To: Chang Yu <marcus.yu.56@...il.com>
Cc: gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org, syzkaller-bugs@...glegroups.com,
syzbot <syzbot+3e563d99e70973c0755c@...kaller.appspotmail.com>
Subject: Re: [syzbot] [usb?] KASAN: invalid-free in dev_free
On Mon, Sep 16, 2024 at 3:24 AM syzbot
<syzbot+3e563d99e70973c0755c@...kaller.appspotmail.com> wrote:
>
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 68d4209158f4 sub: cdns3: Use predefined PCI vendor ID cons..
> git tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
> console output: https://syzkaller.appspot.com/x/log.txt?x=10a96200580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=cb61872d4d8c5df9
> dashboard link: https://syzkaller.appspot.com/bug?extid=3e563d99e70973c0755c
> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1297cc07980000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1217c8a9980000
Hi Chang,
I saw your patch testing request for this bug [1] (thank you for
looking into it!), but your patch doesn't appear correct to me, even
though it did satisfy syzbot. One issue that I see with the patch is
calling spin_unlock_irqrestore(&dev->lock) after
kref_put(&dev->count): kref_put() might free the device struct and
spin_unlock_irqrestore() will then do a UAF.
I'm not sure what the correct patch would be though, as I don't
understand what the issue is. It seems that dev_free() indeed gets
called twice, but since it's guarded by kref_put(), this shouldn't
happen AFAIU. Or at least we should get a bad refcount report.
Thanks!
[1] https://lore.kernel.org/all/6721d497.050a0220.35b515.0001.GAE@google.com/T/#mca35ec73d63ff30d7219b6739ed0801688f15f35
Powered by blists - more mailing lists