From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: syzbot <syzbot+bdfb03b1ec8b342c12cb@syzkaller.appspotmail.com>,
hdanton@sina.com
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
rafael@kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [kernel?] general protection fault in nfc_register_device
Date: Mon, 28 Aug 2023 17:43:43 +0300 [thread overview]
Message-ID: <ZOyyn+5I5sYt/Udj@smile.fi.intel.com> (raw)
In-Reply-To: <ZOyWNNNjnClWlUQg@smile.fi.intel.com>
On Mon, Aug 28, 2023 at 03:42:28PM +0300, Andy Shevchenko wrote:
> On Mon, Aug 28, 2023 at 02:35:22PM +0300, Andy Shevchenko wrote:
> > On Mon, Aug 28, 2023 at 02:53:37AM -0700, syzbot wrote:
> > > Hello,
> > >
> > > syzbot found the following issue on:
> >
> > Thanks! Will work on it ASAP.
>
> So, can somebody from syzbot explain me what this is?
>
> My readings as follows:
> 1) syzbot inserts fault injection into
>
> dev_set_name(&dev->dev, "nfc%d", dev->idx);
>
> 2) that becomes a NULL in the corresponding kobj->name, correct?
> 3) which leads to the device_add() to exercise the paths that check for name
> being NULL, i.e.
>
> if (dev->init_name) {
> error = dev_set_name(dev, "%s", dev->init_name);
> dev->init_name = NULL;
> }
>
> if (dev_name(dev))
> error = 0;
> /* subsystems can specify simple device enumeration */
> else if (dev->bus && dev->bus->dev_name)
> error = dev_set_name(dev, "%s%u", dev->bus->dev_name, dev->id);
> if (error)
> goto name_error;
>
> so, either we have init_name or bus->name defined, but this seems not
> the case; anyway in both cases the dev_set_name() may fail in strchr()
> if and only if the fmt is NULL, which is not, as above calls have it
> hard coded literals.
>
> What's going on here?
>
> (The error check for dev_set_name() in nfc_allocate_device() probably fixes
> this, but it must not affect the code execution, right?)
>
> P.S.
> Of course the test patch from hdanton@ doesn't fix it, the error is checked in
> the code later on.
Looking at the second patch from @hdanton I understand what may have happened.
The value of "error" has been rewritten to 0 and dev_name() the new code
doesn't trigger the bail out.
I'll send the patch soon.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-08-28 14:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-28 9:53 syzbot
2023-08-28 11:35 ` Andy Shevchenko
2023-08-28 12:42 ` Andy Shevchenko
2023-08-28 14:43 ` Andy Shevchenko [this message]
[not found] <20230828105904.3914-1-hdanton@sina.com>
2023-08-28 11:35 ` syzbot
[not found] <20230828123545.4106-1-hdanton@sina.com>
2023-08-28 13:10 ` syzbot
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=ZOyyn+5I5sYt/Udj@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=syzbot+bdfb03b1ec8b342c12cb@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
all inboxes | Powered by JetHome®