w1 - fix fops in w1_bus_notify
authorHans-Frieder Vogt <hfvogt@gmx.net>
Sun, 6 Oct 2013 19:13:35 +0000 (21:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Oct 2013 07:12:14 +0000 (00:12 -0700)
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@gmx.net>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Cc: stable <stable@vger.kernel.org> # 3.11+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/w1/w1.c

index c7c64f18773d87d5f23e81ec90ba7d8bfaee504a..0781217d239647a9639943614e2b78e80c15385b 100644 (file)
@@ -613,6 +613,9 @@ static int w1_bus_notify(struct notifier_block *nb, unsigned long action,
        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... */
This page took 0.024941 seconds and 5 git commands to generate.