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]
Date:	Fri, 13 Jul 2012 13:33:13 +0200
From:	Samuel Iglesias Gonsálvez 
	<siglesias@...lia.com>
To:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:	Samuel Iglesias Gonsálvez 
	<siglesias@...lia.com>, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] Staging: ipack/devices/ipoctal: fix dereference NULL pointer

After opening and closing the file /dev/ipoctal.X.Y.Z for the second time, it
gives a kernel oops due to a dereference of a NULL pointer.

The problem was that tty->driver_data was not properly initialized when
accessing the file for the second time.

Reported-by: Alberto Garcia Gonzalez <agarcia@...lia.com>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@...lia.com>
---
 drivers/staging/ipack/devices/ipoctal.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c
index a5af423..a1aae40 100644
--- a/drivers/staging/ipack/devices/ipoctal.c
+++ b/drivers/staging/ipack/devices/ipoctal.c
@@ -114,8 +114,6 @@ static int ipoctal_port_activate(struct tty_port *port, struct tty_struct *tty)
 
 	ipoctal_write_io_reg(ipoctal, &ipoctal->chan_regs[channel].u.w.cr,
 			     CR_ENABLE_RX);
-	tty->driver_data = ipoctal;
-
 	return 0;
 }
 
@@ -136,6 +134,8 @@ static int ipoctal_open(struct tty_struct *tty, struct file *file)
 	if (atomic_read(&ipoctal->open[channel]))
 		return -EBUSY;
 
+	tty->driver_data = ipoctal;
+
 	res = tty_port_open(&ipoctal->tty_port[channel], tty, file);
 	if (res)
 		return res;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ