cifs: fix potential use-after-free in cifs_echo_request() 5.10-rc6-smb3-fixes
authorPaulo Alcantara <pc@cjr.nz>
Sat, 28 Nov 2020 19:54:02 +0000 (16:54 -0300)
committerSteve French <stfrench@microsoft.com>
Mon, 30 Nov 2020 21:23:45 +0000 (15:23 -0600)
commit212253367dc7b49ed3fc194ce71b0992eacaecf2
treef70fc65d0b8eda01cf1c7d37b2bf212840cd4096
parent6988a619f5b79e4efadea6e19dcfe75fbcd350b5
cifs: fix potential use-after-free in cifs_echo_request()

This patch fixes a potential use-after-free bug in
cifs_echo_request().

For instance,

  thread 1
  --------
  cifs_demultiplex_thread()
    clean_demultiplex_info()
      kfree(server)

  thread 2 (workqueue)
  --------
  apic_timer_interrupt()
    smp_apic_timer_interrupt()
      irq_exit()
        __do_softirq()
          run_timer_softirq()
            call_timer_fn()
      cifs_echo_request() <- use-after-free in server ptr

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
CC: Stable <stable@vger.kernel.org>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/connect.c