From: Dan Carpenter <error27@gmail.com>
To: "Omar Yiğitcan Mengü" <menguomary@gmail.com>
Cc: Viresh Kumar <vireshk@kernel.org>,
Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH v2] staging: greybus: bootrom: keep fw->size access under bootrom->mutex
Date: Sat, 5 Dec 2026 14:29:52 +0300 [thread overview]
Message-ID: <axP1sImQYkYt2V6p@stanley.mountain> (raw)
In-Reply-To: <20261204182529.428-1-menguomary@gmail.com>
On Fri, Dec 04, 2026 at 09:25:29PM +0300, Omar Yiğitcan Mengü wrote:
> bootrom->mutex is documented to protect bootrom->fw, but
> gb_bootrom_get_firmware() dereferences fw->size after releasing
> bootrom->mutex when selecting the next expected request type. This
> breaks the locking invariant for bootrom->fw and also triggers a
> Coccinelle deref_null.cocci error on the error-exit path where fw is
> NULL.
>
> Initialize next_request to NEXT_REQ_GET_FIRMWARE and evaluate
> offset + size == fw->size while still holding bootrom->mutex.
>
> Signed-off-by: Omar Yiğitcan Mengü <menguomary@gmail.com>
> ---
>
> Changes in v2:
> - Resend using git send-email to avoid line wrapping.
Thanks!
Reviewed-by: Dan Carpenter <error27@gmail.com>
Btw, I think we added an annotation for Clang which says certain pointers
can only be dereferenced when we're holding the lock? You could look at
adding that annotation here.
regards,
dan carpenter
prev parent reply other threads:[~2026-12-05 11:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 18:25 [PATCH v2] staging: greybus: bootrom: keep fw->size access under bootrom->mutex Omar Yiğitcan Mengü
2026-12-05 11:29 ` Dan Carpenter [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=axP1sImQYkYt2V6p@stanley.mountain \
--to=error27@gmail.com \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=menguomary@gmail.com \
--cc=vireshk@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