From: Chang Yu <marcus.yu.56@gmail.com>
To: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Chang Yu <marcus.yu.56@gmail.com>,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org, syzkaller-bugs@googlegroups.com,
syzbot <syzbot+3e563d99e70973c0755c@syzkaller.appspotmail.com>
Subject: Re: [syzbot] [usb?] KASAN: invalid-free in dev_free
Date: Fri, 1 Nov 2024 16:44:22 -0700 [thread overview]
Message-ID: <ZyVn1tNVntbykOuG@gmail.com> (raw)
In-Reply-To: <CA+fCnZd2b70N6nXTyWO2UYivh_U7Wey==XWURpFy7B_x8xEFHQ@mail.gmail.com>
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@syzkaller.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!
next prev parent reply other threads:[~2024-11-01 23:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 20:25 [syzbot] [usb?] KASAN: invalid-free in dev_free syzbot
2024-09-16 1:24 ` syzbot
2024-11-01 23:26 ` Andrey Konovalov
2024-11-01 23:44 ` Chang Yu [this message]
2024-11-24 20:29 ` Andrey Konovalov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZyVn1tNVntbykOuG@gmail.com \
--to=marcus.yu.56@gmail.com \
--cc=andreyknvl@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=syzbot+3e563d99e70973c0755c@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).