git: f2a49434b550 - stable/14 - netlink/route: fix fib number validation in old Linux compat mode

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Mon, 31 Mar 2025 17:31:41 UTC
The branch stable/14 has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=f2a49434b550df350bb5b311f701c6e3e6d9af36

commit f2a49434b550df350bb5b311f701c6e3e6d9af36
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-01-29 22:06:57 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-03-31 17:31:21 +0000

    netlink/route: fix fib number validation in old Linux compat mode
    
    The value passed via old field also needs to be validated.
    
    PR:                     283848
    Fixes:                  f34aca55adef1e28cd68b2e6705a0cac03f0238e
    (cherry picked from commit 031fbf8dc962ca8d458b217ba2b4a9e637b7e932)
---
 sys/netlink/route/rt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/netlink/route/rt.c b/sys/netlink/route/rt.c
index 410b1b04b6fc..abbcc075dde3 100644
--- a/sys/netlink/route/rt.c
+++ b/sys/netlink/route/rt.c
@@ -953,10 +953,10 @@ rtnl_handle_newroute(struct nlmsghdr *hdr, struct nlpcb *nlp,
 		return (EINVAL);
 	}
 
-	if (attrs.rtm_table > 0 && attrs.rta_table == 0) {
-		/* pre-2.6.19 Linux API compatibility */
+	/* pre-2.6.19 Linux API compatibility */
+	if (attrs.rtm_table > 0 && attrs.rta_table == 0)
 		attrs.rta_table = attrs.rtm_table;
-	} else if (attrs.rta_table >= V_rt_numfibs) {
+	if (attrs.rta_table >= V_rt_numfibs) {
 		NLMSG_REPORT_ERR_MSG(npt, "invalid fib");
 		return (EINVAL);
 	}