Commit d9e6d029 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso Committed by David S. Miller

[NETFILTER]: nfnetlink: remove duplicate checks in nfnetlink_check_attributes

Remove nfnetlink_check_attributes duplicates message size and callback
id checks. nfnetlink_find_client and nfnetlink_rcv_msg already do
such checks.
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 67ca3966
...@@ -149,17 +149,10 @@ static int ...@@ -149,17 +149,10 @@ static int
nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys, nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys,
struct nlmsghdr *nlh, struct nfattr *cda[]) struct nlmsghdr *nlh, struct nfattr *cda[])
{ {
int min_len; int min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));
u_int16_t attr_count; u_int16_t attr_count;
u_int8_t cb_id = NFNL_MSG_TYPE(nlh->nlmsg_type); u_int8_t cb_id = NFNL_MSG_TYPE(nlh->nlmsg_type);
if (unlikely(cb_id >= subsys->cb_count))
return -EINVAL;
min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));
if (unlikely(nlh->nlmsg_len < min_len))
return -EINVAL;
attr_count = subsys->cb[cb_id].attr_count; attr_count = subsys->cb[cb_id].attr_count;
memset(cda, 0, sizeof(struct nfattr *) * attr_count); memset(cda, 0, sizeof(struct nfattr *) * attr_count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment