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: <20200921113039.GA19862@duo.ucw.cz>
Date:   Mon, 21 Sep 2020 13:30:39 +0200
From:   Pavel Machek <pavel@...x.de>
To:     gregkh@...uxfoundation.org, stern@...land.harvard.edu,
        kai.heng.feng@...onical.com, johan@...nel.org,
        tomasz@...esinski.eu, jonathan@...ox.net, kerneldev@...smulder.nl,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] USB: quirks: simplify quirk handling.

Simplify quirk handling.

Signed-off-by: Pavel Machek (CIP) <pavel@...x.de>

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index f232914de5fd..167b6ac428a3 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -56,18 +56,13 @@ static int quirks_param_set(const char *value, const struct kernel_param *kp)
 		if (val[i] == ',')
 			quirk_count++;
 
-	if (quirk_list) {
-		kfree(quirk_list);
-		quirk_list = NULL;
-	}
-
+	kfree(quirk_list);
 	quirk_list = kcalloc(quirk_count, sizeof(struct quirk_entry),
 			     GFP_KERNEL);
 	if (!quirk_list) {
 		quirk_count = 0;
-		mutex_unlock(&quirk_mutex);
-		kfree(val);
-		return -ENOMEM;
+		err = -ENOMEM;
+		goto unlock;
 	}
 
 	for (i = 0, p = val; p && *p;) {
@@ -153,7 +148,7 @@ static int quirks_param_set(const char *value, const struct kernel_param *kp)
 	mutex_unlock(&quirk_mutex);
 	kfree(val);
 
-	return 0;
+	return err;
 }
 
 static const struct kernel_param_ops quirks_param_ops = {

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ