Skip to content

Commit

Permalink
plip: fix parport_register_device name parameter
Browse files Browse the repository at this point in the history
Plip passes a 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, 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.

Signed-off-by: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Mikulas Patocka authored and Linus Torvalds committed Nov 27, 2007
1 parent f6ce5cc commit cdb3270
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Documentation/parport-lowlevel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ Use this function to register your device driver on a parallel port
('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.
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/plip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ static void plip_attach (struct parport *port)

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);

Expand Down

0 comments on commit cdb3270

Please sign in to comment.