[PATCH 04/12] pps: pps_parport: fix oops on module unloading

From: Konstantin Khlebnikov
Date: Fri Dec 14 2012 - 06:05:05 EST


Seems like port->cad is NULL for unused ports

Signed-off-by: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxx>
Cc: Rodolfo Giometti <giometti@xxxxxxxxxxxx>

---

[ 0.151192] BUG: unable to handle kernel NULL pointer dereference at (null)
[ 0.151759] IP: [<ffffffffa2de3048>] parport_detach+0x24/0x95 [pps_parport]
[ 0.153875] Process rmmod (pid: 22117, threadinfo ffff880061174000, task ffff8800613db000)
[ 0.153875] Call Trace:
[ 0.153875] [<ffffffffa064c49c>] parport_unregister_driver+0x51/0x8b [parport]
[ 0.153875] [<ffffffffa2de364f>] pps_parport_exit+0x17/0x20 [pps_parport]
[ 0.153875] [<ffffffff8110e976>] sys_delete_module+0x328/0x3d2
[ 0.153875] [<ffffffff8168e7e8>] tracesys+0xe1/0xe6
---
drivers/pps/clients/pps_parport.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pps/clients/pps_parport.c b/drivers/pps/clients/pps_parport.c
index e1b4705..7e9bcd4 100644
--- a/drivers/pps/clients/pps_parport.c
+++ b/drivers/pps/clients/pps_parport.c
@@ -194,7 +194,7 @@ static void parport_detach(struct parport *port)
struct pps_client_pp *device;

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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/