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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230309160201.5163-38-tzimmermann@suse.de>
Date:   Thu,  9 Mar 2023 17:00:57 +0100
From:   Thomas Zimmermann <tzimmermann@...e.de>
To:     deller@....de, geert+renesas@...der.be, timur@...nel.org,
        rdunlap@...radead.org, paulus@...ba.org, benh@...nel.crashing.org,
        linux@...linux.org.uk, pjones@...hat.com, adaplas@...il.com,
        s.hauer@...gutronix.de, shawnguo@...nel.org, mbroemme@...mpq.org,
        thomas@...ischhofer.net, James.Bottomley@...senPartnership.com,
        sudipm.mukherjee@...il.com, teddy.wang@...iconmotion.com,
        corbet@....net
Cc:     linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org,
        Thomas Zimmermann <tzimmermann@...e.de>
Subject: [PATCH v2 037/101] fbdev/intelfb: Duplicate video-mode option string

Assume that the driver does not own the option string or its substrings
and hence duplicate the option string for the video mode. Allocate the
copy's memory with kstrdup() and free it in the module's exit function.

Done in preparation of switching the driver to struct option_iter and
constifying the option string.

v2:
	* replace static memory with kstrdup()/kfree() (Geert)

Signed-off-by: Thomas Zimmermann <tzimmermann@...e.de>
---
 drivers/video/fbdev/intelfb/intelfbdrv.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/intelfb/intelfbdrv.c b/drivers/video/fbdev/intelfb/intelfbdrv.c
index 0a9e5067b201..8368c3601cdb 100644
--- a/drivers/video/fbdev/intelfb/intelfbdrv.c
+++ b/drivers/video/fbdev/intelfb/intelfbdrv.c
@@ -238,6 +238,7 @@ static bool probeonly   = 0;
 static bool idonly      = 0;
 static int bailearly    = 0;
 static int voffset	= 48;
+static char *mode_buf;
 static char *mode       = NULL;
 
 module_param(accel, bool, S_IRUGO);
@@ -365,8 +366,11 @@ static int __init intelfb_setup(char *options)
 			noinit = !noinit;
 		else if (OPT_EQUAL(this_opt, "mode="))
 			mode = get_opt_string(this_opt, "mode=");
-		else
-			mode = this_opt;
+		else {
+			kfree(mode_buf);
+			mode_buf = kstrdup(this_opt, GFP_KERNEL); // ignore errors
+			mode = mode_buf;
+		}
 	}
 
 	return 0;
@@ -405,6 +409,7 @@ static void __exit intelfb_exit(void)
 {
 	DBG_MSG("intelfb_exit\n");
 	pci_unregister_driver(&intelfb_driver);
+	kfree(mode_buf);
 }
 
 module_init(intelfb_init);
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ