From: Andries.Brouwer@cwi.nl

There are lots of places (not only the three below) where we leave a
pointer to a structure, but free the structure itself.  Bad habit.

Making the pointer NULL will turn random behaviour into NULL deref when the
pointer is ever touched.

This does not fix anything.



 25-akpm/drivers/input/keyboard/atkbd.c |    3 +++
 1 files changed, 3 insertions(+)

diff -puN drivers/input/keyboard/atkbd.c~input-use-after-free-checks drivers/input/keyboard/atkbd.c
--- 25/drivers/input/keyboard/atkbd.c~input-use-after-free-checks	Thu Sep 25 12:30:36 2003
+++ 25-akpm/drivers/input/keyboard/atkbd.c	Thu Sep 25 12:30:36 2003
@@ -576,6 +576,7 @@ static void atkbd_disconnect(struct seri
 	struct atkbd *atkbd = serio->private;
 	input_unregister_device(&atkbd->dev);
 	serio_close(serio);
+	serio->private = NULL;
 	kfree(atkbd);
 }
 
@@ -634,6 +635,7 @@ static void atkbd_connect(struct serio *
 	serio->private = atkbd;
 
 	if (serio_open(serio, dev)) {
+		serio->private = NULL;
 		kfree(atkbd);
 		return;
 	}
@@ -642,6 +644,7 @@ static void atkbd_connect(struct serio *
 
 		if (atkbd_probe(atkbd)) {
 			serio_close(serio);
+			serio->private = NULL;
 			kfree(atkbd);
 			return;
 		}

_