mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] w1 - fix fops in w1_bus_notify
@ 2013-10-06 19:13 Hans-Frieder Vogt
  0 siblings, 0 replies; only message in thread
From: Hans-Frieder Vogt @ 2013-10-06 19:13 UTC (permalink / raw)
  To: zbr, gregkh; +Cc: linux-kernel

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>
---
 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-10-06 19:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-06 19:13 [PATCH 1/2] w1 - fix fops in w1_bus_notify Hans-Frieder Vogt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®