From nobody Wed Dec 17 13:53:21 2025 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (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 484CA22C9FB for ; Mon, 13 Jan 2025 16:30:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736785823; cv=none; b=VuHi48onDIQYwg3K1PCYc/c6CNoH0u1iSo0CKn4NDXVloDBcoR5Rm3TTGvwupAqjD82HpCuFSWURZxbhH41egLaESrIYZv2Ke80UsH+3BhWGWeFdEr5+ZB5KVnRMxkNEh/lvpQLYH74lofyjL2uvOY+V75HqAB+7U9ngD6M1K8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736785823; c=relaxed/simple; bh=vn17tQTRifoU70IvEay/XlrsOY6DOtxSrwCeMLSZhpY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=IKeM/aH8gOcBoYy15jcPShor0oi/6/Buvut96BySMp8sCwshJ1/Mbr58CtPlMZQezRSZaJAKiHcK7VfFC/8yo07CUQXhF+Mbvr9fY+DIhZVQ4FOxOpoXl88uBDSx7WTtRqDid+/mu8TH79VTCo/kL0W6TOoBqv4Yu0UEuU7xGwk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=goFtUNsy; arc=none smtp.client-ip=95.215.58.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="goFtUNsy" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1736785815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=pl+wZ2x+ZdqTG0lEglmVegKw0Hhj58CtH64CcDGmvHU=; b=goFtUNsyFKOML04zHS6B/aG6lQPGVAgvkHREkRd2ONO2kArsAR7tInmmevzqhWY7ZgLB0p qj2BwfUGVQtBR2KQBzOMycMYLcIVBaKzWuFp0SRU4pNkNUo3I2Fuefx9NpdXGEL+H6AWu3 TK6FoJ+cChKKcMoOIWi3B7rC1oB5+S4= From: Sean Anderson To: Radhey Shyam Pandey , Shannon Nelson , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Simon Horman , Michal Simek , linux-kernel@vger.kernel.org, Daniel Borkmann , Sean Anderson Subject: [PATCH net v5] net: xilinx: axienet: Fix IRQ coalescing packet count overflow Date: Mon, 13 Jan 2025 11:30:00 -0500 Message-Id: <20250113163001.2335235-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" If coalesce_count is greater than 255 it will not fit in the register and will overflow. This can be reproduced by running # ethtool -C ethX rx-frames 256 which will result in a timeout of 0us instead. Fix this by checking for invalid values and reporting an error. Fixes: 8a3b7a252dca ("drivers/net/ethernet/xilinx: added Xilinx AXI Etherne= t driver") Signed-off-by: Sean Anderson Reviewed-by: Shannon Nelson --- Changes in v5: - Fix typo in commit message Changes in v4: - Fix checking rx twice instead of rx and tx Changes in v3: - Validate and reject instead of silently clamping Changes in v2: - Use FIELD_MAX to extract the max value from the mask - Expand the commit message with an example on how to reproduce this issue drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/ne= t/ethernet/xilinx/xilinx_axienet_main.c index 0f4b02fe6f85..ae743991117c 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2056,6 +2056,12 @@ axienet_ethtools_set_coalesce(struct net_device *nde= v, return -EBUSY; } =20 + if (ecoalesce->rx_max_coalesced_frames > 255 || + ecoalesce->tx_max_coalesced_frames > 255) { + NL_SET_ERR_MSG(extack, "frames must be less than 256"); + return -EINVAL; + } + if (ecoalesce->rx_max_coalesced_frames) lp->coalesce_count_rx =3D ecoalesce->rx_max_coalesced_frames; if (ecoalesce->rx_coalesce_usecs) --=20 2.35.1.1320.gc452695387.dirty