]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cifs: fix leaked reference on requeued write
authorAdam McCoy <adam@forsedomani.com>
Wed, 13 May 2020 11:53:30 +0000 (11:53 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 May 2020 06:22:30 +0000 (08:22 +0200)
commit042ae30b46fce74b20e6233a2471c071defc5eea
treed5bc069c4f9591ae4573665b8034138c57eb4882
parent39be29d41660116b440c3a19ffca34ce7b6d6726
cifs: fix leaked reference on requeued write

commit a48137996063d22ffba77e077425f49873856ca5 upstream.

Failed async writes that are requeued may not clean up a refcount
on the file, which can result in a leaked open. This scenario arises
very reliably when using persistent handles and a reconnect occurs
while writing.

cifs_writev_requeue only releases the reference if the write fails
(rc != 0). The server->ops->async_writev operation will take its own
reference, so the initial reference can always be released.

Signed-off-by: Adam McCoy <adam@forsedomani.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
CC: Stable <stable@vger.kernel.org>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/cifssmb.c