All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xencons missing string allocation
@ 2005-12-09 18:37 Alex Williamson
  2005-12-09 18:54 ` Muli Ben-Yehuda
  2005-12-12  9:40 ` Tristan Gingold
  0 siblings, 2 replies; 12+ messages in thread
From: Alex Williamson @ 2005-12-09 18:37 UTC (permalink / raw)
  To: xen-devel


   I was trying to boot dom0 w/ "xencons=ttyS1 console=ttyS1".  It gives
some weird error messages:

Warning: dev (ttyS2) tty->count(2) != #fd's(1) in release_dev
Warning: dev (ttyS2) tty->count(3) != #fd's(1) in tty_open

And blows up with a page fault.  The page fault is because we don't
actually allocate a buffer for the tty driver name.  The patch below
fixes that problem.  Using xencons=ttyS1 still doesn't quite work and
prints lots of the above error messages, but at least it doesn't crash
dom0 now.  Patch vs xen-unstable.hg.  Thanks,

	Alex

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
---

diff -r 53cff3f88e45 linux-2.6-xen-sparse/drivers/xen/console/console.c
--- a/linux-2.6-xen-sparse/drivers/xen/console/console.c	Fri Dec  9 11:05:06 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c	Fri Dec  9 11:12:04 2005
@@ -641,11 +641,23 @@
 
 	if (xc_mode == XC_SERIAL)
 	{
-		DRV(xencons_driver)->name        = "ttyS";
+		DRV(xencons_driver)->name = kmalloc(strlen("ttyS") + 1,
+		                                    GFP_KERNEL);
+		if (!DRV(xencons_driver)->name) {
+			kfree(xencons_driver);
+			return -ENOMEM;
+		}
+		strcpy(DRV(xencons_driver)->name, "ttyS");
 		DRV(xencons_driver)->minor_start = 64 + xc_num;
 		DRV(xencons_driver)->name_base   = 0 + xc_num;
 	} else {
-		DRV(xencons_driver)->name        = "tty";
+		DRV(xencons_driver)->name = kmalloc(strlen("tty") + 1,
+		                                    GFP_KERNEL);
+		if (!DRV(xencons_driver)->name) {
+			kfree(xencons_driver);
+			return -ENOMEM;
+		}
+		strcpy(DRV(xencons_driver)->name, "tty");
 		DRV(xencons_driver)->minor_start = xc_num;
 		DRV(xencons_driver)->name_base   = xc_num;
 	}

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-12-13 21:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-09 18:37 [PATCH] xencons missing string allocation Alex Williamson
2005-12-09 18:54 ` Muli Ben-Yehuda
2005-12-09 20:37   ` Alex Williamson
2005-12-10  0:00     ` Alex Williamson
2005-12-10 15:06       ` Keir Fraser
2005-12-10 16:27         ` Alex Williamson
2005-12-10 23:12           ` Keir Fraser
2005-12-12 22:00             ` Alex Williamson
2005-12-13  1:57               ` Keir Fraser
2005-12-13 20:44                 ` Alex Williamson
2005-12-13 21:00                   ` Keir Fraser
2005-12-12  9:40 ` Tristan Gingold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.