From: Greg KH <gregkh@linuxfoundation.org>
To: Chaitanya Mishra <chaitanyamishra.ai@gmail.com>
Cc: rmfrfs@gmail.com, johan@kernel.org, elder@kernel.org,
greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: greybus: lights: avoid NULL deref
Date: Thu, 8 Jan 2026 12:17:18 +0100 [thread overview]
Message-ID: <2026010824-debtless-junior-4d18@gregkh> (raw)
In-Reply-To: <20260108110351.27771-1-chaitanyamishra.ai@gmail.com>
On Thu, Jan 08, 2026 at 04:33:51PM +0530, Chaitanya Mishra wrote:
> Hi Greg,
>
> Found by manual code review while walking the error paths in
> Gb_lights_light_config(): channels_count is set before channels
> allocation, but cleanup uses channels_count to iterate and dereference
> light->channels. If kcalloc() fails, that becomes a NULL deref.
Might I ask why are you manually reviewing the error code paths of this
driver? Do you have this hardware somewhere?
> Fix is simply deferring channels_count publication until after the
> allocation succeeds; v2 includes the requested comment.
>
> Tested with:
> ./scripts/checkpatch.pl --strict -g HEAD
> ./scripts/checkpatch.pl outgoing/0001-staging-greybus-lights-avoid-NULL-deref.patch
>
> I couldn't build-test locally on macOS due to missing <elf.h> for
> kernel host tools.
For obvious reasons, sending out patches that you didn't even build test
is probably not a good idea :)
thanks,
greg k-h
next prev parent reply other threads:[~2026-01-08 11:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 10:37 [PATCH] staging: greybus: lights: avoid NULL deref Chaitanya Mishra
2026-01-08 10:46 ` Greg KH
2026-01-08 10:49 ` [PATCH v2] " Chaitanya Mishra
2026-01-08 11:01 ` Greg KH
2026-01-08 11:03 ` Chaitanya Mishra
2026-01-08 11:17 ` Greg KH [this message]
2026-01-08 11:05 ` Rui Miguel Silva
2026-01-08 11:07 ` [PATCH v3] " Chaitanya Mishra
2026-01-08 11:09 ` Chaitanya Mishra
2026-01-08 11:18 ` Greg KH
2026-01-08 11:23 ` Chaitanya Mishra
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=2026010824-debtless-junior-4d18@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=chaitanyamishra.ai@gmail.com \
--cc=elder@kernel.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=rmfrfs@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.