lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211029031043.3330240-1-yangyingliang@huawei.com>
Date:   Fri, 29 Oct 2021 11:10:43 +0800
From:   Yang Yingliang <yangyingliang@...wei.com>
To:     <linux-kernel@...r.kernel.org>, <linux-input@...r.kernel.org>
CC:     <benjamin.tissoires@...hat.com>, <jikos@...nel.org>,
        <djogorchock@...il.com>
Subject: [PATCH -next] HID: nintendo: fix missing unlock on error in joycon_leds_create()

Add the missing unlock before return from function joycon_leds_create()
in the error handling case.

Reported-by: Hulk Robot <hulkci@...wei.com>
Fixes: c5e626769563 ("HID: nintendo: add player led support")
Fixes: 697e5c7a34b0 ("HID: nintendo: add home led support")
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
 drivers/hid/hid-nintendo.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c
index c4270499fc6f..ddfb001a8fc9 100644
--- a/drivers/hid/hid-nintendo.c
+++ b/drivers/hid/hid-nintendo.c
@@ -1850,8 +1850,10 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr)
 				      d_name,
 				      "green",
 				      joycon_player_led_names[i]);
-		if (!name)
-			return -ENOMEM;
+		if (!name) {
+			ret = -ENOMEM;
+			goto err_unlock;
+		}
 
 		led = &ctlr->leds[i];
 		led->name = name;
@@ -1864,7 +1866,7 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr)
 		ret = devm_led_classdev_register(&hdev->dev, led);
 		if (ret) {
 			hid_err(hdev, "Failed registering %s LED\n", led->name);
-			return ret;
+			goto err_unlock;
 		}
 	}
 
@@ -1902,6 +1904,10 @@ static int joycon_leds_create(struct joycon_ctlr *ctlr)
 	}
 
 	return 0;
+
+err_unlock:
+	mutex_unlock(&joycon_input_num_mutex);
+	return ret;
 }
 
 static int joycon_battery_get_property(struct power_supply *supply,
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ