Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp3287965rdb; Tue, 6 Feb 2024 12:52:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhMpCClhfQJ5kgJ63GjOM5IMCRoYzAfTAQspY6bBRWVK2ZvE+cN+uj+nyEbYdIWfYOnORp X-Received: by 2002:a05:6214:c28:b0:686:abd6:7183 with SMTP id a8-20020a0562140c2800b00686abd67183mr3746565qvd.12.1707252753628; Tue, 06 Feb 2024 12:52:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707252753; cv=pass; d=google.com; s=arc-20160816; b=YVVz6Rib6MRgfKa/qI1GYmRh67q4LZuvJvtI4v53p5ZMJyWxc2efDZeJrXZtT92lBz sdVbwJ0Eare4g+3HF5F2ev/NIcIxhX68ToDZNHz7TvmlQzjHRFYh0+ElSnpLoUt6bQCg XjG7BD5ODq6RiCuO9a6zUMc42xTomXRw45GSI5D2laSj2kt01ow9xFn15ZoeCK0gPUwX yRn7yNM6yLvsSKAdJQ02BJl36CWFSVChNJOt4pf37wdGPjkeUiCbnV3Ka79S+lonv0Er oSqswh96u3o9GreyUbq5/Ywq/JxGG4Cr/NxrVRRoO0mIxlYEUESzKSvZ68BSB05MFhWv GhQw== 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=i6LXoju3aRD9Prm8Vj/RHDmvEHCq22G4lmIw3RdI5zw=; fh=cNLJ2y8TR5zB/CEXyxrTlJPmLh44w6DFczIQER9trNA=; b=V11qniWes1HgSyRBQ25S5dsiMyGRPBvURuZeJpPljo6XAZIznvbsw4mujQx1HLa3Ur S31w5OHYigkvccTCTpXb2XgoAGEPbrYNmtggX8s9RB7WcEjnLyZ7wtS+rvKSEmzIWBfp y5buZt6t7JMUP2wWpZCMdnxiTUxjaLeQv3pcBNGxGOL3SScIx2tC9MhCkWFqVP1arkTO id5/EdOzvwMW06uCRk22bHGEUUdNPiIu0fRvCnSPieVr9arAZzbkheyWreAQfuQHDZqO qwMb7IKN6o1Xef8PB0SIZcFX3Udoa/oGz8xJa9KryjodSwY1JVr/wrT/zbRMUvZKxdTi awvQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=huyQB7Nv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-55611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55611-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVW+w1hExyVbpN4eSoBD0AXbuX0sGY2qLDRcHfxZ9kxRwx0vbaRIntuN6MpMgcVn0MSZ/gjw0KIE2knDZejiwyj7HBpjV4PmyLf+DW0TA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ov4-20020a05620a628400b00783f7a6219dsi3242996qkn.216.2024.02.06.12.52.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 12:52:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=huyQB7Nv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-55611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55611-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 61AB21C243B5 for ; Tue, 6 Feb 2024 20:52:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21EA31B946; Tue, 6 Feb 2024 20:52:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="huyQB7Nv" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3E4451BDED; Tue, 6 Feb 2024 20:52:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707252745; cv=none; b=fSRWeILBch8pF/KAgK9MLttnDNaBkDG8xNKbjwFlIdLtOv4u42D+3vddPARrF134rEd3HnclFjCPw6Yp8TdqKciyws9ysqRjLBQmip2FuW5tAxtvLgrOT3HddGmWRpTqWmmYR9BwM4Evp0lcLi9T/SaAaOqFhpKPrPtir9nFw2s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707252745; c=relaxed/simple; bh=1FwVNnvMIETmmu3FksPs2T9xVBKZlTMIKKKVkLkI3FU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FzGreLEEUYAyD5YqzNSsLuWkAQpb9C+yUS3OWBt6jsppPEdY0/BQ4XomReBVdxdHKXT6956fUnKcUTUJHhxXEXKJfiv+8CVTeHABSiHkKBHeivQXqTKRnz/QcxN0AJHZDujVYlrUTuj3R4wbPNaIKcIxJSpMbAlgpIaw4KNY5og= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=huyQB7Nv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C51A6C433C7; Tue, 6 Feb 2024 20:52:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707252744; bh=1FwVNnvMIETmmu3FksPs2T9xVBKZlTMIKKKVkLkI3FU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=huyQB7Nv4eEO9Me+W/DBz9A0Vww3VVQDQ0fydvGFqV8qH/AWFZR0hRUkH0O8+TQ4s +y1Dy1oKrJ3h+eHQhR8Qa3q6RFQgzwRcJBBtLnONsul5mtCSICH0evikya50VaN8Sn YiwZUEhVsO65QoAJi03HPhMhSeMMwgAVSPud84YFXYevf1zyNe09+SYC6zBD3o1XYg ctwVIwRVYrH3bLrYuYRugl95laRR9mfcoDZusG4u6iHSxIra7jQZ1fKdo6F3DbGuBV CWMkdmxvXLu3k6jBZpmiTz3JNCn5kTdPaTUZfi03X68HDX8GJ6btyOrrao2g7PvJjy P3oi3ms78iw6A== Date: Tue, 6 Feb 2024 20:50:50 +0000 From: Simon Horman To: Horatiu Vultur Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, UNGLinuxDriver@microchip.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Michal Swiatkowski Subject: Re: [PATCH net v2] lan966x: Fix crash when adding interface under a lag Message-ID: <20240206205050.GK1104779@kernel.org> References: <20240206123054.3052966-1-horatiu.vultur@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=us-ascii Content-Disposition: inline In-Reply-To: <20240206123054.3052966-1-horatiu.vultur@microchip.com> On Tue, Feb 06, 2024 at 01:30:54PM +0100, Horatiu Vultur wrote: > There is a crash when adding one of the lan966x interfaces under a lag > interface. The issue can be reproduced like this: > ip link add name bond0 type bond miimon 100 mode balance-xor > ip link set dev eth0 master bond0 > > The reason is because when adding a interface under the lag it would go > through all the ports and try to figure out which other ports are under > that lag interface. And the issue is that lan966x can have ports that are > NULL pointer as they are not probed. So then iterating over these ports > it would just crash as they are NULL pointers. > The fix consists in actually checking for NULL pointers before accessing > something from the ports. Like we do in other places. > > Fixes: cabc9d49333d ("net: lan966x: Add lag support for lan966x") > Signed-off-by: Horatiu Vultur > Reviewed-by: Michal Swiatkowski Reviewed-by: Simon Horman