• Xin Long's avatar
    sctp: fix the issue sctp_diag uses lock_sock in rcu_read_lock · 1cceda78
    Xin Long authored
    When sctp dumps all the ep->assocs, it needs to lock_sock first,
    but now it locks sock in rcu_read_lock, and lock_sock may sleep,
    which would break rcu_read_lock.
    
    This patch is to get and hold one sock when traversing the list.
    After that and get out of rcu_read_lock, lock and dump it. Then
    it will traverse the list again to get the next one until all
    sctp socks are dumped.
    
    For sctp_diag_dump_one, it fixes this issue by holding asoc and
    moving cb() out of rcu_read_lock in sctp_transport_lookup_process.
    
    Fixes: 8f840e47 ("sctp: add the sctp_diag.c file")
    Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    1cceda78
Name
Last commit
Last update
..
Kconfig Loading commit data...
Makefile Loading commit data...
associola.c Loading commit data...
auth.c Loading commit data...
bind_addr.c Loading commit data...
chunk.c Loading commit data...
debug.c Loading commit data...
endpointola.c Loading commit data...
input.c Loading commit data...
inqueue.c Loading commit data...
ipv6.c Loading commit data...
objcnt.c Loading commit data...
offload.c Loading commit data...
output.c Loading commit data...
outqueue.c Loading commit data...
primitive.c Loading commit data...
probe.c Loading commit data...
proc.c Loading commit data...
protocol.c Loading commit data...
sctp_diag.c Loading commit data...
sm_make_chunk.c Loading commit data...
sm_sideeffect.c Loading commit data...
sm_statefuns.c Loading commit data...
sm_statetable.c Loading commit data...
socket.c Loading commit data...
ssnmap.c Loading commit data...
sysctl.c Loading commit data...
transport.c Loading commit data...
tsnmap.c Loading commit data...
ulpevent.c Loading commit data...
ulpqueue.c Loading commit data...