From patchwork Mon Jan 13 02:34:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Potin Lai X-Patchwork-Id: 13936666 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 E98D113A3ED; Mon, 13 Jan 2025 02:37:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736735853; cv=none; b=kLnxPHkEFYiiiHqiRV0qymjFNkdGOFa3Gl/aHiA+7jZt0IMTsLvUIh0NY8eABpUh7BhoLJ41sLx22+QpDE5qCRIefhHH3wUugSeGHx0BeC8F8D+UZRh6rc9VE/lEuRhXZBAE0QsNORq7vGMFgspEmNcPGmdKidXeQUv2UzS6HZk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736735853; c=relaxed/simple; bh=Y6KhVL19YV85Fry25EY0/X1r2wmsqcdo/rcDS2pSbuQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=q56mE0lsNHJxW8arm8TIPbSdydIuHX0HmaOTynC7p2jLz1j+DrLoRXKNRuY4VK5sfWjgOZ9dmkI63LOcgdWUnUw81aA0fgccwLqRo4qyjoILx3esp+VtH/miuZYM04kN3EurKZV8xwzhTyFzD1nHXliEQL6SRfu9bEiC9b/lbAw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KCRJCbd1; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KCRJCbd1" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-21644aca3a0so82459945ad.3; Sun, 12 Jan 2025 18:37:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736735850; x=1737340650; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=jVpCT3rcttjqBCAryOiu/i2BhEIjXBBLZY4oPFbVZO8=; b=KCRJCbd13b4attLj4iwzB+gsOoZ1j+vyHNy2mnVxJ2cqvBzc5R3al0/030xn/9H5um 7rn8yMf8ny9YdHZ0ux0cA6MqdlHQtjTqTYBMPbvrsa6TekHov2hafGB3LKk6r2mcBMFy +Dqxtjm0TvI8eu1Si9Q3Zme244nZ10CowBkTI15v9FGmj61pGAGdvzCQK3yydOf+U4Xc RvLrj8f3B093zUxhZgU6HT2DVs0cWJwXZModcxAm/FRNQti1yDbfrqPDqRPdmuSOZZlY lyKaq9a/yv+uE4oELDadQm07/RNW8aN2bfavSq+DphYm8DLwKR11B/7carpJoWiYCTRL 2QBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736735850; x=1737340650; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jVpCT3rcttjqBCAryOiu/i2BhEIjXBBLZY4oPFbVZO8=; b=EKhS3g3q6ei3T9dISS+LOHTMLClIUL45edB45vDhYTVofaergFEV0NYLG6Rtpa9Np5 +qGlyFTt0lV13ClTVE/eaWEo70O/Mz0ESqrxiw4lrN7RwASDvNAGUlMLRRsROc6L+2d6 0OcHFmHkbhY4mUH8QCoLa7ZDUPkMJiNGJqABnZKpYJFcB+1ilTJvyu0G6AVkQH0eElqc nqBX9v+dr+E7bnov5IaEDH7sUxH+/zGCJ11/xnH27kDri+kCTn15ctYOjmUu939rc50y Sbf9FEKZgbQe4F+cEY6aB9g662i/0s2G3UUbWZQdeI8YSBMa9SzNRpUXSYyZ51WJaKl+ syng== X-Forwarded-Encrypted: i=1; AJvYcCVbH6gLZZbNocb6c6RafJQnAZKHRobBn9wZl5owR/7P8MPhplsax4qx8tjbovoSF1to+7sJS3o5@vger.kernel.org, AJvYcCXciO8u+Ra2LnPAH8MtPAumNe+bOzcv6E0x9cdRISjkj63krkaf+4hmYsGyVQJ/Rsw2erzJZlTR3/xTuJ8=@vger.kernel.org X-Gm-Message-State: AOJu0YxED3UHQZ6fPjVkiIQ8B/drwJZJDum2bz6rEJAUVGFEkbLs7IQR N1IeF0WIDI8dxu4Xaw+lLEw1tu3Eewg2Y7kMzDYx/7dUhUtuP3p3 X-Gm-Gg: ASbGnctMw/Z/f5z/n2CZ5LQ7DH/61kzhLbH7E5mXeM6ayH9gU/lXcQ4qhdjn4hlENmO 7JKz/ot13W3tlLZZdLITggW1l/sYuT15GibUZiQ4qbCEdVsGdEmeN7XTCbm65bF/LzY1z6ddNWV OgtHdPmuv1i29MOemTQDWVkOpD9aBAwv6cei4II9zvnX6zJvwqs3Ztabc1ObWiLqn8gNq9hB5OA UbKEVvHjMyDVswhoFe4qE6SwMNICz2P+8kJgQIk6aUruZX0WSsLTDgzwpOqk8RPZ+dRGOQE8HrL WC+ejCAD2A2w0Qq0yEWeWHF+igcQZP0w4g== X-Google-Smtp-Source: AGHT+IE5TKvbOESyK9xXOwvGK+IBt5u58ji2MA/Uoomwstpjcm7V1SUxV/hdXfskw10cXRlCE66W5A== X-Received: by 2002:a17:902:ea03:b0:216:2d42:2e05 with SMTP id d9443c01a7336-21a83f6fa87mr363502565ad.22.1736735850129; Sun, 12 Jan 2025 18:37:30 -0800 (PST) Received: from localhost.localdomain (61-220-246-151.hinet-ip.hinet.net. [61.220.246.151]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21a9f22d2dasm44639045ad.172.2025.01.12.18.37.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jan 2025 18:37:29 -0800 (PST) From: Potin Lai Date: Mon, 13 Jan 2025 10:34:47 +0800 Subject: [PATCH v3 1/2] net/ncsi: fix locking in Get MAC Address handling Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250113-fix-ncsi-mac-v3-1-564c8277eb1d@gmail.com> References: <20250113-fix-ncsi-mac-v3-0-564c8277eb1d@gmail.com> In-Reply-To: <20250113-fix-ncsi-mac-v3-0-564c8277eb1d@gmail.com> To: Samuel Mendoza-Jonas , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Ivan Mikhaylov , Paul Fertser , Patrick Williams Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmo Chou , Potin Lai , Potin Lai , stable@vger.kernel.org X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1736735843; l=4642; i=potin.lai.pt@gmail.com; s=20240724; h=from:subject:message-id; bh=cFqw/9YqoODz1OY0OrdpTECRIy/akueGHaQLjcYInTk=; b=aF9PMC6FRZuulNn9hyNXl5Syc4CTTDfVqO3hHLwj3mwYA4Rq5LUEJRlZlg9Taftw+vQkLiyRt O1vzrylk/67DkGxg3DL/OA5CzdE37W0HlrVVV2Vbe1aMtDoWuW9cmBJ X-Developer-Key: i=potin.lai.pt@gmail.com; a=ed25519; pk=6Z4H4V4fJwLteH/WzIXSsx6TkuY5FOcBBP+4OflJ5gM= X-Patchwork-Delegate: kuba@kernel.org From: Paul Fertser Obtaining RTNL lock in a response handler is not allowed since it runs in an atomic softirq context. Postpone setting the MAC address by adding a dedicated step to the configuration FSM. Fixes: 790071347a0a ("net/ncsi: change from ndo_set_mac_address to dev_set_mac_address") Cc: stable@vger.kernel.org Cc: Potin Lai Link: https://lore.kernel.org/20241129-potin-revert-ncsi-set-mac-addr-v1-1-94ea2cb596af@gmail.com Signed-off-by: Paul Fertser --- net/ncsi/internal.h | 2 ++ net/ncsi/ncsi-manage.c | 16 ++++++++++++++-- net/ncsi/ncsi-rsp.c | 19 ++++++------------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/net/ncsi/internal.h b/net/ncsi/internal.h index ef0f8f73826f..4e0842df5234 100644 --- a/net/ncsi/internal.h +++ b/net/ncsi/internal.h @@ -289,6 +289,7 @@ enum { ncsi_dev_state_config_sp = 0x0301, ncsi_dev_state_config_cis, ncsi_dev_state_config_oem_gma, + ncsi_dev_state_config_apply_mac, ncsi_dev_state_config_clear_vids, ncsi_dev_state_config_svf, ncsi_dev_state_config_ev, @@ -322,6 +323,7 @@ struct ncsi_dev_priv { #define NCSI_DEV_RESHUFFLE 4 #define NCSI_DEV_RESET 8 /* Reset state of NC */ unsigned int gma_flag; /* OEM GMA flag */ + struct sockaddr pending_mac; /* MAC address received from GMA */ spinlock_t lock; /* Protect the NCSI device */ unsigned int package_probe_id;/* Current ID during probe */ unsigned int package_num; /* Number of packages */ diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c index 5cf55bde366d..bf276eaf9330 100644 --- a/net/ncsi/ncsi-manage.c +++ b/net/ncsi/ncsi-manage.c @@ -1038,7 +1038,7 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp) : ncsi_dev_state_config_clear_vids; break; case ncsi_dev_state_config_oem_gma: - nd->state = ncsi_dev_state_config_clear_vids; + nd->state = ncsi_dev_state_config_apply_mac; nca.package = np->id; nca.channel = nc->id; @@ -1050,10 +1050,22 @@ static void ncsi_configure_channel(struct ncsi_dev_priv *ndp) nca.type = NCSI_PKT_CMD_OEM; ret = ncsi_gma_handler(&nca, nc->version.mf_id); } - if (ret < 0) + if (ret < 0) { + nd->state = ncsi_dev_state_config_clear_vids; schedule_work(&ndp->work); + } break; + case ncsi_dev_state_config_apply_mac: + rtnl_lock(); + ret = dev_set_mac_address(dev, &ndp->pending_mac, NULL); + rtnl_unlock(); + if (ret < 0) + netdev_warn(dev, "NCSI: 'Writing MAC address to device failed\n"); + + nd->state = ncsi_dev_state_config_clear_vids; + + fallthrough; case ncsi_dev_state_config_clear_vids: case ncsi_dev_state_config_svf: case ncsi_dev_state_config_ev: diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c index e28be33bdf2c..14bd66909ca4 100644 --- a/net/ncsi/ncsi-rsp.c +++ b/net/ncsi/ncsi-rsp.c @@ -628,16 +628,14 @@ static int ncsi_rsp_handler_snfc(struct ncsi_request *nr) static int ncsi_rsp_handler_oem_gma(struct ncsi_request *nr, int mfr_id) { struct ncsi_dev_priv *ndp = nr->ndp; + struct sockaddr *saddr = &ndp->pending_mac; struct net_device *ndev = ndp->ndev.dev; struct ncsi_rsp_oem_pkt *rsp; - struct sockaddr saddr; u32 mac_addr_off = 0; - int ret = 0; /* Get the response header */ rsp = (struct ncsi_rsp_oem_pkt *)skb_network_header(nr->rsp); - saddr.sa_family = ndev->type; ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE; if (mfr_id == NCSI_OEM_MFR_BCM_ID) mac_addr_off = BCM_MAC_ADDR_OFFSET; @@ -646,22 +644,17 @@ static int ncsi_rsp_handler_oem_gma(struct ncsi_request *nr, int mfr_id) else if (mfr_id == NCSI_OEM_MFR_INTEL_ID) mac_addr_off = INTEL_MAC_ADDR_OFFSET; - memcpy(saddr.sa_data, &rsp->data[mac_addr_off], ETH_ALEN); + saddr->sa_family = ndev->type; + memcpy(saddr->sa_data, &rsp->data[mac_addr_off], ETH_ALEN); if (mfr_id == NCSI_OEM_MFR_BCM_ID || mfr_id == NCSI_OEM_MFR_INTEL_ID) - eth_addr_inc((u8 *)saddr.sa_data); - if (!is_valid_ether_addr((const u8 *)saddr.sa_data)) + eth_addr_inc((u8 *)saddr->sa_data); + if (!is_valid_ether_addr((const u8 *)saddr->sa_data)) return -ENXIO; /* Set the flag for GMA command which should only be called once */ ndp->gma_flag = 1; - rtnl_lock(); - ret = dev_set_mac_address(ndev, &saddr, NULL); - rtnl_unlock(); - if (ret < 0) - netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n"); - - return ret; + return 0; } /* Response handler for Mellanox card */ From patchwork Mon Jan 13 02:34:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Potin Lai X-Patchwork-Id: 13936667 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 0E9F313DBA0; Mon, 13 Jan 2025 02:37:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736735855; cv=none; b=gXSR23cr7MC2yE7nG1w+/hyujQ2G1mASFCTqYIiZRyfkvmwOwon3wex9oHsvu1zOEAkMQJDZ7jBd2BleDKLlMuKhr0bwzmEAHKpno7o9Q7tJ9mgdd7bmsEeqVnYvR6R/5sI90AN4LbuQJ4nNqFj/uf3BC6kwVPXeoqfMX0JQG2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736735855; c=relaxed/simple; bh=K6gzNZaHfAuSLirvtETdA1F8MqDRR3VW1Q2Rr7rYRM8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XxnyEcdBekZvUgCVN3P0Rt2szQrWKIYVKaSlDGJNFpldiVLJUCQriKh1D2W8ghI9JoEV3pSf1vuYFTQ8WlurtnYX4/JXA8tUE0ApSoC194eTkkremvAzI8sZAA7KUWBxm2CTkQdgAUBBFwmlBJ/J8Zups2dsHcKlgNVX9P8ITNE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TqBArcGd; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TqBArcGd" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-21619108a6bso63169015ad.3; Sun, 12 Jan 2025 18:37:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736735853; x=1737340653; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=pCIzEBmjHcbdVFsyOCq/K70+Hj9yCzWnlFxUuAaeM4s=; b=TqBArcGdWaKvcPr0q8uRsVNvuaVPvcLl8mdChLY3IEa5+fOGg9emGr7VzS9y7waitb IJ5BJEndP5yL4qyw0yKsNVOOXHyAGH1Z5CrEs3jA4zL0akIJbs365Fws3HdKzTLHBWec 9VGhVHGU7gPqsPnaZ4mi5UkcDVoorAdvxVDQH4kR/7qBJG0azPk4yTEv4stdt07bGFlG 4dpLbRrUcCC0fz2Pb3uhftlQi6yGx1VV81GHFdXWPECzzm/d6hhF6bbrK10x+rxFSmAp RbB3W5D1K4sETEDFoW/pEjM1bD5P/PE1jSVUdPBE0RVfyf5VEMXkFo+Pa1XRJb7UVRde S3WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736735853; x=1737340653; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pCIzEBmjHcbdVFsyOCq/K70+Hj9yCzWnlFxUuAaeM4s=; b=Nmgm+nmIfCLAbsVLdSzgGgcJIfv+cFSYJW2Jgvl/LGL+I3gidIJBiyyCU6SxyLameJ s3rQbP9SGcQaMJimpXTbCCGu3+5KD7nac4g7JdGa72oumDDVSZKVc/J5EbsGVa5i1PxM KgNOhj/kmIn6s0gdStWr1UBWhCN1dM/+PdjfJr0mFkpI3B6+zGzrwHL07YUndPjH0aCi sb9mQu0msDxum0Y9JuUAhkV1EPSAS0A4OQxHC8kYLDUG+bd6QjLKu7Ny8R0fNgn4EaPp WXYnCBNzogFGxnBIZvrgWA+qESKT/4eLomG27deMi2lQk5rn+KZW2HJWcW8rPHy6GQ6M crHg== X-Forwarded-Encrypted: i=1; AJvYcCW88SBJTrD3H3n7DFYuYOqmoEMmcOpatqceLUVaSOPm8Um4+g5QgooxpV3zE2d1fgimWDOHgJtEJ2Q3wt0=@vger.kernel.org X-Gm-Message-State: AOJu0YwuFbH9IQxpXtfbNi5s5agoiIelj8+2AbFG3orSg8AOZMLIQWTp yD+Ip2pwnSKd0uBgR98/g3rGUiKFE6CW5fpmSbqzr4zztqddagp9 X-Gm-Gg: ASbGncvA3e7smI8PdzpbCICW9HccyDEaz1vcPVdAR7VA4qNfvmmloYWzF3f7ABsBwsk cb8jpaHIMZ9VI2ELehWs8aeR+yWfK28CgXeke4VSH51GVWv1cGbnxbvCIYueR53yx0PEIHqsG/L jxdlPwHdEUFkkR4z7rXtP98t+0MYm47IsHqFrOtH8iqhA9E5DkG2pHPiKk0Wm90c7IA/FICI3Xi Yd06ucQsu6HXBaAyDscQ3dTuZv7BAOjge3nufG4gB1g1M6GY8OeP7yFM7ruF/92UzsCbl9w4wKw WPaHPj0KRw3ex+Pbe4nvV4zv12yYChq2gg== X-Google-Smtp-Source: AGHT+IEdVuOZqroBYneBSuzqVyU9sDDFzZLJWh0eJOjqT0/6Z2B7oluRtIlYJlqEnXcdZ2GgwaZX5Q== X-Received: by 2002:a17:903:41c5:b0:215:19ae:77bf with SMTP id d9443c01a7336-21a83f4ea67mr292329925ad.19.1736735853291; Sun, 12 Jan 2025 18:37:33 -0800 (PST) Received: from localhost.localdomain (61-220-246-151.hinet-ip.hinet.net. [61.220.246.151]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21a9f22d2dasm44639045ad.172.2025.01.12.18.37.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jan 2025 18:37:32 -0800 (PST) From: Potin Lai Date: Mon, 13 Jan 2025 10:34:48 +0800 Subject: [PATCH v3 2/2] net/ncsi: fix state race during channel probe completion Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250113-fix-ncsi-mac-v3-2-564c8277eb1d@gmail.com> References: <20250113-fix-ncsi-mac-v3-0-564c8277eb1d@gmail.com> In-Reply-To: <20250113-fix-ncsi-mac-v3-0-564c8277eb1d@gmail.com> To: Samuel Mendoza-Jonas , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Ivan Mikhaylov , Paul Fertser , Patrick Williams Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmo Chou , Potin Lai , Potin Lai , Cosmo Chou X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1736735843; l=1067; i=potin.lai.pt@gmail.com; s=20240724; h=from:subject:message-id; bh=sce396V6hbw9EP8vuzvWyCBvqGSZSlupwpRkXmGkS5Q=; b=eVD64J/F+uLmFWqeWtNdl/FAGp9te8QtW83zFJZsaMwkR45JYAWdfknrNtmfoO7qnnsv+uoks z96oBCVl1MLDqza4hRznZsIK47UjmVUbsS42+ayl/olq0Ts8QEzWGP9 X-Developer-Key: i=potin.lai.pt@gmail.com; a=ed25519; pk=6Z4H4V4fJwLteH/WzIXSsx6TkuY5FOcBBP+4OflJ5gM= X-Patchwork-Delegate: kuba@kernel.org From: Cosmo Chou During channel probing, the last NCSI_PKT_CMD_DP command can trigger an unnecessary schedule_work() via ncsi_free_request(). We observed that subsequent config states were triggered before the scheduled work completed, causing potential state handling issues. Fix this by clearing req_flags when processing the last package. Fixes: 8e13f70be05e ("net/ncsi: Probe single packages to avoid conflict") Signed-off-by: Cosmo Chou --- net/ncsi/ncsi-manage.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c index bf276eaf9330..99e3a5883617 100644 --- a/net/ncsi/ncsi-manage.c +++ b/net/ncsi/ncsi-manage.c @@ -1491,7 +1491,10 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp) } break; case ncsi_dev_state_probe_dp: - ndp->pending_req_num = 1; + if (ndp->package_probe_id + 1 < 8) + ndp->pending_req_num = 1; + else + nca.req_flags = 0; /* Deselect the current package */ nca.type = NCSI_PKT_CMD_DP;