diff options
author | Adam McCoy <adam@forsedomani.com> | 2020-05-13 14:53:30 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2020-05-15 01:47:01 +0300 |
commit | a48137996063d22ffba77e077425f49873856ca5 (patch) | |
tree | 0ea55985df6a5836586ceaee78db68b026523f26 /fs/cifs/cifssmb.c | |
parent | 9bd21d4b1a767c3abebec203342f3820dcb84662 (diff) | |
download | linux-a48137996063d22ffba77e077425f49873856ca5.tar.xz |
cifs: fix leaked reference on requeued write
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>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r-- | fs/cifs/cifssmb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 182b864b3075..5014a82391ff 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -2152,8 +2152,8 @@ cifs_writev_requeue(struct cifs_writedata *wdata) } } + kref_put(&wdata2->refcount, cifs_writedata_release); if (rc) { - kref_put(&wdata2->refcount, cifs_writedata_release); if (is_retryable_error(rc)) continue; i += nr_pages; |