Archive-only list for patches
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Eelco Chaudron <echaudro@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Ilya Maximets <i.maximets@ovn.org>,
	Jakub Kicinski <kuba@kernel.org>, Sasha Levin <sashal@kernel.org>,
	aconole@redhat.com, netdev@vger.kernel.org, dev@openvswitch.org
Subject: [PATCH AUTOSEL 6.14 040/108] openvswitch: Stricter validation for the userspace action
Date: Tue,  3 Jun 2025 20:54:23 -0400	[thread overview]
Message-ID: <20250604005531.4178547-40-sashal@kernel.org> (raw)
In-Reply-To: <20250604005531.4178547-1-sashal@kernel.org>

From: Eelco Chaudron <echaudro@redhat.com>

[ Upstream commit 88906f55954131ed2d3974e044b7fb48129b86ae ]

This change enhances the robustness of validate_userspace() by ensuring
that all Netlink attributes are fully contained within the parent
attribute. The previous use of nla_parse_nested_deprecated() could
silently skip trailing or malformed attributes, as it stops parsing at
the first invalid entry.

By switching to nla_parse_deprecated_strict(), we make sure only fully
validated attributes are copied for later use.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
Link: https://patch.msgid.link/67eb414e2d250e8408bb8afeb982deca2ff2b10b.1747037304.git.echaudro@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

**YES** This commit should be backported to stable kernel trees. ##
Analysis **Commit Overview:** The commit changes `validate_userspace()`
function in `net/openvswitch/flow_netlink.c` by replacing
`nla_parse_nested_deprecated()` with `nla_parse_deprecated_strict()` to
ensure stricter validation of Netlink attributes for the userspace
action. **Specific Code Changes:** The key change is on lines 3052-3054:
```c // Before: error = nla_parse_nested_deprecated(a,
OVS_USERSPACE_ATTR_MAX, attr, userspace_policy, NULL); // After: error =
nla_parse_deprecated_strict(a, OVS_USERSPACE_ATTR_MAX, nla_data(attr),
nla_len(attr), userspace_policy, NULL); ``` **Why This Should Be
Backported:** 1. **Security Enhancement:** This commit addresses a
parsing vulnerability where malformed attributes could be silently
ignored. The original `nla_parse_nested_deprecated()` stops parsing at
the first invalid entry, potentially allowing trailing malformed data to
bypass validation. 2. **Robustness Fix:** The change ensures all netlink
attributes are fully contained within the parent attribute bounds,
preventing potential buffer over-reads or under-reads that could lead to
security issues. 3. **Pattern Consistency:** Looking at the git blame
output (lines 3085-3087), we can see that
`nla_parse_deprecated_strict()` was already introduced in 2019 by commit
8cb081746c031 and is used elsewhere in the same file for similar
validation (e.g., `validate_and_copy_check_pkt_len()` function). 4.
**Low Risk:** This is a small, contained change that only affects input
validation - it doesn't change functionality or introduce new features.
The change is defensive and follows existing patterns in the codebase.
5. **Similar Precedent:** This commit is very similar to the validated
"Similar Commit #2" which was marked for backporting (status: YES). That
commit also dealt with netlink attribute validation safety in
openvswitch (`validate_set()` function) and was considered suitable for
stable trees. 6. **Critical Subsystem:** Open vSwitch is a critical
networking component used in virtualization and container environments.
Input validation issues in this subsystem could potentially be exploited
for privilege escalation or denial of service. 7. **Clear Intent:** The
commit message explicitly states this "enhances robustness" and ensures
"only fully validated attributes are copied for later use," indicating
this is a defensive security improvement. **Risk Assessment:** - Very
low regression risk - No API changes - Only affects error handling paths
- Follows established validation patterns in the same codebase This
commit fits perfectly into the stable tree criteria: it's an important
security/robustness fix, has minimal risk of regression, is well-
contained, and addresses a clear validation vulnerability in a critical
kernel subsystem.

 net/openvswitch/flow_netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 518be23e48ea9..ad64bb9ab5e25 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -3049,7 +3049,8 @@ static int validate_userspace(const struct nlattr *attr)
 	struct nlattr *a[OVS_USERSPACE_ATTR_MAX + 1];
 	int error;
 
-	error = nla_parse_nested_deprecated(a, OVS_USERSPACE_ATTR_MAX, attr,
+	error = nla_parse_deprecated_strict(a, OVS_USERSPACE_ATTR_MAX,
+					    nla_data(attr), nla_len(attr),
 					    userspace_policy, NULL);
 	if (error)
 		return error;
-- 
2.39.5


  parent reply	other threads:[~2025-06-04  0:56 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-04  0:53 [PATCH AUTOSEL 6.14 001/108] net: macb: Check return value of dma_set_mask_and_coherent() Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 002/108] net: lan743x: Modify the EEPROM and OTP size for PCI1xxxx devices Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 003/108] tipc: use kfree_sensitive() for aead cleanup Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 004/108] f2fs: use vmalloc instead of kvmalloc in .init_{,de}compress_ctx Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 005/108] bpf: Check rcu_read_lock_trace_held() in bpf_map_lookup_percpu_elem() Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 006/108] Bluetooth: btusb: Add new VID/PID 13d3/3584 for MT7922 Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 007/108] i2c: designware: Invoke runtime suspend on quick slave re-registration Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 008/108] wifi: mt76: mt7996: drop fragments with multicast or broadcast RA Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 009/108] emulex/benet: correct command version selection in be_cmd_get_stats() Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 010/108] Bluetooth: btusb: Add new VID/PID 13d3/3630 for MT7925 Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 011/108] Bluetooth: btusb: Add RTL8851BE device 0x0bda:0xb850 Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 012/108] Bluetooth: ISO: Fix not using SID from adv report Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 013/108] Bluetooth: btmrvl_sdio: Fix wakeup source leaks on device unbind Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 014/108] Bluetooth: btmtksdio: " Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 015/108] wifi: mt76: mt76x2: Add support for LiteOn WN4516R,WN4519R Sasha Levin
2025-06-04  0:53 ` [PATCH AUTOSEL 6.14 016/108] wifi: mt76: mt7921: add 160 MHz AP for mt7922 device Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 017/108] wifi: mt76: mt7925: introduce thermal protection Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 018/108] wifi: mac80211: validate SCAN_FLAG_AP in scan request during MLO Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 019/108] sctp: Do not wake readers in __sctp_write_space() Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 020/108] libbpf/btf: Fix string handling to support multi-split BTF Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 021/108] cpufreq: scmi: Skip SCMI devices that aren't used by the CPUs Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 022/108] i2c: tegra: check msg length in SMBUS block read Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 023/108] i2c: npcm: Add clock toggle recovery Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 024/108] clk: qcom: gcc-x1e80100: Set FORCE MEM CORE for UFS clocks Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 025/108] clk: qcom: gcc: Set FORCE_MEM_CORE_ON for gcc_ufs_axi_clk for 8650/8750 Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 026/108] net: dlink: add synchronization for stats update Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 027/108] wifi: ath12k: fix macro definition HAL_RX_MSDU_PKT_LENGTH_GET Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 028/108] wifi: ath12k: fix a possible dead lock caused by ab->base_lock Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 029/108] wifi: ath11k: Fix QMI memory reuse logic Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 030/108] iommu/amd: Allow matching ACPI HID devices without matching UIDs Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 031/108] wifi: rtw89: leave idle mode when setting WEP encryption for AP mode Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 032/108] tcp: always seek for minimal rtt in tcp_rcv_rtt_update() Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 033/108] tcp: remove zero TCP TS samples for autotuning Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 034/108] tcp: fix initial tp->rcvq_space.space value for passive TS enabled flows Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 035/108] tcp: add receive queue awareness in tcp_rcv_space_adjust() Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 036/108] x86/sgx: Prevent attempts to reclaim poisoned pages Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 037/108] ipv4/route: Use this_cpu_inc() for stats on PREEMPT_RT Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 038/108] net: page_pool: Don't recycle into cache " Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 039/108] xfrm: validate assignment of maximal possible SEQ number Sasha Levin
2025-06-04  0:54 ` Sasha Levin [this message]
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 041/108] net: atlantic: generate software timestamp just before the doorbell Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 042/108] pinctrl: armada-37xx: propagate error from armada_37xx_pmx_set_by_name() Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 043/108] pinctrl: armada-37xx: propagate error from armada_37xx_gpio_get_direction() Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 044/108] bpf: Pass the same orig_call value to trampoline functions Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 045/108] net: stmmac: generate software timestamp just before the doorbell Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 046/108] pinctrl: armada-37xx: propagate error from armada_37xx_pmx_gpio_set_direction() Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 047/108] libbpf: Check bpf_map_skeleton link for NULL Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 048/108] pinctrl: armada-37xx: propagate error from armada_37xx_gpio_get() Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 049/108] net/mlx5: HWS, fix counting of rules in the matcher Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 050/108] net: mlx4: add SOF_TIMESTAMPING_TX_SOFTWARE flag when getting ts info Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 051/108] net: vertexcom: mse102x: Return code for mse102x_rx_pkt_spi Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 052/108] wifi: rtw88: rtw8822bu VID/PID for BUFFALO WI-U2-866DM Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 053/108] wireless: purelifi: plfxlc: fix memory leak in plfxlc_usb_wreq_asyn() Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 054/108] wifi: mac80211: do not offer a mesh path if forwarding is disabled Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 055/108] bpftool: Fix cgroup command to only show cgroup bpf programs Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 056/108] clk: rockchip: rk3036: mark ddrphy as critical Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 057/108] hid-asus: check ROG Ally MCU version and warn Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 058/108] rtla: Define __NR_sched_setattr for LoongArch Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 059/108] wifi: iwlwifi: mvm: fix beacon CCK flag Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 060/108] wifi: iwlwifi: dvm: pair transport op-mode enter/leave Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 061/108] bpf: Add bpf_rbtree_{root,left,right} kfunc Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 062/108] f2fs: fix to bail out in get_new_segment() Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 063/108] netfilter: nft_set_pipapo: clamp maximum map bucket size to INT_MAX Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 064/108] libbpf: Add identical pointer detection to btf_dedup_is_equiv() Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 065/108] scsi: lpfc: Fix lpfc_check_sli_ndlp() handling for GEN_REQUEST64 commands Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 066/108] scsi: smartpqi: Add new PCI IDs Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 067/108] iommu/amd: Ensure GA log notifier callbacks finish running before module unload Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 068/108] wifi: iwlwifi: pcie: make sure to lock rxq->read Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 069/108] wifi: rtw89: 8922a: fix TX fail with wrong VCO setting Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 070/108] wifi: mac80211_hwsim: Prevent tsf from setting if beacon is disabled Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 071/108] netdevsim: Mark NAPI ID on skb in nsim_rcv Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 072/108] net/mlx5: HWS, Fix IP version decision Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 073/108] bpf: Use proper type to calculate bpf_raw_tp_null_args.mask index Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 074/108] wifi: mac80211: VLAN traffic in multicast path Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 075/108] Revert "mac80211: Dynamically set CoDel parameters per station" Sasha Levin
2025-06-04  0:54 ` [PATCH AUTOSEL 6.14 076/108] wifi: iwlwifi: Add missing MODULE_FIRMWARE for Qu-c0-jf-b0 Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 077/108] net: bridge: mcast: update multicast contex when vlan state is changed Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 078/108] net: bridge: mcast: re-implement br_multicast_{enable, disable}_port functions Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 079/108] vxlan: Do not treat dst cache initialization errors as fatal Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 080/108] bnxt_en: Remove unused field "ref_count" in struct bnxt_ulp Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 081/108] vxlan: Add RCU read-side critical sections in the Tx path Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 082/108] wifi: ath12k: correctly handle mcast packets for clients Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 083/108] wifi: ath12k: using msdu end descriptor to check for rx multicast packets Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 084/108] net: ethernet: ti: am65-cpsw: handle -EPROBE_DEFER Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 085/108] software node: Correct a OOB check in software_node_get_reference_args() Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 086/108] wifi: ath12k: make assoc link associate first Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 087/108] isofs: fix Y2038 and Y2156 issues in Rock Ridge TF entry Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 088/108] pinctrl: mcp23s08: Reset all pins to input at probe Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 089/108] wifi: ath12k: fix failed to set mhi state error during reboot with hardware grouping Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 090/108] scsi: lpfc: Use memcpy() for BIOS version Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 091/108] sock: Correct error checking condition for (assign|release)_proto_idx() Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 092/108] i40e: fix MMIO write access to an invalid page in i40e_clear_hw Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 093/108] ixgbe: Fix unreachable retry logic in combined and byte I2C write functions Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 094/108] RDMA/hns: initialize db in update_srq_db() Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 095/108] ice: fix check for existing switch rule Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 096/108] usbnet: asix AX88772: leave the carrier control to phylink Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 097/108] f2fs: fix to set atomic write status more clear Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 098/108] bpf, sockmap: Fix data lost during EAGAIN retries Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 099/108] net: ethernet: cortina: Use TOE/TSO on all TCP Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 100/108] octeontx2-pf: Add error log forcn10k_map_unmap_rq_policer() Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 101/108] wifi: ath12k: Fix incorrect rates sent to firmware Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 102/108] wifi: ath12k: Fix the enabling of REO queue lookup table feature Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 103/108] wifi: ath12k: Fix memory leak due to multiple rx_stats allocation Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 104/108] wifi: ath11k: determine PM policy based on machine model Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 105/108] wifi: ath12k: fix link valid field initialization in the monitor Rx Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 106/108] wifi: ath12k: fix incorrect CE addresses Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 107/108] wifi: ath12k: Pass correct values of center freq1 and center freq2 for 160 MHz Sasha Levin
2025-06-04  0:55 ` [PATCH AUTOSEL 6.14 108/108] net/mlx5: HWS, Harden IP version definer checks Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250604005531.4178547-40-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=aconole@redhat.com \
    --cc=dev@openvswitch.org \
    --cc=echaudro@redhat.com \
    --cc=horms@kernel.org \
    --cc=i.maximets@ovn.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox