History

pps: do not crash when failed to register

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.

Jiri Slaby committed 10 years ago

Commit 368301f1 parent 2d6a4d61 file · +1 −1Browse files

Unified · Split

drivers/pps/clients/pps_parport.c+1−1
@@ -195,7 +195,7 @@ static void parport_detach(struct parport *port) · 194 unmodified lines
195 struct pps_client_pp *device;195 struct pps_client_pp *device;
196 196
197 /* FIXME: oooh, this is ugly! */197 /* FIXME: oooh, this is ugly! */
198 if (strcmp(pardev->name, KBUILD_MODNAME))198 if (!pardev || strcmp(pardev->name, KBUILD_MODNAME))
199 /* not our port */199 /* not our port */
200 return;200 return;
201 201

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t