[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211227151331.778935576@linuxfoundation.org>
Date: Mon, 27 Dec 2021 16:29:43 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>
Subject: [PATCH 5.15 008/128] HID: potential dereference of null pointer
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
commit 13251ce1dd9bb525da2becb9b26fdfb94ca58659 upstream.
The return value of devm_kzalloc() needs to be checked.
To avoid hdev->dev->driver_data to be null in case of the failure of
alloc.
Fixes: 14c9c014babe ("HID: add vivaldi HID driver")
Cc: stable@...r.kernel.org
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@...hat.com>
Link: https://lore.kernel.org/r/20211215083605.117638-1-jiasheng@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/hid/hid-vivaldi.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/hid/hid-vivaldi.c
+++ b/drivers/hid/hid-vivaldi.c
@@ -57,6 +57,9 @@ static int vivaldi_probe(struct hid_devi
int ret;
drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL);
+ if (!drvdata)
+ return -ENOMEM;
+
hid_set_drvdata(hdev, drvdata);
ret = hid_parse(hdev);
Powered by blists - more mailing lists