From patchwork Tue May 17 19:40:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 9114781 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 401C09F37F for ; Tue, 17 May 2016 19:43:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DECD62022A for ; Tue, 17 May 2016 19:43:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27E9B20218 for ; Tue, 17 May 2016 19:43:21 +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 1b2ksN-0006x0-74; Tue, 17 May 2016 19:41:55 +0000 Received: from mout.gmx.net ([212.227.15.15]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b2ksK-0006tM-3K for linux-arm-kernel@lists.infradead.org; Tue, 17 May 2016 19:41:53 +0000 Received: from LT001.lan ([62.143.92.134]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0Lm3bl-1bboVD3IQ5-00Zcuw; Tue, 17 May 2016 21:41:18 +0200 From: Heinrich Schuchardt To: Sunil Goutham , Robert Richter Subject: [PATCH 1/1] net: thunderx: avoid null pointer dereference Date: Tue, 17 May 2016 21:40:38 +0200 Message-Id: <1463514038-9008-1-git-send-email-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.1.4 X-Provags-ID: V03:K0:xKtSCyJleFEkJJwSkGOr19y9pXZR+NDU05iDctt58soUb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2RXCQ== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160517_124152_500124_C6960ECD X-CRM114-Status: UNSURE ( 8.77 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Heinrich Schuchardt 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=-5.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, 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 In function bgx_lmac_handler only use a member of lmac after checking it is not null. Signed-off-by: Heinrich Schuchardt Acked-by: David Daney --- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c index d20539a..3ed2198 100644 --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c @@ -274,12 +274,14 @@ static void bgx_sgmii_change_link_state(struct lmac *lmac) static void bgx_lmac_handler(struct net_device *netdev) { struct lmac *lmac = container_of(netdev, struct lmac, netdev); - struct phy_device *phydev = lmac->phydev; + struct phy_device *phydev; int link_changed = 0; if (!lmac) return; + phydev = lmac->phydev; + if (!phydev->link && lmac->last_link) link_changed = -1;