Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1927604rdb; Sun, 4 Feb 2024 07:15:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9LWtlG5B0s9TAgH87byjNf8SgqS6ukWzy4ABPqZRV4WCcHQPEVIEj5Me4fyA9suN8Yypg X-Received: by 2002:a05:620a:145a:b0:783:daad:3fea with SMTP id i26-20020a05620a145a00b00783daad3feamr11871671qkl.9.1707059732081; Sun, 04 Feb 2024 07:15:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707059732; cv=pass; d=google.com; s=arc-20160816; b=n4b47/gJcRCUgvuYsH94I4JAzHyvJ+C0nM9VPsCsAJS33PAQSUmDgonWaC4s23Sgvj giVAD1WPV2nQSpioFqSZ8Dswp92flLdSvKm6X8ZJFl0oSHETV/HBmAa8fym8JH4UcuKn NYptpLVpTUPUer1pS0PJnp/AGtsABm7ybl/tWlSCXreqSGnRh+J5FOQNmIdyNdBRfpRQ hjEbtPgOCCAdan+iTLFk0pK8yD1L9qmuywcgtqV7dD6k+n7S7qO3Unvo5SLG1NbmijDP qWN4EFTDOq0ULfehklkZZ3NgO0fzL/LrYc/Z4HPUb6ndYGxVNTZwK7Ooh2wQm5QB0DXT fehQ== 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=edYHnRAqz8+dv8WEmyxXjWpoGAiVxFe3ltzCGSM68NQ=; fh=LEnz57zv7KOlvlJ0WQTBudxx8/z7AaNHj+icNOdc94c=; b=k475VNCyNz+Xmsdi0ZKqIqFVq9CD3DDDenvPlXlnbZhm1jFpUW5SgGCGdFDV7AND7h pTDyZMKC+bJCHlx0MHSyWp++jOZfn9XtK+OuROkpw6bjgE8PTdONwTB0DRzNCLyRKC1H A4owGf+y1dvG2aSO7VJ/+RGiTnU4IFA1NCgSfwEGL1aI+SSm5f0zYsOK/kKO2QMBl3Zv Jv94ZV86/IObFvE4cmxKIwspOlMFwQKLuQ/a3kfoYPqsgMPZNYbz5d0cCl0cEOoo1y3o 4D9pYRUuKP09nISWdoc5pHQ6/XtFuhcLIF63sUbpKhM4slj1/MDyYCPkF7H4mLlgHs65 xK9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=zTL4Va8w; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-51746-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51746-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch X-Forwarded-Encrypted: i=1; AJvYcCVpYblP7el2Q5wRNW0di9wdbx594UflEBgpU0upUqbvLf9nVv0wUQdFlh/qc7EACWQtPWCe4HCDknZx2iMtSqBXFEswfSOY70r5KjkUvA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w6-20020a05620a444600b0078565760765si3504620qkp.685.2024.02.04.07.15.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 07:15:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51746-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=@lunn.ch header.s=20171124 header.b=zTL4Va8w; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-51746-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51746-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch 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 D25701C21E22 for ; Sun, 4 Feb 2024 15:15:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 52B8F225AA; Sun, 4 Feb 2024 15:15:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="zTL4Va8w" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (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 D26A822301; Sun, 4 Feb 2024 15:15:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707059723; cv=none; b=tXlSsvy4n1+SWN42Pmez0bowKg9YWScbBk1ZCxLmkpKXaNgX7+Pd08raGNw95tWNkDVAekzdXnH98tieLVnXftSRLqA0a4jeT4l3Oxe4fFDd3XbKOuEs/A/K4OEIKdVLYAPBeODGAKojgPNc7CUFt3Pp7t4l0OBbJTAeRV5Q7Qo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707059723; c=relaxed/simple; bh=IeZfAJeIueCJI7tdAJKSyC4Jwez+pyH758ixVanQ578=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IfMhqeuHnn9G2ooXiO88JOITLGwkCe+dF++peMQT8Jt4+5vVLfu5Z8775LTUkw0sRA2XNEMH19OtOfS1mfS5hqU24PeMzP+I/IXd2B8WwGLKtD9oT9Ubkdiqw7V2rclw0lADJOHyi+ZuJK3yKlFMVW3bNzXEEnp50qA8Jdd93Gk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=zTL4Va8w; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=edYHnRAqz8+dv8WEmyxXjWpoGAiVxFe3ltzCGSM68NQ=; b=zTL4Va8wcoV/6G2DFrtpoPED7k 1Gd4ADSJt7S5piBmZKIaGfIT7mgq8co+nbQvDjwI68Uzn8hY/Z6tVt+IivT570WzbI5kQUQ/25aM3 6aBv0Gp3WzyByyqEl0ANbN+vbUh7Q+6r9Zgw1YKfr9r/bOVfuXVC51z5VZ5y9/2zC4kI=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rWeD0-006xuU-Qj; Sun, 04 Feb 2024 16:15:02 +0100 Date: Sun, 4 Feb 2024 16:15:02 +0100 From: Andrew Lunn To: Christian Marangi Cc: Pavel Machek , Lee Jones , "David S. Miller" , Jakub Kicinski , Heiner Kallweit , Daniel Golle , Li Zetao , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] leds: trigger: netdev: Fix kernel panic on interface rename trig notify Message-ID: <8d51f09b-e6d2-4ee1-9e7d-b545d561798a@lunn.ch> References: <20240203235413.1146-1-ansuelsmth@gmail.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: <20240203235413.1146-1-ansuelsmth@gmail.com> On Sun, Feb 04, 2024 at 12:54:01AM +0100, Christian Marangi wrote: > Commit d5e01266e7f5 ("leds: trigger: netdev: add additional specific link > speed mode") in the various changes, reworked the way to set the LINKUP > mode in commit cee4bd16c319 ("leds: trigger: netdev: Recheck > NETDEV_LED_MODE_LINKUP on dev rename") and moved it to a generic function. > > This changed the logic where, in the previous implementation the dev > from the trigger event was used to check if the carrier was ok, but in > the new implementation with the generic function, the dev in > trigger_data is used instead. > > This is problematic and cause a possible kernel panic due to the fact > that the dev in the trigger_data still reference the old one as the > new one (passed from the trigger event) still has to be hold and saved > in the trigger_data struct (done in the NETDEV_REGISTER case). > > On calling of get_device_state(), an invalid net_dev is used and this > cause a kernel panic. > > To handle this correctly, move the call to get_device_state() after the > new net_dev is correctly set in trigger_data (in the NETDEV_REGISTER > case) and correctly parse the new dev. > > Fixes: d5e01266e7f5 ("leds: trigger: netdev: add additional specific link speed mode") > Cc: stable@vger.kernel.org > Signed-off-by: Christian Marangi This should have 'net' in the subject line, to indicate which tree its for. Otherwise: Reviewed-by: Andrew Lunn Andrew