linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] fix plip 2
Date: Thu, 22 Nov 2007 21:26:01 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.0711222120501.15336@artax.karlin.mff.cuni.cz> (raw)
In-Reply-To: <Pine.LNX.4.64.0711222053170.15336@artax.karlin.mff.cuni.cz>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1910 bytes --]

This is my second patch for plip. Plip passes string "name" that is 
allocated on stack to parport_register_device. parport_register_device 
holds the pointer to "name" and when the registering function exits, it 
points nowhere.

On some machine, this bug causes bad names to appear in /proc filesystem, 
such as /proc/sys/dev/parport/parport0/devices/T^/ÁX^/Á, on others, the 
plip proc node is completely missing.

The patch also fixes documentation to note this requirement.

Mikulas

Signed-off-by: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>

diff -u -r linux-2.6.24-rc2/Documentation/parport-lowlevel.txt linux-2.6.24-test/Documentation/parport-lowlevel.txt
--- linux-2.6.24-rc2/Documentation/parport-lowlevel.txt	2007-11-06 22:57:46.000000000 +0100
+++ linux-2.6.24-test/Documentation/parport-lowlevel.txt	2007-11-22 21:11:28.000000000 +0100
@@ -339,6 +339,10 @@
 ('port').  Once you have done that, you will be able to use
 parport_claim and parport_release in order to use the port.
 
+The ('name') argument is the name of the device that appears in /proc
+filesystem. The string must be valid for the whole lifetime of the
+device (until parport_unregister_device is called).
+
 This function will register three callbacks into your driver:
 'preempt', 'wakeup' and 'irq'.  Each of these may be NULL in order to
 indicate that you do not want a callback.
diff -u -r linux-2.6.24-rc2/drivers/net/plip.c linux-2.6.24-test/drivers/net/plip.c
--- linux-2.6.24-rc2/drivers/net/plip.c	2007-11-06 22:57:46.000000000 +0100
+++ linux-2.6.24-test/drivers/net/plip.c	2007-11-22 21:11:28.000000000 +0100
@@ -1269,7 +1269,7 @@
 
 		nl = netdev_priv(dev);
 		nl->dev = dev;
-		nl->pardev = parport_register_device(port, name, plip_preempt,
+		nl->pardev = parport_register_device(port, dev->name, plip_preempt,
 						 plip_wakeup, plip_interrupt,
 						 0, dev);
 

  parent reply	other threads:[~2007-11-22 20:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-22 20:19 [PATCH] fix plip 1 Mikulas Patocka
2007-11-22 20:20 ` Mikulas Patocka
2007-11-22 20:26 ` Mikulas Patocka [this message]
2007-11-27  3:32 ` Linus Torvalds
2007-11-29  2:34   ` Mikulas Patocka

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=Pine.LNX.4.64.0711222120501.15336@artax.karlin.mff.cuni.cz \
    --to=mikulas@artax.karlin.mff.cuni.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).