Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2660432imj; Mon, 11 Feb 2019 06:37:31 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ/NO3ofXKZ2NLzZ9s/1IsyFtGN+sZslZAwa6cv7Xs9TVVNZygF/Jc36vAcTWJgTUQ5HGbT X-Received: by 2002:a65:514c:: with SMTP id g12mr33492488pgq.169.1549895851446; Mon, 11 Feb 2019 06:37:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895851; cv=none; d=google.com; s=arc-20160816; b=NPTHiBnutIiOuksnvZaKFnBoTFhMOiXT3lYRU2TFJv+k7VD71e+7ZS+CdL2OU10VyI HxKOGS6nzSy/GJAnzMcnahf5OLyJ/5xXu+ctdSsMhCXoVnMWGz2OrcoplBhrFjDNgLCJ Ha1jyAWhd4cyPrC5yjR3MbQOuMJrohDYGJf1qc2O0IILToR/Uskt5X+kEsVs2TZpDIIO K1O3uBmntxmHkmlvMbixWCP1F89OcbfPV+nns9tSLlnpG1ISXXNJnEWp7IJrQmMR9zGa LIAIkAFFdtCTQIJCcxX7LOnb3aTeZG9ctL7Zs+Y51RaSjmUQHTIh1zH+Auwhhsjt53u1 prRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r76FV3qKYFNiia8M2A1s+vvUR/+9UoKB9aCmoRr/HBE=; b=uD4P/8HFGID7A037LilHSwdqSh3Tqzokc21oCK/mtdZ+NuzreqFGBPlMHSwlZcYlHo adGH8q5N7ZTcCsY1gizji8SJt4Ib6ehFbhN/xlzTfeqGZqwGNu0Yo/NmwtDDxWP2KWgT TIk7GZ0748TGZc0FV8zHLqTyIpVsyNegK7foGB4HPGDEkPF9WxZ6K/IJwtOREPkGbE/x OSjdARGe5C+oB1Io/YK82inoNTMwOTR3Rb4W/v0KrLq0zYWmhhCye88mPbWAP8VTuvML 67zTwsd6N3Y5F78TYS+EygeC/yCCfbpNyzCB37vDoyg4u4BU2i9ee9niUGcNsg/cdatu PxZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sTJRTwDQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si9732474pff.42.2019.02.11.06.37.15; Mon, 11 Feb 2019 06:37:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sTJRTwDQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730985AbfBKOfN (ORCPT + 99 others); Mon, 11 Feb 2019 09:35:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:43776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730434AbfBKOfL (ORCPT ); Mon, 11 Feb 2019 09:35:11 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C379F204EC; Mon, 11 Feb 2019 14:35:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895711; bh=Dr1l0440dgOJDXyj97wxxFlq0Y5GM7D36xZz+qeN1KY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sTJRTwDQ/72xO/CKx9RZVUjsTz36jH0i3vNGofSUBBxNme1zfWOuS2uPlO0MCRxak C8Z94mt07iEScN3gTM/aSFXs7Ba0ROrq8uJijdbzlB7u/apSGkYUWSxyCGIK6GEebr p7s2azDJV5ugKMJP/syWMMsCS/8vVhy684s6j4V4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Florian Fainelli , Vivien Didelot , "David S. Miller" Subject: [PATCH 4.20 297/352] net: dsa: Fix NULL checking in dsa_slave_set_eee() Date: Mon, 11 Feb 2019 15:18:44 +0100 Message-Id: <20190211141905.778484294@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ Upstream commit 00670cb8a73b10b10d3c40f045c15411715e4465 ] This function can't succeed if dp->pl is NULL. It will Oops inside the call to return phylink_ethtool_get_eee(dp->pl, e); Fixes: 1be52e97ed3e ("dsa: slave: eee: Allow ports to use phylink") Signed-off-by: Dan Carpenter Reviewed-by: Florian Fainelli Reviewed-by: Vivien Didelot Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/dsa/slave.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -639,7 +639,7 @@ static int dsa_slave_set_eee(struct net_ int ret; /* Port's PHY and MAC both need to be EEE capable */ - if (!dev->phydev && !dp->pl) + if (!dev->phydev || !dp->pl) return -ENODEV; if (!ds->ops->set_mac_eee) @@ -659,7 +659,7 @@ static int dsa_slave_get_eee(struct net_ int ret; /* Port's PHY and MAC both need to be EEE capable */ - if (!dev->phydev && !dp->pl) + if (!dev->phydev || !dp->pl) return -ENODEV; if (!ds->ops->get_mac_eee)