From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 CBCC42AD00; Sun, 7 Jun 2026 10:15:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780827327; cv=none; b=rshOFcogdRtVpo4o6VcUc/uCogauD6SkVHTF4Uuhp+JgkvX9c5V58GedEXS0uusAWSpZvdXesSknhSR3sUA1npjMpKdgLfcC+6SBCv6LtSeEpLgYA7QFca1a0caLt9JxTIVEDbhC7StJwGsoftY35NdT5oISjl0hzPExR4DoyTI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780827327; c=relaxed/simple; bh=3le2oB+CUbOm7avqVjR8zIu77Id6WTH+J8rXbFwR/BM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dqxWHnQu/hHEIEdoZqqK1HSgZSWniRvZDFnwAfgh3eu/4hBopgPqeQitdNxh3taOwf9sw7la0vIWVzb/jhFXKTIfr2emsWOKKJNyXsz+gD46zR2L9/PpXLE7XxrJ5rho5G2tRBZ3oMP1k9rLSOUCZNopTo6QEh5wqIiQs2eNEO8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wiHIKuE2; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wiHIKuE2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC67B1F00893; Sun, 7 Jun 2026 10:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780827326; bh=lOKrafmHx/YbRlBLzvsmaNz2Y1ws2p3HsiAzudl/mRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wiHIKuE2gReNzvmobdlBVl2ypnem7OkD9vzTe+CVCEcTfH7quC12Irx/0tWFiFuml MCLRxZA1sdvKtFJZQlxXckJtaXf82i3ltocEDl3EQDgcVUukJIKKE0HSCjTFQ8k31p RLWViRzHCNq/4/1w89UWjc8hRpbZfjNT6ESRx3K8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Maxime Chevallier , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 064/315] ethtool: coalesce: cap profile updates at NET_DIM_PARAMS_NUM_PROFILES Date: Sun, 7 Jun 2026 11:57:31 +0200 Message-ID: <20260607095729.959359049@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095727.528828913@linuxfoundation.org> References: <20260607095727.528828913@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jakub Kicinski [ Upstream commit 7281b096b072f6c6e30420e3467d738f2e4c4b57 ] ethnl_update_profile() walks the ETHTOOL_A_PROFILE_IRQ_MODERATION nest list with an index 'i' and writes new_profile[i++] without bounding i. The destination is kmemdup()'d at NET_DIM_PARAMS_NUM_PROFILES entries (5), but the Netlink nest count is entirely user-controlled. Netlink policies do not have support for constraining the number of nested entries (or number of multi-attr entries). Fixes: f750dfe825b9 ("ethtool: provide customized dim profile management") Reviewed-by: Maxime Chevallier Link: https://patch.msgid.link/20260526153533.2779187-2-kuba@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ethtool/coalesce.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ethtool/coalesce.c b/net/ethtool/coalesce.c index 3e18ca1ccc5ef6..cace02d964cb21 100644 --- a/net/ethtool/coalesce.c +++ b/net/ethtool/coalesce.c @@ -463,6 +463,12 @@ static int ethnl_update_profile(struct net_device *dev, nla_for_each_nested_type(nest, ETHTOOL_A_PROFILE_IRQ_MODERATION, nests, rem) { + if (i >= NET_DIM_PARAMS_NUM_PROFILES) { + NL_SET_BAD_ATTR(extack, nest); + ret = -E2BIG; + goto err_out; + } + ret = nla_parse_nested(tb, len_irq_moder - 1, nest, coalesce_irq_moderation_policy, extack); -- 2.53.0