Skip to contentSkip to conversation

w1 - fix fops in w1_bus_notify

PATCH In review Hans-Frieder Vogt 1 participant 1 message Oct 6, 2013 W1 dallas's 1-wire bus

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 w1 - fix fops in w1_bus_notify

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 <[email protected]>

---
 drivers/w1/w1.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/w1/w1.c +3 -0
@@ -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