[NETLINK]: Remove error pointer from netlink message handler
The error pointer argument in netlink message handlers is used to signal the special case where processing has to be interrupted because a dump was started but no error happened. Instead it is simpler and more clear to return -EINTR and have netlink_run_queue() deal with getting the queue right. nfnetlink passed on this error pointer to its subsystem handlers but only uses it to signal the start of a netlink dump. Therefore it can be removed there as well. This patch also cleans up the error handling in the affected message handlers to be consistent since it had to be touched anyway. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
45e7ae7f71
commit
1d00a4eb42
@ -195,17 +195,14 @@ int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags)
|
||||
EXPORT_SYMBOL_GPL(nfnetlink_unicast);
|
||||
|
||||
/* Process one complete nfnetlink message. */
|
||||
static int nfnetlink_rcv_msg(struct sk_buff *skb,
|
||||
struct nlmsghdr *nlh, int *errp)
|
||||
static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||
{
|
||||
struct nfnl_callback *nc;
|
||||
struct nfnetlink_subsystem *ss;
|
||||
int type, err = 0;
|
||||
int type, err;
|
||||
|
||||
if (security_netlink_recv(skb, CAP_NET_ADMIN)) {
|
||||
*errp = -EPERM;
|
||||
return -1;
|
||||
}
|
||||
if (security_netlink_recv(skb, CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
/* Only requests are handled by kernel now. */
|
||||
if (!(nlh->nlmsg_flags & NLM_F_REQUEST))
|
||||
@ -227,12 +224,12 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb,
|
||||
ss = nfnetlink_get_subsys(type);
|
||||
if (!ss)
|
||||
#endif
|
||||
goto err_inval;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
nc = nfnetlink_find_client(type, ss);
|
||||
if (!nc)
|
||||
goto err_inval;
|
||||
return -EINVAL;
|
||||
|
||||
{
|
||||
u_int16_t attr_count =
|
||||
@ -243,16 +240,9 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb,
|
||||
|
||||
err = nfnetlink_check_attributes(ss, nlh, cda);
|
||||
if (err < 0)
|
||||
goto err_inval;
|
||||
|
||||
err = nc->call(nfnl, skb, nlh, cda, errp);
|
||||
*errp = err;
|
||||
return err;
|
||||
return err;
|
||||
return nc->call(nfnl, skb, nlh, cda);
|
||||
}
|
||||
|
||||
err_inval:
|
||||
*errp = -EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void nfnetlink_rcv(struct sock *sk, int len)
|
||||
|
Reference in New Issue
Block a user