mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andries.Brouwer@cwi.nl
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: input layer
Date: Sat, 9 Aug 2003 22:09:42 +0200 (MEST)	[thread overview]
Message-ID: <UTC200308092009.h79K9gV24870.aeb@smtp.cwi.nl> (raw)

Something that you might want to try in -mm, but which
is not for Linus' tree is the below.

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.

Andries


diff -u --recursive --new-file -X /linux/dontdiff a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
--- a/drivers/input/keyboard/atkbd.c	Mon Jun 23 04:43:32 2003
+++ b/drivers/input/keyboard/atkbd.c	Sat Aug  9 22:59:21 2003
@@ -473,6 +473,7 @@
 	struct atkbd *atkbd = serio->private;
 	input_unregister_device(&atkbd->dev);
 	serio_close(serio);
+	serio->private = NULL;
 	kfree(atkbd);
 }
 
@@ -518,6 +519,7 @@
 	serio->private = atkbd;
 
 	if (serio_open(serio, dev)) {
+		serio->private = NULL;
 		kfree(atkbd);
 		return;
 	}
@@ -526,6 +528,7 @@
 
 		if (atkbd_probe(atkbd)) {
 			serio_close(serio);
+			serio->private = NULL;
 			kfree(atkbd);
 			return;
 		}

                 reply	other threads:[~2003-08-09 20:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=UTC200308092009.h79K9gV24870.aeb@smtp.cwi.nl \
    --to=andries.brouwer@cwi.nl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®