aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-09-13 01:22:42 -0400
committerDavid S. Miller <davem@davemloft.net>2018-09-13 01:22:42 -0400
commitaaf9253025e80cf8f62d7b33670e84e838eec5a3 (patch)
treef13b307c8407cc05ff803c4d7f6a0967d85ce3ec /net/tipc
parenta20625e49ddefc250c221478fb0dc62ea27722a6 (diff)
parent7428b2e5d0b195f2a5e40f91d2b41a8503fcfe68 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/netlink_compat.c5
-rw-r--r--net/tipc/socket.c18
-rw-r--r--net/tipc/socket.h1
3 files changed, 18 insertions, 6 deletions
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index a2f76743c73a..6376467e78f8 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -185,6 +185,10 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
185 return -ENOMEM; 185 return -ENOMEM;
186 186
187 buf->sk = msg->dst_sk; 187 buf->sk = msg->dst_sk;
188 if (__tipc_dump_start(&cb, msg->net)) {
189 kfree_skb(buf);
190 return -ENOMEM;
191 }
188 192
189 do { 193 do {
190 int rem; 194 int rem;
@@ -216,6 +220,7 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
216 err = 0; 220 err = 0;
217 221
218err_out: 222err_out:
223 tipc_dump_done(&cb);
219 kfree_skb(buf); 224 kfree_skb(buf);
220 225
221 if (err == -EMSGSIZE) { 226 if (err == -EMSGSIZE) {
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index ab7a2a7178f7..3f03ddd0e35b 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -576,6 +576,7 @@ static int tipc_release(struct socket *sock)
576 sk_stop_timer(sk, &sk->sk_timer); 576 sk_stop_timer(sk, &sk->sk_timer);
577 tipc_sk_remove(tsk); 577 tipc_sk_remove(tsk);
578 578
579 sock_orphan(sk);
579 /* Reject any messages that accumulated in backlog queue */ 580 /* Reject any messages that accumulated in backlog queue */
580 release_sock(sk); 581 release_sock(sk);
581 tipc_dest_list_purge(&tsk->cong_links); 582 tipc_dest_list_purge(&tsk->cong_links);
@@ -3229,7 +3230,7 @@ int tipc_nl_sk_walk(struct sk_buff *skb, struct netlink_callback *cb,
3229 struct netlink_callback *cb, 3230 struct netlink_callback *cb,
3230 struct tipc_sock *tsk)) 3231 struct tipc_sock *tsk))
3231{ 3232{
3232 struct rhashtable_iter *iter = (void *)cb->args[0]; 3233 struct rhashtable_iter *iter = (void *)cb->args[4];
3233 struct tipc_sock *tsk; 3234 struct tipc_sock *tsk;
3234 int err; 3235 int err;
3235 3236
@@ -3265,8 +3266,14 @@ EXPORT_SYMBOL(tipc_nl_sk_walk);
3265 3266
3266int tipc_dump_start(struct netlink_callback *cb) 3267int tipc_dump_start(struct netlink_callback *cb)
3267{ 3268{
3268 struct rhashtable_iter *iter = (void *)cb->args[0]; 3269 return __tipc_dump_start(cb, sock_net(cb->skb->sk));
3269 struct net *net = sock_net(cb->skb->sk); 3270}
3271EXPORT_SYMBOL(tipc_dump_start);
3272
3273int __tipc_dump_start(struct netlink_callback *cb, struct net *net)
3274{
3275 /* tipc_nl_name_table_dump() uses cb->args[0...3]. */
3276 struct rhashtable_iter *iter = (void *)cb->args[4];
3270 struct tipc_net *tn = tipc_net(net); 3277 struct tipc_net *tn = tipc_net(net);
3271 3278
3272 if (!iter) { 3279 if (!iter) {
@@ -3274,17 +3281,16 @@ int tipc_dump_start(struct netlink_callback *cb)
3274 if (!iter) 3281 if (!iter)
3275 return -ENOMEM; 3282 return -ENOMEM;
3276 3283
3277 cb->args[0] = (long)iter; 3284 cb->args[4] = (long)iter;
3278 } 3285 }
3279 3286
3280 rhashtable_walk_enter(&tn->sk_rht, iter); 3287 rhashtable_walk_enter(&tn->sk_rht, iter);
3281 return 0; 3288 return 0;
3282} 3289}
3283EXPORT_SYMBOL(tipc_dump_start);
3284 3290
3285int tipc_dump_done(struct netlink_callback *cb) 3291int tipc_dump_done(struct netlink_callback *cb)
3286{ 3292{
3287 struct rhashtable_iter *hti = (void *)cb->args[0]; 3293 struct rhashtable_iter *hti = (void *)cb->args[4];
3288 3294
3289 rhashtable_walk_exit(hti); 3295 rhashtable_walk_exit(hti);
3290 kfree(hti); 3296 kfree(hti);
diff --git a/net/tipc/socket.h b/net/tipc/socket.h
index d43032e26532..5e575f205afe 100644
--- a/net/tipc/socket.h
+++ b/net/tipc/socket.h
@@ -69,5 +69,6 @@ int tipc_nl_sk_walk(struct sk_buff *skb, struct netlink_callback *cb,
69 struct netlink_callback *cb, 69 struct netlink_callback *cb,
70 struct tipc_sock *tsk)); 70 struct tipc_sock *tsk));
71int tipc_dump_start(struct netlink_callback *cb); 71int tipc_dump_start(struct netlink_callback *cb);
72int __tipc_dump_start(struct netlink_callback *cb, struct net *net);
72int tipc_dump_done(struct netlink_callback *cb); 73int tipc_dump_done(struct netlink_callback *cb);
73#endif 74#endif