Skip to content

Commit 7f71294

Browse files
Jiri Slabypopcornmix
authored andcommitted
pps: do not crash when failed to register
commit 368301f upstream. With this command sequence: modprobe plip modprobe pps_parport rmmod pps_parport the partport_pps modules causes this crash: BUG: unable to handle kernel NULL pointer dereference at (null) IP: parport_detach+0x1d/0x60 [pps_parport] Oops: 0000 [#1] SMP ... Call Trace: parport_unregister_driver+0x65/0xc0 [parport] SyS_delete_module+0x187/0x210 The sequence that builds up to this is: 1) plip is loaded and takes the parport device for exclusive use: plip0: Parallel port at 0x378, using IRQ 7. 2) pps_parport then fails to grab the device: pps_parport: parallel port PPS client parport0: cannot grant exclusive access for device pps_parport pps_parport: couldn't register with parport0 3) rmmod of pps_parport is then killed because it tries to access pardev->name, but pardev (taken from port->cad) is NULL. So add a check for NULL in the test there too. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Jiri Slaby <[email protected]> Acked-by: Rodolfo Giometti <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent bcf28d1 commit 7f71294

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pps/clients/pps_parport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static void parport_detach(struct parport *port)
195195
struct pps_client_pp *device;
196196

197197
/* FIXME: oooh, this is ugly! */
198-
if (strcmp(pardev->name, KBUILD_MODNAME))
198+
if (!pardev || strcmp(pardev->name, KBUILD_MODNAME))
199199
/* not our port */
200200
return;
201201

0 commit comments

Comments
 (0)