From 3f77162543610ee19e697f3398bf77262b527e2e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 31 Oct 2025 07:58:48 +0000 Subject: [PATCH] Revert "net: rtnetlink: add helper to extract msg type's kind" This reverts commit 85c154222dbadd0f7c864af11c0ffc6ae5f737ed which is commit 2e9ea3e30f696fd438319c07836422bb0bbb4608 upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I8cde97f239eaf15d952948581987bfa4f1bcb28b Signed-off-by: Greg Kroah-Hartman --- include/net/rtnetlink.h | 6 ------ net/core/rtnetlink.c | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index 034062f26943..f436c4f6e031 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h @@ -19,12 +19,6 @@ enum rtnl_kinds { RTNL_KIND_GET, RTNL_KIND_SET }; -#define RTNL_KIND_MASK 0x3 - -static inline enum rtnl_kinds rtnl_msgtype_kind(int msgtype) -{ - return msgtype & RTNL_KIND_MASK; -} void rtnl_register(int protocol, int msgtype, rtnl_doit_func, rtnl_dumpit_func, unsigned int flags); diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index b41f31a09a7c..2cdb07dd263b 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -5212,7 +5212,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, return 0; family = ((struct rtgenmsg *)nlmsg_data(nlh))->rtgen_family; - kind = rtnl_msgtype_kind(type); + kind = type&3; if (kind != RTNL_KIND_GET && !netlink_net_capable(skb, CAP_NET_ADMIN)) return -EPERM;