Repository navigation
Commit 3106ecb
sctp: not disable bh in the whole sctp_get_port_local()
With disabling bh in the whole sctp_get_port_local(), when
snum == 0 and too many ports have been used, the do-while
loop will take the cpu for a long time and cause cpu stuck:
[ ] watchdog: BUG: soft lockup - CPU#11 stuck for 22s!
[ ] RIP: 0010:native_queued_spin_lock_slowpath+0x4de/0x940
[ ] Call Trace:
[ ] _raw_spin_lock+0xc1/0xd0
[ ] sctp_get_port_local+0x527/0x650 [sctp]
[ ] sctp_do_bind+0x208/0x5e0 [sctp]
[ ] sctp_autobind+0x165/0x1e0 [sctp]
[ ] sctp_connect_new_asoc+0x355/0x480 [sctp]
[ ] __sctp_connect+0x360/0xb10 [sctp]
There's no need to disable bh in the whole function of
sctp_get_port_local. So fix this cpu stuck by removing
local_bh_disable() called at the beginning, and using
spin_lock_bh() instead.
The same thing was actually done for inet_csk_get_port() in
Commit ea8add2 ("tcp/dccp: better use of ephemeral
ports in bind()").
Thanks to Marcelo for pointing the buggy code out.
v1->v2:
- use cond_resched() to yield cpu to other tasks if needed,
as Eric noticed.
Fixes: 1da177e ("Linux-2.6.12-rc2")
Reported-by: Ying Xu <yinxu@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent 1838d6c commit 3106ecb
1 file changed
Lines changed: 6 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8060 | 8060 | | |
8061 | 8061 | | |
8062 | 8062 | | |
8063 | | - | |
8064 | | - | |
8065 | 8063 | | |
8066 | 8064 | | |
8067 | 8065 | | |
| |||
8079 | 8077 | | |
8080 | 8078 | | |
8081 | 8079 | | |
8082 | | - | |
| 8080 | + | |
8083 | 8081 | | |
8084 | 8082 | | |
8085 | 8083 | | |
8086 | 8084 | | |
8087 | 8085 | | |
8088 | 8086 | | |
8089 | | - | |
| 8087 | + | |
| 8088 | + | |
8090 | 8089 | | |
8091 | 8090 | | |
8092 | 8091 | | |
8093 | 8092 | | |
8094 | 8093 | | |
8095 | | - | |
| 8094 | + | |
8096 | 8095 | | |
8097 | 8096 | | |
8098 | 8097 | | |
| |||
8107 | 8106 | | |
8108 | 8107 | | |
8109 | 8108 | | |
8110 | | - | |
| 8109 | + | |
8111 | 8110 | | |
8112 | 8111 | | |
8113 | 8112 | | |
| |||
8207 | 8206 | | |
8208 | 8207 | | |
8209 | 8208 | | |
8210 | | - | |
8211 | | - | |
8212 | | - | |
8213 | | - | |
| 8209 | + | |
8214 | 8210 | | |
8215 | 8211 | | |
8216 | 8212 | | |
| |||
0 commit comments