diff options
| -rw-r--r-- | net/ipv4/inet_diag.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 64abe476e2a6..f50df2ed9af5 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
| @@ -709,19 +709,11 @@ out: | |||
| 709 | return err; | 709 | return err; |
| 710 | } | 710 | } |
| 711 | 711 | ||
| 712 | static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, | 712 | static void inet_diag_dump_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *skb, |
| 713 | struct inet_diag_req *r, struct nlattr *bc) | 713 | struct netlink_callback *cb, struct inet_diag_req *r, struct nlattr *bc) |
| 714 | { | 714 | { |
| 715 | int i, num; | 715 | int i, num; |
| 716 | int s_i, s_num; | 716 | int s_i, s_num; |
| 717 | const struct inet_diag_handler *handler; | ||
| 718 | struct inet_hashinfo *hashinfo; | ||
| 719 | |||
| 720 | handler = inet_diag_lock_handler(r->sdiag_protocol); | ||
| 721 | if (IS_ERR(handler)) | ||
| 722 | goto unlock; | ||
| 723 | |||
| 724 | hashinfo = handler->idiag_hashinfo; | ||
| 725 | 717 | ||
| 726 | s_i = cb->args[1]; | 718 | s_i = cb->args[1]; |
| 727 | s_num = num = cb->args[2]; | 719 | s_num = num = cb->args[2]; |
| @@ -790,7 +782,7 @@ skip_listen_ht: | |||
| 790 | } | 782 | } |
| 791 | 783 | ||
| 792 | if (!(r->idiag_states & ~(TCPF_LISTEN | TCPF_SYN_RECV))) | 784 | if (!(r->idiag_states & ~(TCPF_LISTEN | TCPF_SYN_RECV))) |
| 793 | goto unlock; | 785 | goto out; |
| 794 | 786 | ||
| 795 | for (i = s_i; i <= hashinfo->ehash_mask; i++) { | 787 | for (i = s_i; i <= hashinfo->ehash_mask; i++) { |
| 796 | struct inet_ehash_bucket *head = &hashinfo->ehash[i]; | 788 | struct inet_ehash_bucket *head = &hashinfo->ehash[i]; |
| @@ -863,8 +855,20 @@ next_dying: | |||
| 863 | done: | 855 | done: |
| 864 | cb->args[1] = i; | 856 | cb->args[1] = i; |
| 865 | cb->args[2] = num; | 857 | cb->args[2] = num; |
| 866 | unlock: | 858 | out: |
| 859 | ; | ||
| 860 | } | ||
| 861 | |||
| 862 | static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, | ||
| 863 | struct inet_diag_req *r, struct nlattr *bc) | ||
| 864 | { | ||
| 865 | const struct inet_diag_handler *handler; | ||
| 866 | |||
| 867 | handler = inet_diag_lock_handler(r->sdiag_protocol); | ||
| 868 | if (!IS_ERR(handler)) | ||
| 869 | inet_diag_dump_icsk(handler->idiag_hashinfo, skb, cb, r, bc); | ||
| 867 | inet_diag_unlock_handler(handler); | 870 | inet_diag_unlock_handler(handler); |
| 871 | |||
| 868 | return skb->len; | 872 | return skb->len; |
| 869 | } | 873 | } |
| 870 | 874 | ||
