[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1ZE3UIEB0O2B6.2GHX7WO8NQZUJ@homearch.localdomain>
Date: Sat, 26 Feb 2022 15:14:14 +0100
From: "Silvan Jegen" <s.jegen@...il.com>
To: Jia-Ju Bai <baijiaju1990@...il.com>
Cc: djogorchock@...il.com, jikos@...nel.org,
benjamin.tissoires@...hat.com, linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hid: hid-nintendo: check the return value of
alloc_workqueue()
Hi
Jia-Ju Bai <baijiaju1990@...il.com> wrote:
> The function alloc_workqueue() in nintendo_hid_probe() can fail, but
> there is no check of its return value. To fix this bug, its return value
> should be checked with new error handling code.
>
> Fixes: c4eae84feff3e ("HID: nintendo: add rumble support")
> Reported-by: TOTE Robot <oslab@...nghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
> ---
> drivers/hid/hid-nintendo.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
> index b6a9a0f3966e..2204de889739 100644
> --- a/drivers/hid/hid-nintendo.c
> +++ b/drivers/hid/hid-nintendo.c
> @@ -2128,6 +2128,10 @@ static int nintendo_hid_probe(struct hid_device *hdev,
> spin_lock_init(&ctlr->lock);
> ctlr->rumble_queue = alloc_workqueue("hid-nintendo-rumble_wq",
> WQ_FREEZABLE | WQ_MEM_RECLAIM, 0);
> + if (!ctlr->rumble_queue) {
> + ret = -ENOMEM;
> + goto err;
> + }
> INIT_WORK(&ctlr->rumble_worker, joycon_rumble_worker);
>
> ret = hid_parse(hdev);
LGTM!
Reviewed-by: Silvan Jegen <s.jegen@...il.com>
Cheers,
Silvan
Powered by blists - more mailing lists