Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932195AbdLOOxf (ORCPT ); Fri, 15 Dec 2017 09:53:35 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:51225 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932136AbdLOOxd (ORCPT ); Fri, 15 Dec 2017 09:53:33 -0500 From: Fabien DESSENNE To: Jia-Ju Bai , "mchehab@kernel.org" CC: "linux-media@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Benjamin GAIGNARD" , Hans Verkuil Subject: Re: [PATCH 2/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_save_request Thread-Topic: [PATCH 2/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_save_request Thread-Index: AQHTc096Oz7PfbaQrEOP5ReQX1gYnaNEcYqA Date: Fri, 15 Dec 2017 14:53:27 +0000 Message-ID: <489e7b01-a484-1c13-554f-fc32cdbf9bc7@st.com> References: <1513086458-29304-1-git-send-email-baijiaju1990@gmail.com> In-Reply-To: <1513086458-29304-1-git-send-email-baijiaju1990@gmail.com> Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.75.127.50] Content-Type: text/plain; charset="utf-8" Content-ID: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-15_06:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id vBFErgXd020481 Content-Length: 1189 Lines: 37 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 Reviewed-by: Fabien Dessenne > --- > 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; > }