Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3658875pxb; Mon, 24 Jan 2022 14:39:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDoDk40fjaBAgnUyMBdkFPnqDAyym/LmZzuob/iyw1bkojP4ZSDTRm22HiDBFmxj9Lb18u X-Received: by 2002:a17:90a:d3c8:: with SMTP id d8mr462943pjw.189.1643063992106; Mon, 24 Jan 2022 14:39:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063992; cv=none; d=google.com; s=arc-20160816; b=e5PflND4wrPLxhyW3CY7b7H/xb0XozS8wa55P+Z528b4uwmrD8zAXeaSVrwgV2An43 wnv7xKwhamRTQtxkwh+be14LmP2fbKpXmLO6gw1RgZicpH6CQ6va+iaQ0b4p6uWpjrpf k1ssOoq9I3nMh63oVezlMmRDlRUY6FKcqLxCQQ8btOQhgyyrTB6MhSNYREwPNFUXQWP3 vFinzjQksCudNX2a6kJB0wN8UA8piwSSOLfosqICx/KYnk34p7unRKeYn5xfEo85HeA3 ThSHBP7/9KL0cy9lgQ1X3WdRB+cEFfYSkVGe3C5DYaNQqI8XEWxJ4JAs6FpyniGPXP1x 8hiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z0/PLEbuGoyzdWZMbBMxDTe0Mp6MpO4ZgCMK8cUoYCo=; b=Cn8k+9bj2R4ARCD32wnjJvraK8Iuxq9SbG838bph0PqeqRh5h67MK5AGVLb+vI9Y8h hSvpCVj0HOrU2eAxj8NB1uNKp/IZW9gt5owTYCj+UxedA7iDe0MirnMtnoNZLRfZ4gZ7 s0e2nCzD7WelxQjEM3dB32RntwoxE1K4Y4JykzsWbaYTXFNMv7cfwt9Ay+kHkobdIuXz GWdrF4XIexy6EyOjiI1DkyJJ06Xtp46XFncTF1cw1qwtlreuB8WfdA0xokF0oQvDbrLX q9XEva/UQb9R8X/I4m/SPPAN9amPQEuFJVHlDiTJW8M7Nt07PwKV/3LwxfUGpse7OuDs svsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wTJtQ3hY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w184si1462107pgd.9.2022.01.24.14.39.40; Mon, 24 Jan 2022 14:39:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wTJtQ3hY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1588798AbiAXWd6 (ORCPT + 99 others); Mon, 24 Jan 2022 17:33:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456634AbiAXVjk (ORCPT ); Mon, 24 Jan 2022 16:39:40 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 480A1C0417D1; Mon, 24 Jan 2022 12:25:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 109DBB8121C; Mon, 24 Jan 2022 20:25:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3772EC340E8; Mon, 24 Jan 2022 20:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055909; bh=1HJTEdJbsETCywUzoAM7MoH5oDIbZRr8IH9m9qAdEXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wTJtQ3hYqOAWfbkDg0PIKzYuFXjniqjFTSCAL+6XY3uWPKjNt8T7F4wHmOkyHDPHr JIze8UJ6rsX5KsbtU9kFG2t6zEt5L/5QqXKLUDEMR7LRe8KXpeAMFWXoAUihfZEhyZ aUZeHhYptoHx8k/HYrRrbRxzBe859vj7vTwyH0Fw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Horatiu Vultur , Vladimir Oltean , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 307/846] net: dsa: fix incorrect function pointer check for MRP ring roles Date: Mon, 24 Jan 2022 19:37:04 +0100 Message-Id: <20220124184111.499495647@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladimir Oltean [ Upstream commit ff91e1b68490b97c18c649b769618815eb945f11 ] The cross-chip notifier boilerplate code meant to check the presence of ds->ops->port_mrp_add_ring_role before calling it, but checked ds->ops->port_mrp_add instead, before calling ds->ops->port_mrp_add_ring_role. Therefore, a driver which implements one operation but not the other would trigger a NULL pointer dereference. There isn't any such driver in DSA yet, so there is no reason to backport the change. Issue found through code inspection. Cc: Horatiu Vultur Fixes: c595c4330da0 ("net: dsa: add MRP support") Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/dsa/switch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/dsa/switch.c b/net/dsa/switch.c index 44558fbdc65b3..fb69f2f14234e 100644 --- a/net/dsa/switch.c +++ b/net/dsa/switch.c @@ -644,7 +644,7 @@ static int dsa_switch_mrp_add_ring_role(struct dsa_switch *ds, struct dsa_notifier_mrp_ring_role_info *info) { - if (!ds->ops->port_mrp_add) + if (!ds->ops->port_mrp_add_ring_role) return -EOPNOTSUPP; if (ds->index == info->sw_index) @@ -658,7 +658,7 @@ static int dsa_switch_mrp_del_ring_role(struct dsa_switch *ds, struct dsa_notifier_mrp_ring_role_info *info) { - if (!ds->ops->port_mrp_del) + if (!ds->ops->port_mrp_del_ring_role) return -EOPNOTSUPP; if (ds->index == info->sw_index) -- 2.34.1