Skip to content

Commit a481379

Browse files
adam-mccoysmfrench
authored andcommitted
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 <[email protected]> Signed-off-by: Steve French <[email protected]> CC: Stable <[email protected]> Reviewed-by: Pavel Shilovsky <[email protected]>
1 parent 9bd21d4 commit a481379

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/cifs/cifssmb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2152,8 +2152,8 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
21522152
}
21532153
}
21542154

2155+
kref_put(&wdata2->refcount, cifs_writedata_release);
21552156
if (rc) {
2156-
kref_put(&wdata2->refcount, cifs_writedata_release);
21572157
if (is_retryable_error(rc))
21582158
continue;
21592159
i += nr_pages;

0 commit comments

Comments
 (0)