From: Nicholas Mc Guire <der.herr@hofr.at>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: stefan.wahren@i2se.com, devel@driverdev.osuosl.org,
f.fainelli@gmail.com, sbranden@broadcom.com,
tuomas.tynkkynen@iki.fi, rjui@broadcom.com, hofrat@osadl.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
tobias.buettner@fau.de, eric@anholt.net,
bcm-kernel-feedback-list@broadcom.com,
linux-rpi-kernel@lists.infradead.org, gregkh@linuxfoundation.org,
inf.braun@fau.de, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] staging: bcm2835-camera: Avoid apotential sleep while holding a spin_lock
Date: Mon, 24 Jun 2019 08:37:18 +0200 [thread overview]
Message-ID: <20190624063718.GD31913@osadl.at> (raw)
In-Reply-To: <20190624053351.5217-1-christophe.jaillet@wanadoo.fr>
On Mon, Jun 24, 2019 at 07:33:51AM +0200, Christophe JAILLET wrote:
> Do not allocate memory with GFP_KERNEL when holding a spin_lock, it may
> sleep. Use GFP_NOWAIT instead.
>
checking for this in the rest of the kernel with a cocci spatch
<snip>
virtual report
@nonatomic@
position p;
identifier var;
@@
spin_lock(...)
... when != spin_unlock(...)
* var = idr_alloc@p(...,GFP_KERNEL);
... when != spin_unlock(...)
spin_unlock(...);
<snip>
this seems to be the only instance of this specific problem.
> Fixes: 950fd867c635 ("staging: bcm2835-camera: Replace open-coded idr with a struct idr.")
The GFP_KERNEL actually was there befor this patch so not sure if this Fixes
ref is correct - I think the GFP_KERNEL was introduced in:
4e6bafdfb9f3 ("staging: bcm2835_camera: Use a mapping table for context field of mmal_msg_header")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Nicholas Mc Guire <hofrat@osadl.org>
> ---
> drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
> index 16af735af5c3..438d548c6e24 100644
> --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
> +++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
> @@ -186,7 +186,7 @@ get_msg_context(struct vchiq_mmal_instance *instance)
> */
> spin_lock(&instance->context_map_lock);
> handle = idr_alloc(&instance->context_map, msg_context,
> - 0, 0, GFP_KERNEL);
> + 0, 0, GFP_NOWAIT);
> spin_unlock(&instance->context_map_lock);
>
> if (handle < 0) {
> --
> 2.20.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-06-24 6:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-24 5:33 [PATCH] staging: bcm2835-camera: Avoid apotential sleep while holding a spin_lock Christophe JAILLET
2019-06-24 6:37 ` Nicholas Mc Guire [this message]
2019-06-24 8:13 ` Stefan Wahren
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=20190624063718.GD31913@osadl.at \
--to=der.herr@hofr.at \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=devel@driverdev.osuosl.org \
--cc=eric@anholt.net \
--cc=f.fainelli@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hofrat@osadl.org \
--cc=inf.braun@fau.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=stefan.wahren@i2se.com \
--cc=tobias.buettner@fau.de \
--cc=tuomas.tynkkynen@iki.fi \
/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).