net: inet_diag -- Return error code if protocol handler is missed
Subsystems (2)
PATCH 1/1 net: inet_diag -- Return error code if protocol handler is missed
We've observed that in case if UDP diag module is not supported in kernel the netlink returns NLMSG_DONE without notifying a caller that handler is missed.
This patch makes __inet_diag_dump to return error code instead.
So as example it become possible to detect such situation and handle it gracefully on userspace level.
--- net/ipv4/inet_diag.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv4/inet_diag.c +4 -1
@@ -895,13 +895,16 @@ static int __inet_diag_dump(struct sk_bu struct inet_diag_req_v2 *r, struct nlattr *bc) { const struct inet_diag_handler *handler; +int err =0 ; handler =inet_diag_lock_handler (r->sdiag_protocol);if (!IS_ERR (handler)) handler->dump (skb, cb, r, bc); +else + err =PTR_ERR (handler);inet_diag_unlock_handler (handler); -return skb->len; +return err ? : skb->len; }static int inet_diag_dump (struct sk_buff *skb,struct netlink_callback *cb)
Quoted 6 lines · Cyrill Gorcunov
We've observed that in case if UDP diag module is not supported in kernel the netlink returns
NLMSG_DONEwithout notifying a caller that handler is missed.This patch makes
__inet_diag_dumpto return error code instead.
Quoted 7 lines
So as example it become possible to detect such situation and handle it gracefully on userspace level.
Signed-off-by Cyrill Gorcunov <[email protected]>CC David Miller <[email protected]>CC Eric Dumazet <[email protected]>CC Pavel Emelyanov <[email protected]>
From: Pavel Emelyanov <[email protected]>
Date: Sun, 04 Nov 2012 05:39:19 +0400
Quoted 10 lines · Cyrill Gorcunov
Quoted 9 lines
We've observed that in case if UDP diag module is not supported in kernel the netlink returns
NLMSG_DONEwithout notifying a caller that handler is missed.This patch makes
__inet_diag_dumpto return error code instead.So as example it become possible to detect such situation and handle it gracefully on userspace level.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Cyrill Gorcunov <[email protected]>CC David Miller <[email protected]>CC Eric Dumazet <[email protected]>CC Pavel Emelyanov <[email protected]>Acked-by Pavel Emelyanov <[email protected]>
Applied, thanks.