Skip to content

Commit f53d77e

Browse files
lxindavem330
authored andcommitted
sctp: reset ret in again path in sctp_for_each_transport
Commit 97a6ec4 ("rhashtable: Change rhashtable_walk_start to return void") only initialized ret for the first time, when going to again path, the next tsp could be NULL. Without resetting ret, cb_done would be called with tsp as NULL. A kernel crash was caused by this when running sctpdiag testcase in sctp-tests. Note that this issue doesn't affect net.git yet. Fixes: 97a6ec4 ("rhashtable: Change rhashtable_walk_start to return void") Signed-off-by: Xin Long <[email protected]> Acked-by: Marcelo Ricardo Leitner <[email protected]> Acked-by: Neil Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 196709f commit f53d77e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/sctp/socket.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4860,9 +4860,10 @@ int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *),
48604860
struct net *net, int *pos, void *p) {
48614861
struct rhashtable_iter hti;
48624862
struct sctp_transport *tsp;
4863-
int ret = 0;
4863+
int ret;
48644864

48654865
again:
4866+
ret = 0;
48664867
sctp_transport_walk_start(&hti);
48674868

48684869
tsp = sctp_transport_get_idx(net, &hti, *pos + 1);

0 commit comments

Comments
 (0)