mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans-Frieder Vogt <hfvogt@gmx.net>
To: zbr@ioremap.net, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] w1 - fix fops in w1_bus_notify
Date: Sun, 06 Oct 2013 21:13:35 +0200	[thread overview]
Message-ID: <49341335.BT4urmCfm2@maximilian> (raw)

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


                 reply	other threads:[~2013-10-06 19:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49341335.BT4urmCfm2@maximilian \
    --to=hfvogt@gmx.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zbr@ioremap.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®