Skip to content

Commit 30a853c

Browse files
committed
Merge tag '6.1-rc6-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: "Two small cifs/smb3 client fixes: - an unlock missing in an error path in copychunk_range found by xfstest 476 - a fix for a use after free in a debug code path" * tag '6.1-rc6-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: fix missing unlock in cifs_file_copychunk_range() cifs: Use after free in debug code
2 parents faf68e3 + 5024878 commit 30a853c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

fs/cifs/cifsfs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
12811281
rc = filemap_write_and_wait_range(src_inode->i_mapping, off,
12821282
off + len - 1);
12831283
if (rc)
1284-
goto out;
1284+
goto unlock;
12851285

12861286
/* should we flush first and last page first */
12871287
truncate_inode_pages(&target_inode->i_data, 0);
@@ -1297,6 +1297,8 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
12971297
* that target is updated on the server
12981298
*/
12991299
CIFS_I(target_inode)->time = 0;
1300+
1301+
unlock:
13001302
/* although unlocking in the reverse order from locking is not
13011303
* strictly necessary here it is a little cleaner to be consistent
13021304
*/

fs/cifs/sess.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,14 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
302302

303303
/* now drop the ref to the current iface */
304304
if (old_iface && iface) {
305-
kref_put(&old_iface->refcount, release_iface);
306305
cifs_dbg(FYI, "replacing iface: %pIS with %pIS\n",
307306
&old_iface->sockaddr,
308307
&iface->sockaddr);
309-
} else if (old_iface) {
310308
kref_put(&old_iface->refcount, release_iface);
309+
} else if (old_iface) {
311310
cifs_dbg(FYI, "releasing ref to iface: %pIS\n",
312311
&old_iface->sockaddr);
312+
kref_put(&old_iface->refcount, release_iface);
313313
} else {
314314
WARN_ON(!iface);
315315
cifs_dbg(FYI, "adding new iface: %pIS\n", &iface->sockaddr);

0 commit comments

Comments
 (0)