summaryrefslogtreecommitdiffstats
path: root/drivers/w1
diff options
context:
space:
mode:
authorHans-Frieder Vogt <hfvogt@gmx.net>2013-10-06 21:13:35 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-07 09:12:14 +0200
commit2962aecef2878e2192ac9676700469678507c24d (patch)
tree93070b11c0b9d5a3321478beb1b8645f4d12df24 /drivers/w1
parentLinux 3.12-rc3 (diff)
downloadlinux-2962aecef2878e2192ac9676700469678507c24d.tar.xz
linux-2962aecef2878e2192ac9676700469678507c24d.zip
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 <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>
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/w1.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index c7c64f18773d..0781217d2396 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -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... */