mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fabien DESSENNE <fabien.dessenne@st.com>
To: Jia-Ju Bai <baijiaju1990@gmail.com>,
	"mchehab@kernel.org" <mchehab@kernel.org>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Benjamin GAIGNARD" <benjamin.gaignard@st.com>,
	Hans Verkuil <hverkuil@xs4all.nl>
Subject: Re: [PATCH 2/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_save_request
Date: Fri, 15 Dec 2017 14:53:27 +0000	[thread overview]
Message-ID: <489e7b01-a484-1c13-554f-fc32cdbf9bc7@st.com> (raw)
In-Reply-To: <1513086458-29304-1-git-send-email-baijiaju1990@gmail.com>

Hi


Thank you for the patch.


On 12/12/17 14:47, Jia-Ju Bai wrote:
> The driver may sleep under a spinlock.
> The function call path is:
> bdisp_device_run (acquire the spinlock)
>    bdisp_hw_update
>      bdisp_hw_save_request
>        devm_kzalloc(GFP_KERNEL) --> may sleep
>
> To fix it, GFP_KERNEL is replaced with GFP_ATOMIC.
>
> This bug is found by my static analysis tool(DSAC) and checked by my code review.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
> ---
>   drivers/media/platform/sti/bdisp/bdisp-hw.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c b/drivers/media/platform/sti/bdisp/bdisp-hw.c
> index 4b62ceb..7b45b43 100644
> --- a/drivers/media/platform/sti/bdisp/bdisp-hw.c
> +++ b/drivers/media/platform/sti/bdisp/bdisp-hw.c
> @@ -1064,7 +1064,7 @@ static void bdisp_hw_save_request(struct bdisp_ctx *ctx)
>   		if (!copy_node[i]) {
>   			copy_node[i] = devm_kzalloc(ctx->bdisp_dev->dev,
>   						    sizeof(*copy_node[i]),
> -						    GFP_KERNEL);
> +						    GFP_ATOMIC);
>   			if (!copy_node[i])
>   				return;
>   		}

      reply	other threads:[~2017-12-15 14:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12 13:47 Jia-Ju Bai
2017-12-15 14:53 ` Fabien DESSENNE [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=489e7b01-a484-1c13-554f-fc32cdbf9bc7@st.com \
    --to=fabien.dessenne@st.com \
    --cc=baijiaju1990@gmail.com \
    --cc=benjamin.gaignard@st.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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

all inboxes | Powered by JetHome®