From patchwork Thu Oct 30 20:01:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Bresticker X-Patchwork-Id: 5200211 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 43C6AC11AC for ; Thu, 30 Oct 2014 20:03:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7AB552024C for ; Thu, 30 Oct 2014 20:03:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A6E9920173 for ; Thu, 30 Oct 2014 20:03:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XjvuZ-0001tH-89; Thu, 30 Oct 2014 20:01:35 +0000 Received: from mail-vc0-f202.google.com ([209.85.220.202]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XjvuX-0001qp-6Y for linux-arm-kernel@lists.infradead.org; Thu, 30 Oct 2014 20:01:33 +0000 Received: by mail-vc0-f202.google.com with SMTP id hy10so413348vcb.3 for ; Thu, 30 Oct 2014 13:01:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2NLB8POxPWdOMIfv5m8IxrijN8mrp5PKWyqfK51IZ+8=; b=OYtauby2RTHNSAb95A9bFGWthf5txb61W9uF3wuR8vawgVP84RoOYduaZ0BQR17m7R kLvZlFTfU9ONP/SBBH8nkMMrbUovxJNlh/BJp/Xqv+fLPV41jHniUVWm6ebcNbw17iyA EwFjKiTFQyl6wfksE2/Nb9U67Qj5PiwlXXLsJhCbkmWa0CwL6MQFBegqgtx2bIHaa5/0 zVXwZl+AHI5GGuBxl4b/F9kNuEdyh/kMU3zaZUaKWLSHcisjLl+nQPKHl8pqggIR7o5H +68Vs2AVPmq2pHiPROzu5q8t657QcRfrP79vL/qiYLyvQjP6QumgWBqvtgrkGKNPhwOl U4Fw== X-Gm-Message-State: ALoCoQmQ+7ld6WNNDK72rVD8QpD9dVivBGi9fGppag6tGrIR9wekTEYBFi/M5bQe3GAG1JwS6Ax3 X-Received: by 10.236.223.69 with SMTP id u65mr8041472yhp.43.1414699269061; Thu, 30 Oct 2014 13:01:09 -0700 (PDT) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id n63si470515yho.5.2014.10.30.13.01.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Oct 2014 13:01:09 -0700 (PDT) Received: from abrestic.mtv.corp.google.com ([172.22.65.70]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id Cys5DwIB.1; Thu, 30 Oct 2014 13:01:08 -0700 Received: by abrestic.mtv.corp.google.com (Postfix, from userid 137652) id 2FBE8220EB2; Thu, 30 Oct 2014 13:01:08 -0700 (PDT) From: Andrew Bresticker To: Jassi Brar Subject: [PATCH 1/2] mailbox: Avoid NULL-pointer dereference in mbox_chan_received_data() Date: Thu, 30 Oct 2014 13:01:06 -0700 Message-Id: <1414699267-17970-1-git-send-email-abrestic@chromium.org> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141030_130133_317316_5D7BEDAA X-CRM114-Status: UNSURE ( 9.69 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.3 (-) Cc: Andrew Bresticker , Thierry Reding , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);