From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f73.google.com (mail-dl1-f73.google.com [74.125.82.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75E4923F294 for ; Wed, 7 Jan 2026 01:05:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767747924; cv=none; b=BuhWdy13C34qUzq0WccBwzC7vNhboYZ3kdf3yq1KXGhwuJv+9KrOR40gNzP/IaygX31P9liMrGod5RSFP2uEazAgmjTcEagVD6t4+SEZmOfiB5XS4N+DmDOAEz6egl0UmSJqeVDg3/RbL/4vu+CC8Fy0X8q5dmmmacQsj/nzAJg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767747924; c=relaxed/simple; bh=bLalVEMbPPKCA6Kn6BpvcZjDujpTlw81pSCK4D5YByo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Ex7tNMk/aVb1GoOhZdGPgXEHgpurxpDXfFF3EYd5tEi4viEq0cmNNIVL0hp2juNCiKuwpIWAvM21k3FA5Z3Q4jerA/yEUqpacUJ+8R97Pxd49cEB1nAb3eF8nkWp6jOds548q5fWU933cbDTIQAovbqtJsc8MQcbapcw0O4gQ+s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--boolli.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ALdfcc9S; arc=none smtp.client-ip=74.125.82.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--boolli.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ALdfcc9S" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-11dd10b03d9so1087000c88.0 for ; Tue, 06 Jan 2026 17:05:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767747921; x=1768352721; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=uYuKjIoFITh34belvsUGGdGwbr0H2yT+hfJIc/2t9is=; b=ALdfcc9SmcmkLscLx5yKf9O1aa+zEf9ZdHVFvGUhOzsW+jZbPByktpm3NGNQMHbYuG Zql3W2btAmRBhbmIFDuHAmP0i/kRGg1f638KZEgIxquT9Md6yRqd035QCYo5UoZHPpTM oXzjtL9YeRsQYTnuFZDVU+xWMyuB6AFE3YBAV/2+6n58spUMABsYjfhQNW3CwiyO2MEO kCYORkD/BzPzr+WNZqBQanaDMbpI1DvanEdwqHPHp0WMsv3umKnr3nlJSJ0m+byM6YSZ 3FqpPgXOthtyag2Jluj83mr4mjXdhSwpCCt9GIv5veaWMMz2HghqWHS0UXKszved2xCt spNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767747921; x=1768352721; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uYuKjIoFITh34belvsUGGdGwbr0H2yT+hfJIc/2t9is=; b=ErBmsxRg+gWjrTXWE816JO3sOLzGQ0rrgrXXRvVGClpYSmCIPq8VNb5bps+IGKwo9v n8U4TiUI8sDpiv4fRcYMg4Q+joD/ar1OgRYAq5A4fqla905QR6fGWwErQvOaL7hKmSeI 5bKIpP9SrTs4WervJ5yMUvFXA0KqvXgmVuXv5Cph/zmJHDw5YvX2JX3t2tkUBuEO076E B9nsyXgqnNoVCZBQ4OktRS8+jCdGjLAohBOjbxKO6T4XJOTOy+sNnwT/ERuYX7oOXRiQ Uh1ju4AixdfZZ4k4jeb5mFCkmVHGuCsM4iAbFiyCXHR4RDtBLF8Inp/t4n6LvoCtgQ4a 3Ipw== X-Forwarded-Encrypted: i=1; AJvYcCVoS2MLkQreNlpDymKiF7GnAtL6NLYaYWVveUfqM2MO72QJRwuFPltd3zfxBEqxii2Gnk0Yik6XO9H9fbQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyXBRsOy88H7j8V3hQwp4F2+jasIK+dYIM5rUTpzSwIvwwQJLI/ bzVf/Bgghc7C5anLUMsvmXDYOOi8avDTeAEv7RvQCdYu4LtbXKGa5Iqtd1b7G8fTTE+otvldZIO ikvwBbA== X-Google-Smtp-Source: AGHT+IERehY56UWpPh//i5oxfb0HeZGQNoZ+QgzVqNukRsBFB/92C9fjnGE+fl3jAJe6woD72AFL9kZCyck= X-Received: from dlkk2.prod.google.com ([2002:a05:7022:6082:b0:121:7c06:d4b5]) (user=boolli job=prod-delivery.src-stubby-dispatcher) by 2002:a05:701b:2089:20b0:11b:2138:4758 with SMTP id a92af1059eb24-121f8b2bc09mr583152c88.21.1767747921545; Tue, 06 Jan 2026 17:05:21 -0800 (PST) Date: Wed, 7 Jan 2026 01:05:02 +0000 In-Reply-To: <20260107010503.2242163-1-boolli@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260107010503.2242163-1-boolli@google.com> X-Mailer: git-send-email 2.52.0.351.gbe84eed79e-goog Message-ID: <20260107010503.2242163-4-boolli@google.com> Subject: [PATCH 4/5] idpf: skip setting channels if vport is NULL during HW reset From: Li Li To: Tony Nguyen , Przemek Kitszel , "David S. Miller" , Jakub Kicinski , Eric Dumazet , intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, David Decotigny , Anjali Singhai , Sridhar Samudrala , Brian Vazquez , Li Li , emil.s.tantilov@intel.com Content-Type: text/plain; charset="UTF-8" When an idpf HW reset is triggered, it clears the vport but does not clear the netdev held by vport: // In idpf_vport_dealloc() called by idpf_init_hard_reset(), // idpf_init_hard_reset() sets IDPF_HR_RESET_IN_PROG, so // idpf_decfg_netdev() doesn't get called. if (!test_bit(IDPF_HR_RESET_IN_PROG, adapter->flags)) idpf_decfg_netdev(vport); // idpf_decfg_netdev() would clear netdev but it isn't called: unregister_netdev(vport->netdev); free_netdev(vport->netdev); vport->netdev = NULL; // Later in idpf_init_hard_reset(), the vport is cleared: kfree(adapter->vports); adapter->vports = NULL; During an idpf HW reset, when userspace changes the netdev channels, the vport associated with the netdev is NULL, and so a kernel panic would happen: [ 2245.795117] BUG: kernel NULL pointer dereference, address: 0000000000000088 ... [ 2245.842720] RIP: 0010:idpf_set_channels+0x40/0x120 This can be reproduced reliably by injecting a TX timeout to cause an idpf HW reset, and injecting a virtchnl error to cause the HW reset to fail and retry, while running "ethtool -L" in userspace. With this patch applied, we see the following error but no kernel panics anymore: [ 1176.743096] idpf 0000:05:00.0 eth1: channels not changed due to no vport in netdev netlink error: Bad address Signed-off-by: Li Li --- drivers/net/ethernet/intel/idpf/idpf_ethtool.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c index c71af85408a29..1b03528041af4 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c +++ b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c @@ -580,6 +579,11 @@ static int idpf_set_channels(struct net_device *netdev, idpf_vport_ctrl_lock(netdev); vport = idpf_netdev_to_vport(netdev); + if (!vport) { + netdev_err(netdev, "channels not changed due to no vport in netdev\n"); + err = -EFAULT; + goto unlock_mutex; + } idx = vport->idx; vport_config = vport->adapter->vport_config[idx]; -- 2.52.0.351.gbe84eed79e-goog