From patchwork Mon Jan 16 23:29:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antti Palosaari X-Patchwork-Id: 9519655 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 356A3600C5 for ; Mon, 16 Jan 2017 23:30:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 285CC26E94 for ; Mon, 16 Jan 2017 23:30:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C97128447; Mon, 16 Jan 2017 23:30:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F231A26E94 for ; Mon, 16 Jan 2017 23:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751236AbdAPXay (ORCPT ); Mon, 16 Jan 2017 18:30:54 -0500 Received: from mail.kapsi.fi ([217.30.184.167]:37609 "EHLO mail.kapsi.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751089AbdAPXax (ORCPT ); Mon, 16 Jan 2017 18:30:53 -0500 Received: from [82.128.187.92] (helo=localhost.localdomain) by mail.kapsi.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cTGiY-0001JN-8s; Tue, 17 Jan 2017 01:29:38 +0200 From: Antti Palosaari To: linux-media@vger.kernel.org Cc: Chris Rankin , =?UTF-8?q?H=C3=A5kan=20Lennest=C3=A5l?= , Antti Palosaari Subject: [PATCH] cxd2820r: fix gpio null pointer dereference Date: Tue, 17 Jan 2017 01:29:34 +0200 Message-Id: <20170116232934.8230-1-crope@iki.fi> X-Mailer: git-send-email 2.9.3 X-SA-Exim-Connect-IP: 82.128.187.92 X-SA-Exim-Mail-From: crope@iki.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Setting GPIOs during probe causes null pointer deference when GPIOLIB was not selected by Kconfig. Initialize driver private field before calling set gpios. It is regressing bug since 4.9. Fixes: 07fdf7d9f19f ("[media] cxd2820r: add I2C driver bindings") Reported-by: Chris Rankin Cc: # v4.9+ Signed-off-by: Antti Palosaari Tested-by: Chris Rankin --- drivers/media/dvb-frontends/cxd2820r_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c index 95267c6..f6ebbb4 100644 --- a/drivers/media/dvb-frontends/cxd2820r_core.c +++ b/drivers/media/dvb-frontends/cxd2820r_core.c @@ -615,6 +615,7 @@ static int cxd2820r_probe(struct i2c_client *client, } priv->client[0] = client; + priv->fe.demodulator_priv = priv; priv->i2c = client->adapter; priv->ts_mode = pdata->ts_mode; priv->ts_clk_inv = pdata->ts_clk_inv; @@ -697,7 +698,6 @@ static int cxd2820r_probe(struct i2c_client *client, memcpy(&priv->fe.ops, &cxd2820r_ops, sizeof(priv->fe.ops)); if (!pdata->attach_in_use) priv->fe.ops.release = NULL; - priv->fe.demodulator_priv = priv; i2c_set_clientdata(client, priv); /* Setup callbacks */