Skip to content

Commit

Permalink
w1 - fix fops in w1_bus_notify
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hans-Frieder Vogt authored and Greg Kroah-Hartman committed Oct 7, 2013
1 parent 15c03dd commit 2962aec
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/w1/w1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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... */
Expand Down

0 comments on commit 2962aec

Please sign in to comment.