Message ID | 20240129135734.18975-1-andre.werner@systec-electronic.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-42848-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp582721dyb; Mon, 29 Jan 2024 06:01:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVX3xILtoO7JEo6VymrckBPFBi4zP627mfwJ8UPhy2uLWHXjx4Grl9Ef9t9U76l8RNHjh8 X-Received: by 2002:a17:903:246:b0:1d5:8cbb:a9d0 with SMTP id j6-20020a170903024600b001d58cbba9d0mr2244235plh.25.1706536897592; Mon, 29 Jan 2024 06:01:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706536897; cv=pass; d=google.com; s=arc-20160816; b=IDMcQpnXJw6U3sR6AHMW0lAYZPdXzf45d+0YBFQDR+wEuEJK2HF4qEtebUDzgLZwRR RgKjIUylK3LlCB2ycr8W2kFyrtzTdxDm6iL8jY0E3CXnHg4VNyorqAJYbEBBfhAS9IK3 aNfscqnEpMIIPAAXrKVwNrFikODoRuOiQzz1otZm9/SPFKoSbwk4zMqRk9SZR7kMmqem yuCVH4RMCDIRpmd5FOcHmgjMtt/JjbukwV+JSN9GAAup1vZvxnBYNzZUseZxbanlZApN /LyqGyt6lO9p/F3xbnXbnnbxaFrTAcoj3pGBJuJCAeP7dQE6P1mdlXOJIBWz3KbbIoXZ gnww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature:dkim-filter; bh=BTpD3ri/kp+9GXI4Ho471yIWvsi+FB9vUd2lUCI+AaY=; fh=EW95u4Nxu1efLMnFaTYf/hfJfmSzKgtewn9i4CVxfk8=; b=1HF99PtTZ7x0jez/JBLUjHgd9OwY9eRwBvPdFeIl1JE6vngSFYLHWm5x3mexjP/3KS M7IuVbWqfAEFkxh+/zJVYNw7QzAMl+5Bbqnir7/nFxY05CvWBRbmDjh/WX7Bc6CyWb3S yeu9QPYrwSPRzBxg7SH0mexroi+oOdHc/KzJY/Hc04tBfj4M7qvkMdHZe4rh2D49f8S1 JwuOnPeUfjnU+SSFDMKMlmvac/adZ+4H2S8NwMj+cdkEYoOLi0qNuLWlhX/mgSzMS4Pa N5lMUXwCQpkDc7z6UDGlkStlrEfkFumAKpnibeJ+RPB0ZoNVCNwOzmBwZubFlM5jepxi Jejw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@systec-electronic.com header.s=B34D3B04-5DC7-11EE-83E3-4D8CAB78E8CD header.b=mVHx17SK; arc=pass (i=1 spf=pass spfdomain=systec-electronic.com dkim=pass dkdomain=systec-electronic.com); spf=pass (google.com: domain of linux-kernel+bounces-42848-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42848-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s20-20020a170902989400b001d8e9e54659si1238739plp.381.2024.01.29.06.01.37 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 06:01:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42848-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@systec-electronic.com header.s=B34D3B04-5DC7-11EE-83E3-4D8CAB78E8CD header.b=mVHx17SK; arc=pass (i=1 spf=pass spfdomain=systec-electronic.com dkim=pass dkdomain=systec-electronic.com); spf=pass (google.com: domain of linux-kernel+bounces-42848-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42848-ouuuleilei=gmail.com@vger.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 14FFF28B384 for <ouuuleilei@gmail.com>; Mon, 29 Jan 2024 13:59:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9738D66B49; Mon, 29 Jan 2024 13:57:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=systec-electronic.com header.i=@systec-electronic.com header.b="mVHx17SK" Received: from mail.systec-electronic.com (mail.systec-electronic.com [77.220.239.22]) (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 C2D3165BBE; Mon, 29 Jan 2024 13:57:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=77.220.239.22 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706536664; cv=none; b=TQlYZVbnCz3COIslZAL4UAO+QI/oa/7U2Pvd4nVj90RuTzpBLVtzJzsbRwpCyU4AY1ptk/uo2sSBmlCaxxUEROLgdggItaONqdHrtwFYBeGkpLeYFCNLepKg5blwU81XdOtpUIZNo+Ktj6MXRCkicSTHE9Qnfu8bhHKRcwnFvBs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706536664; c=relaxed/simple; bh=Lgn/MXuIjRnOzJxKkgXVhM9eDsr6eamWFql+Ayt6Ysc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QMXXAaYqJ7JPWqkCrECTAAJ87LYNnrziK2uJ+lLmhMvPXmxdfmq36xz90fFGceCWJyrjnusqOcIwRFJyj/nv/kuVBOY2RA/rOKOgSRXfxB5r08+fgw+jceKm6Eol2/4c/TE41aaTe6c7TolQkNKO/mhvs6ZDjpFbDScj5Fys6WM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=systec-electronic.com; spf=pass smtp.mailfrom=systec-electronic.com; dkim=pass (2048-bit key) header.d=systec-electronic.com header.i=@systec-electronic.com header.b=mVHx17SK; arc=none smtp.client-ip=77.220.239.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=systec-electronic.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=systec-electronic.com Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.systec-electronic.com (Postfix) with ESMTP id D1378941A5D6; Mon, 29 Jan 2024 14:57:39 +0100 (CET) Received: from mail.systec-electronic.com ([127.0.0.1]) by localhost (mail.systec-electronic.com [127.0.0.1]) (amavis, port 10032) with ESMTP id B51Lp-FHcuvy; Mon, 29 Jan 2024 14:57:39 +0100 (CET) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.systec-electronic.com (Postfix) with ESMTP id 9F4FB941A5D5; Mon, 29 Jan 2024 14:57:39 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.systec-electronic.com 9F4FB941A5D5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=systec-electronic.com; s=B34D3B04-5DC7-11EE-83E3-4D8CAB78E8CD; t=1706536659; bh=BTpD3ri/kp+9GXI4Ho471yIWvsi+FB9vUd2lUCI+AaY=; h=From:To:Date:Message-ID:MIME-Version; b=mVHx17SK6Gu7c58TEL2lG6YIkazxPddGq6QhKz9qahCHiXlelWjTbTiH6NjJSOqCU PRBrWiybIc0uRJK95XeNBc8V2jP4qxsAW0jX+ENUCevV1yNwfkVHqZBCuSyn30UTSp zx8ciWzwOvCER/qE69SSCqzwtmjRQRRRlFLr1cIF2tChcR8XcAzzi/g1awFiqDdiEu 56XhVFT9/26dBW/FE1m6HaGzaKS7bFDVHSHybfXV4IajhGRse+m7ZePFrTxzzoPyYO iyAGjaFBaCQ9pY2gXHzmpZW0x9j7QBlIcTifpJWb+RKbV0DOQEodPm1I8g7dVqc8dr D9B7zlZUK0aWQ== X-Virus-Scanned: amavis at systec-electronic.com Received: from mail.systec-electronic.com ([127.0.0.1]) by localhost (mail.systec-electronic.com [127.0.0.1]) (amavis, port 10026) with ESMTP id 6yJ13G-wB26w; Mon, 29 Jan 2024 14:57:39 +0100 (CET) Received: from ws-565760.systec.local (unknown [212.185.67.148]) by mail.systec-electronic.com (Postfix) with ESMTPSA id 41555941A5CF; Mon, 29 Jan 2024 14:57:39 +0100 (CET) From: Andre Werner <andre.werner@systec-electronic.com> To: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: linux@armlinux.org.uk, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andre Werner <andre.werner@systec-electronic.com> Subject: [net-next v5 0/2] Prevent nullptr exceptions in ISR Date: Mon, 29 Jan 2024 14:55:03 +0100 Message-ID: <20240129135734.18975-1-andre.werner@systec-electronic.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789433633918204716 X-GMAIL-MSGID: 1789433633918204716 |
Series |
Prevent nullptr exceptions in ISR
|
|
Message
Andre Werner
Jan. 29, 2024, 1:55 p.m. UTC
In case phydev->irq is modified unconditionally to a valid IRQ, handling the IRQ may lead to a nullptr exception if no interrupt handler is registered to the phy driver. phy_interrupt calls a phy_device->handle_interrupt unconditionally. And interrupts are enabled in phy_connect_direct if phydev->irq is not equal to PHY_POLL or PHY_MAC_INTERRUPT, so it does not check for a phy driver providing an ISR. Adding an additonal check for a valid interrupt handler in phy_attach_direct function, and falling back to polling mode if not, should prevent for such nullptr exceptions. Moreover, the ADIN1100 phy driver is extended with an interrupt handler for changes in the link status. Andre Werner (2): net: phy: phy_device: Prevent nullptr exceptions on ISR net: phy: adin1100: Add interrupt support for link change drivers/net/phy/adin1100.c | 55 ++++++++++++++++++++++++++++++++++++ drivers/net/phy/phy_device.c | 13 +++++---- 2 files changed, 63 insertions(+), 5 deletions(-)
Comments
Hello: This series was applied to netdev/net-next.git (main) by Jakub Kicinski <kuba@kernel.org>: On Mon, 29 Jan 2024 14:55:03 +0100 you wrote: > In case phydev->irq is modified unconditionally to a valid IRQ, handling > the IRQ may lead to a nullptr exception if no interrupt handler is > registered to the phy driver. phy_interrupt calls a > phy_device->handle_interrupt unconditionally. And interrupts are enabled > in phy_connect_direct if phydev->irq is not equal to PHY_POLL or > PHY_MAC_INTERRUPT, so it does not check for a phy driver providing an ISR. > > [...] Here is the summary with links: - [net-next,v5,1/2] net: phy: phy_device: Prevent nullptr exceptions on ISR https://git.kernel.org/netdev/net-next/c/61c81872815f - [net-next,v5,2/2] net: phy: adin1100: Add interrupt support for link change https://git.kernel.org/netdev/net-next/c/08b47dfdd6b8 You are awesome, thank you!