tipc: call start and done ops directly in __tipc_nl_compat_dumpit()
Subsystems (3)
PATCH 1/1 tipc: call start and done ops directly in __tipc_nl_compat_dumpit()
__tipc_nl_compat_dumpit() uses a netlink_callback on stack, so the only way to align it with other ->dumpit() call path is calling tipc_dump_start() and tipc_dump_done() directly inside it. Otherwise ->dumpit() would always get NULL from cb->args[0].
--- net/tipc/netlink_compat.c | 2 ++ 1 file changed, 2 insertions(+)
net/tipc/netlink_compat.c +2 -0
@@ -185,6 +185,7 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,return -ENOMEM ; buf->sk = msg->dst_sk; +tipc_dump_start (&cb); do { int rem;
@@ -216,6 +217,7 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd, err =0 ; err_out: +tipc_dump_done (&cb);kfree_skb (buf);if (err == -EMSGSIZE ) {
Signature · 1 line
2.14.4
Quoted 21 lines · Cong Wang
__tipc_nl_compat_dumpit()uses anetlink_callbackon stack, so the only way to align it with other ->dumpit() call path is callingtipc_dump_start()andtipc_dump_done()directly inside it. Otherwise ->dumpit() would always get NULL from cb->args[0].Fixes 9a07efa9aea2 ("tipc: switch to rhashtable iterator")Reported-by [email protected]Cc Jon Maloy <[email protected]>Cc Ying Xue <[email protected]>Signed-off-by Cong Wang <[email protected]>--- net/tipc/netlink_compat.c | 2 ++ 1 file changed, 2 insertions(+)net/tipc/netlink_compat.c +0
-0
net/tipc/netlink_compat.c static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd, · line 188
Quoted 4 lines
net/tipc/netlink_compat.c +1
-0@@ -185,6 +185,7 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,return -ENOMEM ; buf->sk = msg->dst_sk; +tipc_dump_start (&cb);
Well, tipc_dump_start() uses sock_net(cb->skb->sk) which seems not set here... I need to pass msg->dst_sk in.
I will send v2.