[PATCH 1/2] w1 - fix fops in w1_bus_notify
From: Hans-Frieder Vogt
Date: Sun Oct 06 2013 - 15:13:42 EST
Introduce a check to make sure that fops are only called if they have been
defined by the slave module.
Without this check modules like w1_smem cause a NULL pointer
dereference bug.
Signed-off by: Hans-Frieder Vogt <hfvogt@xxxxxxx>
---
drivers/w1/w1.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/w1/w1.c 2013-09-24 21:24:20.803261482 +0200
+++ b/drivers/w1/w1.c 2013-10-06 14:58:45.246528318 +0200
@@ -613,6 +613,9 @@ static int w1_bus_notify(struct notifier
sl = dev_to_w1_slave(dev);
fops = sl->family->fops;
+ if (!fops)
+ return 0;
+
switch (action) {
case BUS_NOTIFY_ADD_DEVICE:
/* if the family driver needs to initialize something... */
Hans-Frieder Vogt e-mail: hfvogt <at> gmx .dot. net
--
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/