diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index cc09283fd76ae74106d5982949dd9a560bdff2e6..b2136accd267ac420a255a36d5c84601e31b26dc 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -864,10 +864,6 @@ rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp) type = nlh->nlmsg_type; - /* A control message: ignore them */ - if (type < RTM_BASE) - return 0; - /* Unknown message: reply with EINVAL */ if (type > RTM_MAX) goto err_inval; diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 7b455980e9bfcd520f127c26541f8f1180ad794f..5d1079b1838c3880e8b3f6904bc14e86a433f840 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -1479,6 +1479,10 @@ static int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *, if (!(nlh->nlmsg_flags & NLM_F_REQUEST)) goto skip; + /* Skip control messages */ + if (nlh->nlmsg_type < NLMSG_MIN_TYPE) + goto skip; + if (cb(skb, nlh, &err) < 0) { /* Not an error, but we have to interrupt processing * here. Note: that in this case we do not pull diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 039516f6cd80443c7a8cf2dc3a78fe9e43e42ef6..95391e609046841eb88e2b16df193594d4b1d09a 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -304,9 +304,6 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, struct genlmsghdr *hdr = nlmsg_data(nlh); int hdrlen, err = -EINVAL; - if (nlh->nlmsg_type < NLMSG_MIN_TYPE) - goto ignore; - family = genl_family_find_byid(nlh->nlmsg_type); if (family == NULL) { err = -ENOENT; @@ -364,9 +361,6 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, *errp = err = ops->doit(skb, &info); return err; -ignore: - return 0; - errout: *errp = err; return -1; diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 913c8b727d8f623f7bd1dc02328da13fdc259547..4d2f2094e6dff787c202742cd152faa4c983a39f 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -1860,10 +1860,6 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *err type = nlh->nlmsg_type; - /* A control message: ignore them */ - if (type < XFRM_MSG_BASE) - return 0; - /* Unknown message: reply with EINVAL */ if (type > XFRM_MSG_MAX) goto err_einval;