Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2328772rdb; Mon, 12 Feb 2024 00:33:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWaZQDMsSIlgGYXuMOgeJViTAcPgbJbj/meVc4kA9D18yvZLDL6lIlqTeGAvZB5yumZgEiJ71nIH3rIG+SPBxZCu7z9pdDEJXEq+ZCATQ== X-Google-Smtp-Source: AGHT+IHsPHXvDESaPG+pvrrwznLg4sLXBYA0yJM9TbD+qZWXpFR/JXOlOEug9IVNZLMlGEiLS88t X-Received: by 2002:a05:6a00:124d:b0:6e0:4a04:cd1 with SMTP id u13-20020a056a00124d00b006e04a040cd1mr6128100pfi.17.1707726797764; Mon, 12 Feb 2024 00:33:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707726797; cv=pass; d=google.com; s=arc-20160816; b=EXMMMIfS0tG3LvxCsG5TOVP748ovH9zVw3734YWI+lgEgPRcUsGexc3Roe3uLj0g1Z DD8888EJySKaxLnFnYVZsfKfCR28Cr+Uh0AdlAoAhnsY84SzLsFg148NqVsYn9+B1gAY 9GI5X06gYbUlGGSLjwwH8uEtAfTCDozVMZ7kr3CCFseReKTYGwmJ4Ang/Kc8KFUP8+sS 9Bs8u0zKJzcPpp501F/os9LtiXuv0NIg7QpiufiF5SoZfzQOmNATznR7mGWUfbXIEmob TPW2RJCoxszU38L5RI9k96N1ogmdxN4LJMn+GoKaCMTniYBGQatD2TgLQeXrHpxEEYmr lG8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Fr9CLQGRAPhauZa3rcYst6K5p6b8aYUBu9N8j3b6Elw=; fh=CESCLTImii6YLsD0vPC3L095vcZvie/aKSSlsAIoULQ=; b=VFY4iAm86bp/ygYF5/ly5AkEsRIwDsi3igP9YpYFE3bPYi27Y+J3Ra04uAXKlkJoI0 uotxv2p7EcBivmm1J13t0iqYZyPu74/6BGv6qdoYzplBjFpNX0bI06oGAzt6itbfWGE2 wm357jFIpjUCBnZjQmfb+p7B7jPyRH68Kp2b+QEJ+VRjQpniAT5DV8PiOsvWz8Wi/ntH XvDTEWmpz3rsWyliKcuIRgS6sjOQuNMth0ciYTKGHsR6BuwduCOidPjh6AmG3PdgS6Ry 8ewB5PFg08H6G14q1SwQgzncdF+APJLzmYDQTUspeA8uRVAAMMmKWDvLf4rVxg5tG2uf 0Zpg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="jWu/Kfa2"; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-61202-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61202-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com X-Forwarded-Encrypted: i=2; AJvYcCU0Kx5Po7FfWPWg1VDOl9uoPw2nqO0r+wl89PbYuFD3dM8kK2pQN8obZpQXPgqWHVoWuqr2fnQGgGigBpSjxyoA/+XhKH38quoxiaSL4w== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id lp8-20020a056a003d4800b006e0d7707881si1725566pfb.394.2024.02.12.00.33.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 00:33:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61202-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="jWu/Kfa2"; arc=pass (i=1 spf=pass spfdomain=microchip.com dkim=pass dkdomain=microchip.com dmarc=pass fromdomain=microchip.com); spf=pass (google.com: domain of linux-kernel+bounces-61202-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61202-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6EFD5282853 for ; Mon, 12 Feb 2024 08:33:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D9E312E59; Mon, 12 Feb 2024 08:32:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="jWu/Kfa2" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC87812B72; Mon, 12 Feb 2024 08:32:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707726776; cv=none; b=OdQX5cIj7tJlGuIRDMcKXHgWXFKlEm72PvpzyEE+vGDhf6pQkWyPQrcgnGMLLbQdCaBSrlBAQaVHrLZBjNFLEO9cpfHQbmaPe8EEatmRJGYcDOX+WN9fHTQJ7gVDkE290dA3NOsk5/jVAQtQTk7WESAWNc6Po4BSNhNESxUSrVY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707726776; c=relaxed/simple; bh=qyTPvECMMD7PLdsPw5g/Hi+5zh4RU30ugtOCwlCVVbo=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qJ7Hfmi/fAZlyf+ao8dgf/YEbePz1Vcxszt5oLn8AjKyXxMTOGAcI0zBh/c9ilNQq2DrAa+O9fAxl0E3aEKEtTKWa6Gc0khc130qw94P1m1q8EofI+o5mgCKJaXgnYeuirg6EnOJVsCn7lLayXrGV4IMEeFOBuJYmOZA4d7Mg8Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=jWu/Kfa2; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1707726775; x=1739262775; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=qyTPvECMMD7PLdsPw5g/Hi+5zh4RU30ugtOCwlCVVbo=; b=jWu/Kfa2bzl4XCNFUUNYTjGCnTsaxoXT7zG/8LyYQdKSFqyKIzvQDMxz vL+/0bfn+jFVuIt15fv8XbArIQxOxeTkdIdlRBWWXmAwqQR2Av8FZ6lgd iIAsQ7/8IPbWy2+WTXgeUgsKyCUTIIoB82MurLmaXAjX8n0LcS3ltRbrQ 0WFSbxKuD5r4kKu7Ut8HfB3v4WBukg0E3QwhKOwkkd7ENpVWVttIPj0FD ZrGmQ3oV7v0BPBUj/uBsUzixrNmtD/cUqWIR1TQP+meCl7AKHP+BK98rh vkogiXilIE+/8jpi3qBFeuZ7ffglLgcijHovEzYwETO+qDXIYxGqy9SUl A==; X-CSE-ConnectionGUID: PJUI358zS2+N2ZPOQUlDBQ== X-CSE-MsgGUID: xVXDTiaMRkeK5P1qOSM6sQ== X-IronPort-AV: E=Sophos;i="6.05,262,1701154800"; d="scan'208";a="16619492" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 12 Feb 2024 01:32:54 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 12 Feb 2024 01:32:30 -0700 Received: from localhost (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Mon, 12 Feb 2024 01:32:30 -0700 Date: Mon, 12 Feb 2024 09:32:29 +0100 From: Horatiu Vultur To: Jakub Kicinski CC: , , , , , , Michal Swiatkowski Subject: Re: [PATCH net v2] lan966x: Fix crash when adding interface under a lag Message-ID: <20240212083229.tg3cabp4iee3p6tq@DEN-DL-M31836.microchip.com> References: <20240206123054.3052966-1-horatiu.vultur@microchip.com> <20240209135220.42e670d4@kernel.org> <20240212081038.cbsb2exfmcxxntzq@DEN-DL-M31836.microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <20240212081038.cbsb2exfmcxxntzq@DEN-DL-M31836.microchip.com> The 02/12/2024 09:10, Horatiu Vultur wrote: > The 02/09/2024 13:52, Jakub Kicinski wrote: > > Hi Jakub, > > > > > On Tue, 6 Feb 2024 13:30:54 +0100 Horatiu Vultur wrote: > > > for (lag = 0; lag < lan966x->num_phys_ports; ++lag) { > > > - struct net_device *bond = lan966x->ports[lag]->bond; > > > + struct lan966x_port *port = lan966x->ports[lag]; > > > int num_active_ports = 0; > > > + struct net_device *bond; > > > unsigned long bond_mask; > > > u8 aggr_idx[16]; > > > > > > - if (!bond || (visited & BIT(lag))) > > > + if (!port || !port->bond || (visited & BIT(lag))) > > > continue; > > > > > > + bond = port->bond; > > > bond_mask = lan966x_lag_get_mask(lan966x, bond); > > > > > > for_each_set_bit(p, &bond_mask, lan966x->num_phys_ports) { > > > struct lan966x_port *port = lan966x->ports[p]; > > > > > > + if (!port) > > > + continue; > > > > Why would lan966x_lag_get_mask() set a bit for a port that doesn't > > exist? Earlier check makes sense. This one seems too defensive. > > You are right, the lan966x_lag_get_mask() will not set a bit for a port > that doesn't exist[1]. Therefore this check is not needed. > > [1] https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/microchip/lan966x/lan966x_lag.c#L354 While trying to rebase on net, the next version of this patch, I have seen that actually this version was accepted even though it was marked as "Changes Requested". The commit sha is: 15faa1f67ab405d47789d4702f587ec7df7ef03e How do you prefer to go forward from here? - do you want to revert this and then I will send a new version? - should I send a patch that just removes this unneeded check? - any other suggestion? > > > -- > > pw-bot: cr > > -- > /Horatiu -- /Horatiu