From 8c3f7ad38f78e4bd72d3005eb95ac125a7248423 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 9 Dec 2011 06:22:10 +0000 Subject: [PATCH] --- yaml --- r: 278543 b: refs/heads/master c: 476f7dbff30a7c122899d753c9119d9233928380 h: refs/heads/master i: 278541: 4ed741ab3fc5e32ea3736e1227d3444ddbd86c94 278539: cc9b737a4b4fac05d4d2a9d0d7b370ec50d46c23 278535: b021a412860fff5458e1f1709cadc51c7e475f7d 278527: 60182f3596b168f0a8302e7ae396a910783dc901 v: v3 --- [refs] | 2 +- trunk/net/ipv4/inet_diag.c | 38 ++++++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index 1db76c6bfe74..e49a38c0befb 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b005ab4ef8805dc4604848c9d2ccca9d71f8fc46 +refs/heads/master: 476f7dbff30a7c122899d753c9119d9233928380 diff --git a/trunk/net/ipv4/inet_diag.c b/trunk/net/ipv4/inet_diag.c index ba3ae1f73abf..64abe476e2a6 100644 --- a/trunk/net/ipv4/inet_diag.c +++ b/trunk/net/ipv4/inet_diag.c @@ -258,25 +258,14 @@ int inet_diag_check_cookie(struct sock *sk, struct inet_diag_req *req) } EXPORT_SYMBOL_GPL(inet_diag_check_cookie); -static int inet_diag_get_exact(struct sk_buff *in_skb, - const struct nlmsghdr *nlh, - struct inet_diag_req *req) +static int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *in_skb, + const struct nlmsghdr *nlh, struct inet_diag_req *req) { int err; struct sock *sk; struct sk_buff *rep; - struct inet_hashinfo *hashinfo; - const struct inet_diag_handler *handler; - handler = inet_diag_lock_handler(req->sdiag_protocol); - if (IS_ERR(handler)) { - err = PTR_ERR(handler); - goto unlock; - } - - hashinfo = handler->idiag_hashinfo; err = -EINVAL; - if (req->sdiag_family == AF_INET) { sk = inet_lookup(&init_net, hashinfo, req->id.idiag_dst[0], req->id.idiag_dport, req->id.idiag_src[0], @@ -293,12 +282,12 @@ static int inet_diag_get_exact(struct sk_buff *in_skb, } #endif else { - goto unlock; + goto out_nosk; } err = -ENOENT; if (sk == NULL) - goto unlock; + goto out_nosk; err = inet_diag_check_cookie(sk, req); if (err) @@ -332,8 +321,25 @@ static int inet_diag_get_exact(struct sk_buff *in_skb, else sock_put(sk); } -unlock: +out_nosk: + return err; +} + +static int inet_diag_get_exact(struct sk_buff *in_skb, + const struct nlmsghdr *nlh, + struct inet_diag_req *req) +{ + const struct inet_diag_handler *handler; + int err; + + handler = inet_diag_lock_handler(req->sdiag_protocol); + if (IS_ERR(handler)) + err = PTR_ERR(handler); + else + err = inet_diag_dump_one_icsk(handler->idiag_hashinfo, + in_skb, nlh, req); inet_diag_unlock_handler(handler); + return err; }