Skip to content
  • Gerd Hoffmann's avatar
    chardev: fix pty_chr_timer · b0d768c3
    Gerd Hoffmann authored
    pty_chr_timer first calls pty_chr_update_read_handler(), then clears
    timer_tag (because it is a one-shot timer).   This is the wrong order
    though.  pty_chr_update_read_handler might re-arm time timer, and the
    new timer_tag gets overwitten in that case.
    
    This leads to crashes when unplugging a pty chardev:  pty_chr_close
    thinks no timer is running -> timer isn't canceled -> pty_chr_timer gets
    called with stale CharDevState -> BOOM.
    
    This patch fixes the ordering.
    Kill the pointless goto while being at it.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=994414
    
    
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
    b0d768c3