提交 88bb7bed 编写于 作者: A Adam McCoy 提交者: Yang Yingliang

cifs: fix leaked reference on requeued write

stable inclusion
from linux-4.19.124
commit ad149b6e08f1ee582f1d2ffa747f463e9b6f1c40

--------------------------------

commit a4813799 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: NAdam McCoy <adam@forsedomani.com>
Signed-off-by: NSteve French <stfrench@microsoft.com>
CC: Stable <stable@vger.kernel.org>
Reviewed-by: NPavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 4565f98c
......@@ -2051,8 +2051,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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册