Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Doug Anderson <dianders@chromium.org>
Cc: Johan Hovold <johan+linaro@kernel.org>,
	Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] HID: i2c-hid-of: fix NULL-deref on failed power up
Date: Thu, 1 Feb 2024 10:55:51 +0100	[thread overview]
Message-ID: <Zbtqp1wgHI0LSSaE@hovoldconsulting.com> (raw)
In-Reply-To: <CAD=FV=UzGcneoL1d-DDXVugAeq2+YLCKrq8-5B7TfVAAKgF=SQ@mail.gmail.com>

On Fri, Jan 26, 2024 at 09:47:23AM -0800, Doug Anderson wrote:
> On Fri, Jan 26, 2024 at 9:10 AM Johan Hovold <johan+linaro@kernel.org> wrote:

> > A while back the I2C HID implementation was split in an ACPI and OF
> > part, but the new OF driver never initialises the client pointer which
> > is dereferenced on power-up failures.

> Good catch and thanks for the fix. FWIW, I'd be OK w/
> 
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> 
> That being said, I'd be even happier if you simply removed the
> "client" from the structure and removed the error printout.
> regulator_bulk_enable() already prints error messages when a failure
> happens and thus the error printout is redundant and wastes space.

True, but that error message does not include the device that tried to
use the regulator.

I actually hit this when adding dev_dbg() to the function in question.
For such cases, it's also convenient to have struct device easily
accessible so I think it should be ok to just leave this pointer in.

Johan

      parent reply	other threads:[~2024-02-01  9:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-26 17:09 [PATCH] HID: i2c-hid-of: fix NULL-deref on failed power up Johan Hovold
2024-01-26 17:47 ` Doug Anderson
2024-01-26 17:53   ` Jiri Kosina
2024-02-01  9:55   ` Johan Hovold [this message]

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=Zbtqp1wgHI0LSSaE@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=benjamin.tissoires@redhat.com \
    --cc=dianders@chromium.org \
    --cc=jikos@kernel.org \
    --cc=johan+linaro@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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