Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp1929758imc; Fri, 22 Feb 2019 14:04:16 -0800 (PST) X-Google-Smtp-Source: AHgI3IYYlUueuwtjDHa4sDhLZPQgeI9621ree877t7YdunXfZWk02AIhdYcTv6YTPyfDvgk7XCnM X-Received: by 2002:a63:2312:: with SMTP id j18mr6067866pgj.344.1550873056305; Fri, 22 Feb 2019 14:04:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550873056; cv=none; d=google.com; s=arc-20160816; b=uEka6yfxOG/O7kGzLLGPhUDDL+lFrCt2gNfuJxpohwhTR+Y8zxxYuI6JrOROSgIzaO 4FKvxjwsiVClUSqx09YJ36TIwGxtNpkSs386NJN8IFDBFKDjigog1vbvQ0NWaxD25Ucp laJB3j1zsI7Ytc4/1ew7D8Jirp9WlVk0+9K16+T230Ye383UuGUDMgZbzpS1GFr+ZzB+ 8Nfl4JCIVCPy/yvafTkDfqALi1BxmWEN3luFWB+rNlD3wNcbbSoMPBufMwhjtrfm9CzR eFuZyO0gKfXxRjknX9lC9TU5IzwruMJ2FqFfg0oecOzOijtuANViDal1QgG12fC9VoT2 1wIQ== 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=lIsPkHHzCVLPY04ei/Yux6FtF0E04kMaRTF2O0M8+Ak=; b=rDlVAV5byWrFgoSS7oloAmbTl/J7J64fZuakhryCYvhQKhfajUyOXbz9QVgS9A7y8O 8FI1Ax60qV6OWcqrfaFaAi//Ef2UtoDB+b8q2TiSF7Sry5thIMI/jBQMTw1FRuU7D+nA xW9gDvIKBKxKZSs3EOqCTuv+tjJxRWzRBIOeGgIiPOTPI5b+Cd/svSVOAj71duFsYzDO m8w+z+H45qGGl8RY2I71ylV37K0VClZSjrnpTiWg1AAZsoKd3mwxtB49R1+dX82QK56R Ev4jhqYAFgCYZVM4RImtztZT6Aw4TE5YS0I2P+d+hq4ZNaMSzYa9qlNfHePVBplHa6td TgNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Kj8GG7wt; 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 j135si2240398pgc.517.2019.02.22.14.04.00; Fri, 22 Feb 2019 14:04:16 -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=@gmail.com header.s=20161025 header.b=Kj8GG7wt; 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 S1726296AbfBVWCY (ORCPT + 99 others); Fri, 22 Feb 2019 17:02:24 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:42926 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbfBVWCX (ORCPT ); Fri, 22 Feb 2019 17:02:23 -0500 Received: by mail-pf1-f196.google.com with SMTP id n74so1686608pfi.9; Fri, 22 Feb 2019 14:02:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=lIsPkHHzCVLPY04ei/Yux6FtF0E04kMaRTF2O0M8+Ak=; b=Kj8GG7wtGVsQ+SdHNHrv3fJhcpeZJZk3uvn0S+MmyQnESLioA0Y6fAldTuWUo+Nl0b E3msRvSd8rkyAjocgKJlXlrPoYqVc5/R8/S+R+Q+JpqUpmqAKh4+SlJKukfAhWN7rS70 6AyoMEgiHdOqv9d5EfnzfzDWnfcw76sOB9yJH75zqCCxVWhUWXkdLOf+bOngAsxpOQO9 ztZx8QqmFmT1U1SwhHkj+1V0T/lwFMmFDhvyuhy5gV1fXJaFMIN2rCxWnIEHN775HmKt 7coH7dmmvQKU36V+iMAsm7polQNpCa28hEJctUCnlYocAOOnsLtoSz3yHLNnU1zROvQC KgLA== 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=lIsPkHHzCVLPY04ei/Yux6FtF0E04kMaRTF2O0M8+Ak=; b=RRqIOd18FIPrdW7zsjYMSGbwOVIgP4SnirdXbPBi9vAHlQgZGa3yJn9ZpIwIME2FmN BloQ91TjgHV30BSk8WtqAxf4/irIK3KwdQxZ695HuaTyRqaYax7om/+xuqzOboWATDW5 5bihAuMJx8e/ksGhW/+hZXI94r5Y3E1Y3fciGQ4WqOW3eXUozwdyAHzaZChSCdCNrHxC 7mPVYIE5UEMhp5pm6qskYttKgdCNSYOzpJq8gIulFhcWApoRnmT1T0zqbSl2qZQQ8YhW MJOwNB7EO3KKEdTYPvFVDxg+jFyf+awkHJHRI1ROCU2q/pOjlYu5h3sOxbSafeAYI/Gw VmOA== X-Gm-Message-State: AHQUAuYxZPvVnx1ZxtgLVVkHEs1vbgdcd0QDjbbJEmqZ/h2EWNDHcoz/ fo7Szb2cDb9VtjAhIpQKHZvtIat7 X-Received: by 2002:a65:51ca:: with SMTP id i10mr5843915pgq.371.1550872942449; Fri, 22 Feb 2019 14:02:22 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id n6sm2906768pgv.86.2019.02.22.14.02.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 14:02:21 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , Ioana Radulescu , Ioana Ciornei , Greg Kroah-Hartman , linux-kernel@vger.kernel.org (open list:DPAA2 ETHERNET SWITCH DRIVER), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM) Subject: [PATCH net] staging: fsl-dpaa2: ethsw: Add missing netdevice check Date: Fri, 22 Feb 2019 14:02:14 -0800 Message-Id: <20190222220214.25401-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 port_switchdev_event() does not check that the target network device is actually backed by the ethsw driver, this could be problematic in a stacked environment case. Fixes: 44baaa43d7cc ("staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver") Signed-off-by: Florian Fainelli --- drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c index daabaceeea52..2edd82f5229a 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c @@ -1047,6 +1047,9 @@ static int port_switchdev_event(struct notifier_block *unused, struct ethsw_switchdev_event_work *switchdev_work; struct switchdev_notifier_fdb_info *fdb_info = ptr; + if (!ethsw_port_dev_check(dev)) + return NOTIFY_DONE; + switchdev_work = kzalloc(sizeof(*switchdev_work), GFP_ATOMIC); if (!switchdev_work) return NOTIFY_BAD; -- 2.17.1