From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 763C033291F for ; Thu, 28 May 2026 20:52:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780001571; cv=none; b=axVwRjhb5lZrEEHMJb/DsJVbCcFrmwXJgBoV8ASu0JrdmP573G2DnS/sSam5pGbLXiWQujSCrCdAxZcgLoXv/84v9oFmLr1pY43vy67CQmsugtxTNTD4F59OVo3CKNKC0BfdPt2UeSKTgIxfPq2vp5CmKomeL0MlpUmHQWUodHk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780001571; c=relaxed/simple; bh=5lXklgMxShwBwdT+Aj+Qb2oCq32nbmorVYaWfS1Wg+g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NyPaVixiPebFuk7uQ1539Mu2gKlV9pWmetyrq/vy5mKzNcpOopWCBd9N/VtREhUga+VqB0OtiojbEI1z8oyGwYFBgt4Bl9dVojXR3Xk/wRR+XvI/+QCqBdiuGp/ej+uiTJ3AMWp6ti7VTDFWHi2M5V6w5Oz/o4CCDf5Y+H2XjT4= 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=BpyaJpuo; arc=none smtp.client-ip=209.85.221.51 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="BpyaJpuo" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-44dd5cb0f81so9239779f8f.0 for ; Thu, 28 May 2026 13:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780001569; x=1780606369; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XojjIRDhIyxrDp1Lf41UPx11rtEM/hZDetN38j+qBos=; b=BpyaJpuoEQV46HKKD2INzzbc1N463T6OJlkeTiwDtxcyxvbG/PEzliVim5oY7YgLux dnSmSrd3MwKOlbLjCMXnJ0j7xrqp4KlLBfBinRHsg/NFJrg03GQ7+uNZPAM4X5zXMri0 u8dCvC4aVhIhmF/mVN2juI80SXrkkLz4XsDNC98loVrCSjhxoiXuSCTq57fivWEbU4ey g3LeOxGjOcvmchFt+KDPv8ZkxAOcptJXh54VZkJGV9sBocwvoljriMLr8+LLdHC297Bc aiWPBNLiDTGXfjiDcLXH0+IkrzSJwysB5T/xn9Mh4SMQu6B8YhWBSQwkEu3P5xe1R0hZ f8ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780001569; x=1780606369; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XojjIRDhIyxrDp1Lf41UPx11rtEM/hZDetN38j+qBos=; b=APuuoJ5bS94dbAavvD1d8sfir/4/MkifUGlSIjuYiCskakCu0NVzNXlv7jqWRN+zrK nccWs9U+SGDEHVNOmqSqb0/IurFhQUilAEAAmPBV/OmWkEKVn5bXsNCmF96m6FUJP8is 2YhiCK/YPu3rL2Z6wIexafLaqrWjKYu952Io9Rr1kMDuSFaQUtHqvy9xNpWPDENnsmG9 GMkhvumuom7q7MTYkkwC4tmX7MXICpCNRBq3sucmmrkQmBZadwIg+HzMYiyxszP3HrAQ cpSi1ITsQLJkQARzyUpTfauqXaLRczOWkalksn7MMVwKY7JJTC44YDiXnhHk09Ulw9pl i3gA== X-Forwarded-Encrypted: i=1; AFNElJ8azRM6rpY76aSYsZWM3JdGfob6ni5gx0mPKgyEh4cOxzYrqequCL318a1uGeDpzjDXgKLWDZ4kqAJdbHE=@vger.kernel.org X-Gm-Message-State: AOJu0YxcNiARC/y2wkZ8meXOggkma0Iarf+Yzr2/vSksiP4MDLoJYSse A0hn/Fag92Ax3GyIanAFpW0CmOFIMqt6IMfUROP3zjz+3vDoHsRWMwIH X-Gm-Gg: Acq92OH00fq7+lQo8tImnNWc94cTpBYgH31eNTBXPoUnnHGzvs+cg8P8Em2je+Pd0Ew Fu42/rRv0tJYNRuZ2/HFNQyq+rzTzAT52vXCbWEVmCRtBuFPiuocTIur8KONUrQoxAbal7jaCBA +j1YouL1T+5yo8rj4Vez6a51ECCImgz6NNUu1whIe6q0aN9AISrRzrWp/uFZR1G7WgM9oEefiHj n5yIJRoaWuK0ow4+h6I4F9IsHFlEsIu8XNM+rTTkyHIUD2cVLBzft4ZhZCPE4inv5ygga0n0ayq iXe5Tb9u4HLOdq6/6lIVdoL4wuS+COfiAV8dtw29QDfpxf5bpE/wnp1E9CXHjmlN7EWriKPK1kG KVkuM1Pxc9dDfU+lUj+aZXpqbErJLOTCqqBARG6SyNWQgexi6/VFRylPbKY2lngphRqzqiee0TF r0XinZadEWn3n/V0QfEM6iM0FMGP6RwwWm5dey X-Received: by 2002:a05:6000:200f:b0:45e:89e9:348b with SMTP id ffacd0b85a97d-45ef1339797mr104379f8f.7.1780001568888; Thu, 28 May 2026 13:52:48 -0700 (PDT) Received: from builder ([2001:9e8:f104:6516:be24:11ff:fe30:5d85]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45ee5a84e92sm7104028f8f.35.2026.05.28.13.52.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 May 2026 13:52:48 -0700 (PDT) From: Jonas Jelonek To: Russell King , Andrew Lunn , Heiner Kallweit , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Chevallier Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Bj=C3=B8rn=20Mork?= , Simon Horman , Jonas Jelonek , stable@vger.kernel.org Subject: [PATCH net-next v9 1/3] net: sfp: initialize i2c_block_size at adapter configure time Date: Thu, 28 May 2026 20:52:40 +0000 Message-ID: <20260528205242.971410-2-jelonek.jonas@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260528205242.971410-1-jelonek.jonas@gmail.com> References: <20260528205242.971410-1-jelonek.jonas@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit sfp->i2c_block_size is only assigned in sfp_sm_mod_probe(), which runs from the state machine timer after SFP_F_PRESENT has been set. Between those two points, sfp_module_eeprom() (the ethtool -m callback) gates only on SFP_F_PRESENT and can be entered with i2c_block_size still at its kzalloc'd value of 0. On a pure-I2C adapter, sfp_i2c_read() then issues an i2c_transfer() with msgs[1].len = 0 inside a loop that subtracts this_len from len each iteration; on adapters that succeed a zero-length read the loop never advances, spinning while holding rtnl_lock. This was previously addressed by initializing i2c_block_size in sfp_alloc() (commit 813c2dd78618), but the initialization was dropped when i2c_block_size was split from i2c_max_block_size. Initialize sfp->i2c_block_size from sfp->i2c_max_block_size in sfp_i2c_configure(), so the field is valid as soon as the adapter is known. sfp_sm_mod_probe() still reassigns it on each module insertion to recover from a per-module clamp to 1 (sfp_id_needs_byte_io). Fixes: 7662abf4db94 ("net: phy: sfp: Add support for SMBus module access") Cc: stable@vger.kernel.org Signed-off-by: Jonas Jelonek --- drivers/net/phy/sfp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 7a865f69a6bd..376f7232f9ee 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -824,6 +824,7 @@ static int sfp_i2c_configure(struct sfp *sfp, struct i2c_adapter *i2c) return -EINVAL; } + sfp->i2c_block_size = sfp->i2c_max_block_size; return 0; } -- 2.51.0