[Openvpn-devel,net,v5,2/6] ovpn: use nla_put_u32 for the key ID attribute in ovpn_nl_key_swap_notify

Message ID 6e44855f0fcd704da43dd83b42a1236cb804c76e.1783336121.git.ralf@mandelbit.com
State New
Headers
Series ovpn: fix key and workqueue lifetime issues |

Commit Message

Ralf Lici July 6, 2026, 11:34 a.m. UTC
  Currently, in ovpn_nl_key_swap_notify, the OVPN_A_KEYCONF_KEY_ID
attribute is packed as a 16-bit value despite being defined as a 32-bit
u32 attribute in the YAML policy.

Fix this inconsistency by using nla_put_u32.

Fixes: 89d3c0e4612a ("ovpn: kill key and notify userspace in case of IV exhaustion")
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
---
Changes since v4 of this series https://lore.kernel.org/openvpn-devel/981d2ea51cca45138210aa52c6e5a0e55c0da7a0.1783099626.git.ralf@mandelbit.com/
- Add this previously posted standalone fix to the series so the whole
  set can be picked in order.
- No changes since v1 of the original single patch
  https://lore.kernel.org/openvpn-devel/8577555cc95646d0bd58a5b78e59c7e6a9b1a0c6.1783058844.git.ralf@mandelbit.com/

 drivers/net/ovpn/netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Sabrina Dubroca July 7, 2026, 10:30 a.m. UTC | #1
2026-07-06, 13:34:00 +0200, Ralf Lici wrote:
> Currently, in ovpn_nl_key_swap_notify, the OVPN_A_KEYCONF_KEY_ID
> attribute is packed as a 16-bit value despite being defined as a 32-bit
> u32 attribute in the YAML policy.
> 
> Fix this inconsistency by using nla_put_u32.

Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
  

Patch

diff --git a/drivers/net/ovpn/netlink.c b/drivers/net/ovpn/netlink.c
index 4c66c1ec497e..abf038206a62 100644
--- a/drivers/net/ovpn/netlink.c
+++ b/drivers/net/ovpn/netlink.c
@@ -1335,7 +1335,7 @@  int ovpn_nl_key_swap_notify(struct ovpn_peer *peer, u8 key_id)
 	if (nla_put_u32(msg, OVPN_A_KEYCONF_PEER_ID, peer->id))
 		goto err_cancel_msg;
 
-	if (nla_put_u16(msg, OVPN_A_KEYCONF_KEY_ID, key_id))
+	if (nla_put_u32(msg, OVPN_A_KEYCONF_KEY_ID, key_id))
 		goto err_cancel_msg;
 
 	nla_nest_end(msg, k_attr);