[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZyVn1tNVntbykOuG@gmail.com>
Date: Fri, 1 Nov 2024 16:44:22 -0700
From: Chang Yu <marcus.yu.56@...il.com>
To: Andrey Konovalov <andreyknvl@...il.com>
Cc: Chang Yu <marcus.yu.56@...il.com>, 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 Sat, Nov 02, 2024 at 12:26:30AM +0100, Andrey Konovalov wrote:
> 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
Hi Andrey,
Thank you for the acknowledgement! I realized that patch was incorrect
too which is why I haven't sent it out yet. I'll continue to look into
it. I'll keep you posted if I find a solution.
Thanks!
Powered by blists - more mailing lists