[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20241211031150.2244639-1-make_ruc2021@163.com>
Date: Wed, 11 Dec 2024 11:11:50 +0800
From: Ma Ke <make_ruc2021@....com>
To: dmitry.torokhov@...il.com,
david@...dahead.eu
Cc: linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org,
Ma Ke <make_ruc2021@....com>,
stable@...r.kernel.org
Subject: [PATCH] Input: Check dev_set_name() return value
It's possible that dev_set_name() returns -ENOMEM. We could catch and
handle it by adding dev_set_name() return value check.
Cc: stable@...r.kernel.org
Fixes: 7f8d4cad1e4e ("Input: extend the number of event (and other) devices")
Signed-off-by: Ma Ke <make_ruc2021@....com>
---
drivers/input/evdev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index b5cbb57ee5f6..c4dc280c4c49 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -1361,7 +1361,9 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
/* Normalize device number if it falls into legacy range */
if (dev_no < EVDEV_MINOR_BASE + EVDEV_MINORS)
dev_no -= EVDEV_MINOR_BASE;
- dev_set_name(&evdev->dev, "event%d", dev_no);
+ error = dev_set_name(&evdev->dev, "event%d", dev_no);
+ if (error)
+ goto err_free_minor;
evdev->handle.dev = input_get_device(dev);
evdev->handle.name = dev_name(&evdev->dev);
--
2.25.1
Powered by blists - more mailing lists