Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2447443ybx; Sat, 2 Nov 2019 20:21:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmnEICgBBjuDocDtOV7s+ClJeleow2HrucnR3Wfup/5uVXLqA/PT0EMsEltazHCWI0uPbP X-Received: by 2002:a17:906:1949:: with SMTP id b9mr17538541eje.277.1572751292222; Sat, 02 Nov 2019 20:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572751292; cv=none; d=google.com; s=arc-20160816; b=H0P25Lf3YePhCUBDIQYz9LaCJu2UosvmS4rRnkp/belx90Yfts1RLorCwONKf2lP+h JPz4Xk/KjvCpc5emyP0zoIm75Z+sj637rEjMX1K+lFf9KEJNZcWz7kymc0kJo+wTm4pI HD4ogeaQLXHQEQZ3FXhMWfPEPt1zQTa4uuelVGGx7W+GpKjm9Dsl5kfjzHV1aJJ7C+vx RfwQVwabgzH4YkCIN8wlsZptcmNzAJJeZ8hOIKUb6lNsw+V1vB8e1kagqDUVR+yW2qx9 wo1CO0Gm5X1geYSGE++lPwhYIHWv2yZhpwRd/BaiRFSNOE1sdjkSTnfSgwdQVwYpjo7w iVUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=pxIGu3u5xJbOz4wi1IVD6IMKrp2EyQWpsAtO+pdvP2g=; b=wLOZKN90kiBvKrqtIOgNfcuV6X1HgIAzPDA8bjAwOlQQUwRdR6b1WpJqT6reVz+JLo v9ZCLWfMeGRUDMy3gTztuq+sdL8mkJInpRreDfrv/FzoTHZyKCglFl4LtFRuy4bkQffa qj5DnxYpCqVK3r4IL4btK2sePrm7q0tW0/h4cD2VXPKNiU4/hZbl9vwGBsbaQDsjGp4u 4tUIV7J2gNGV5x3f6WgSZ5qwiHEYUUCI7YVgD47eDe+kADO+q2H9fVXRykuJYXr6rKP3 5d5iooyle04gHayo/7steaW/N+aBoCl2AWbX5CgAMDT7S0CfP6hF1343gnqZwfXU3zho /Rsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PbeFQcRH; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m38si4046020edc.37.2019.11.02.20.21.09; Sat, 02 Nov 2019 20:21:32 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=PbeFQcRH; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727499AbfKCDRr (ORCPT + 99 others); Sat, 2 Nov 2019 23:17:47 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:35690 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727366AbfKCDRr (ORCPT ); Sat, 2 Nov 2019 23:17:47 -0400 Received: by mail-wm1-f65.google.com with SMTP id 8so5628611wmo.0; Sat, 02 Nov 2019 20:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=pxIGu3u5xJbOz4wi1IVD6IMKrp2EyQWpsAtO+pdvP2g=; b=PbeFQcRHCdG34JCzSRtBVCTb7HOzB+UI66b74r3Q6uVOJJmgO8kZtdu3MgubpuL8aX /Uq0CzdrpQCkbRHF4W96g0pdBMPS5+JZInSnNbYhSPbL7misLSo93OSo9RWkn+LsF2Yz JuuYBpbcT8DEbq63qoyGlphTTqfSxulQad66mmfOEhEbIcCcvFcjGaa8icZFT2IZUMba gXF8aJ9Rfm1uJqpZJswCnTbU7ikRXpV2pEsSd2BvbG19IzQD+YDZW5RGjxqok1xWBrw8 Tl8WdMtubogJX3tE5jtfOS+uz+dRTcbxxClmutLJl0erjNRNeRH+8QSw0cmPVPYEN99g kB1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pxIGu3u5xJbOz4wi1IVD6IMKrp2EyQWpsAtO+pdvP2g=; b=HjM9yqFyAZvexq1kAqA255Jh4O6Lm0JEei1K3rKSvRVrN/+Em1Fjsg+6PhSsrWEeuN sFEtCTB+nBsBj1GaNXmwHjLzkpeB6jHgbIhujjZkQu3R7M9tmxVFXKgrHqhuK71X4sfV 3kOxiPqB+9vXf4GINXjFzPxmfn/0mHyFVetUzI+8mT2TqYTlQ/HkItll/1IeFU7WvilP HYWzdHDzwrcrACy7xCnmajhGf04SD086F2HyBBrGVDmynm6AkCq0/J7RufbO0Qtiaf/E B2CBYH8RDHCZsoIusukVYWgr4/n5WzJv/Hp+ibUWGRzG8He/8Gu0RJ6PFibAfU3eJMC7 ZPaw== X-Gm-Message-State: APjAAAX/ys+kxoTOnED3n5ArgXyJHGpJRNo0EhfecF0dWPbI0qwBpbfW 5z2YlV6AV5wbBqT4pmQHpxGCtO7J X-Received: by 2002:a1c:f302:: with SMTP id q2mr17848091wmq.142.1572751065271; Sat, 02 Nov 2019 20:17:45 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id p15sm13149147wrs.94.2019.11.02.20.17.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Nov 2019 20:17:44 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: rmk+kernel@armlinux.org.uk, hkallweit1@gmail.com, Florian Fainelli , Andrew Lunn , Vivien Didelot , "David S. Miller" , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net] net: dsa: bcm_sf2: Fix driver removal Date: Sat, 2 Nov 2019 20:17:39 -0700 Message-Id: <20191103031739.27157-1-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the DSA core doing the call to dsa_port_disable() we do not need to do that within the driver itself. This could cause an use after free since past dsa_unregister_switch() we should not be accessing any dsa_switch internal structures. Fixes: 0394a63acfe2 ("net: dsa: enable and disable all ports") Signed-off-by: Florian Fainelli --- drivers/net/dsa/bcm_sf2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index a4a46f8df352..79748ca30c33 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -1212,10 +1212,10 @@ static int bcm_sf2_sw_remove(struct platform_device *pdev) struct bcm_sf2_priv *priv = platform_get_drvdata(pdev); priv->wol_ports_mask = 0; + /* Disable interrupts */ + bcm_sf2_intr_disable(priv); dsa_unregister_switch(priv->dev->ds); bcm_sf2_cfp_exit(priv->dev->ds); - /* Disable all ports and interrupts */ - bcm_sf2_sw_suspend(priv->dev->ds); bcm_sf2_mdio_unregister(priv); return 0; -- 2.17.1