Skip to content

Commit 12a78b0

Browse files
congwangdavem330
authored andcommitted
tipc: check return value of __tipc_dump_start()
When __tipc_dump_start() fails with running out of memory, we have no reason to continue, especially we should avoid calling tipc_dump_done(). Fixes: 8f5c5fc ("tipc: call start and done ops directly in __tipc_nl_compat_dumpit()") Reported-and-tested-by: [email protected] Cc: Jon Maloy <[email protected]> Cc: Ying Xue <[email protected]> Signed-off-by: Cong Wang <[email protected]> Acked-by: Ying Xue <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6b4d24d commit 12a78b0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/tipc/netlink_compat.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
185185
return -ENOMEM;
186186

187187
buf->sk = msg->dst_sk;
188-
__tipc_dump_start(&cb, msg->net);
188+
if (__tipc_dump_start(&cb, msg->net)) {
189+
kfree_skb(buf);
190+
return -ENOMEM;
191+
}
189192

190193
do {
191194
int rem;

0 commit comments

Comments
 (0)