linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: abrestic@chromium.org (Andrew Bresticker)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] mailbox: Avoid NULL-pointer dereference in mbox_chan_received_data()
Date: Thu, 30 Oct 2014 13:01:06 -0700	[thread overview]
Message-ID: <1414699267-17970-1-git-send-email-abrestic@chromium.org> (raw)

If a message has been received on a channel, but no client has yet bound
to it, mbox_chan_received_data() will dereference a NULL client pointer.
Check for the presence of a client first.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
---
 drivers/mailbox/mailbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index afcb430..5008028 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -142,7 +142,7 @@ static void poll_txdone(unsigned long data)
 void mbox_chan_received_data(struct mbox_chan *chan, void *mssg)
 {
 	/* No buffering the received data */
-	if (chan->cl->rx_callback)
+	if (chan->cl && chan->cl->rx_callback)
 		chan->cl->rx_callback(chan->cl, mssg);
 }
 EXPORT_SYMBOL_GPL(mbox_chan_received_data);
-- 
2.1.0.rc2.206.gedb03e5

             reply	other threads:[~2014-10-30 20:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30 20:01 Andrew Bresticker [this message]
2014-10-30 20:01 ` [PATCH 2/2] mailbox: Don't unnecessarily re-arm the polling timer Andrew Bresticker
2014-10-31 11:41   ` Thierry Reding
2014-11-08 18:21     ` Jassi Brar
2014-10-31  4:01 ` [PATCH 1/2] mailbox: Avoid NULL-pointer dereference in mbox_chan_received_data() Jassi Brar

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=1414699267-17970-1-git-send-email-abrestic@chromium.org \
    --to=abrestic@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).