summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJiasheng Jiang <jiasheng@iscas.ac.cn>2021-12-15 11:36:05 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-12-29 14:28:37 +0300
commitb1712a691bbb1d178dcf1cb592b5746d13fb7d49 (patch)
tree44209bb29ff5c9d92f6c38a370714c3c9c369935 /drivers
parent3c431e19ad708475a6fad071934a7bb786d24319 (diff)
downloadlinux-b1712a691bbb1d178dcf1cb592b5746d13fb7d49.tar.xz
HID: potential dereference of null pointer
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@vger.kernel.org Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20211215083605.117638-1-jiasheng@iscas.ac.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hid/hid-vivaldi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hid/hid-vivaldi.c b/drivers/hid/hid-vivaldi.c
index cd7ada48b1d9..72957a9f7117 100644
--- a/drivers/hid/hid-vivaldi.c
+++ b/drivers/hid/hid-vivaldi.c
@@ -57,6 +57,9 @@ static int vivaldi_probe(struct hid_device *hdev,
int ret;
drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL);
+ if (!drvdata)
+ return -ENOMEM;
+
hid_set_drvdata(hdev, drvdata);
ret = hid_parse(hdev);