diff options
| author | Rafael Zalamena <rzalamena@users.noreply.github.com> | 2017-12-04 11:16:45 -0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-04 11:16:45 -0200 |
| commit | 6bbda63df7eb3dc89c84869ec36fc53432f4828a (patch) | |
| tree | 5278306077da9cb6a3ebcf50a872338560aa293e | |
| parent | 461d84899a2fa0df930182bfc5b21777d7e1113d (diff) | |
| parent | 8ec586b01b2ca2165f845c9c9d6192348713ebf1 (diff) | |
Merge pull request #1508 from qlyoung/bgpd-fix-lock
bgpd: fix potential deadlock
| -rw-r--r-- | bgpd/bgp_packet.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index e111dd785f..4b018aef4d 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -556,12 +556,14 @@ static int bgp_write_notify(struct peer *peer) { /* There should be at least one packet. */ s = stream_fifo_pop(peer->obuf); - if (!s) - return 0; - assert(stream_get_endp(s) >= BGP_HEADER_SIZE); } pthread_mutex_unlock(&peer->io_mtx); + if (!s) + return 0; + + assert(stream_get_endp(s) >= BGP_HEADER_SIZE); + /* Stop collecting data within the socket */ sockopt_cork(peer->fd, 0); |
