Skip to content

Commit 66ace9a

Browse files
committed
Merge tag 'v6.11-rc4-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull smb client fixes from Steve French: - fix refcount leak (can cause rmmod fail) - fix byte range locking problem with cached reads - fix for mount failure if reparse point unrecognized - minor typo * tag 'v6.11-rc4-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: smb/client: fix typo: GlobalMid_Sem -> GlobalMid_Lock smb: client: ignore unhandled reparse tags smb3: fix problem unloading module due to leaked refcount on shutdown smb3: fix broken cached reads when posix locks
2 parents 7eb61cc + 5e51224 commit 66ace9a

File tree

7 files changed

+20
-13
lines changed

7 files changed

+20
-13
lines changed

fs/smb/client/cifsfs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ unsigned int sign_CIFS_PDUs = 1;
7575
/*
7676
* Global transaction id (XID) information
7777
*/
78-
unsigned int GlobalCurrentXid; /* protected by GlobalMid_Sem */
79-
unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Sem */
80-
unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Sem */
78+
unsigned int GlobalCurrentXid; /* protected by GlobalMid_Lock */
79+
unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Lock */
80+
unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Lock */
8181
spinlock_t GlobalMid_Lock; /* protects above & list operations on midQ entries */
8282

8383
/*

fs/smb/client/cifsglob.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,9 +2017,9 @@ extern spinlock_t cifs_tcp_ses_lock;
20172017
/*
20182018
* Global transaction id (XID) information
20192019
*/
2020-
extern unsigned int GlobalCurrentXid; /* protected by GlobalMid_Sem */
2021-
extern unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Sem */
2022-
extern unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Sem */
2020+
extern unsigned int GlobalCurrentXid; /* protected by GlobalMid_Lock */
2021+
extern unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Lock */
2022+
extern unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Lock */
20232023
extern spinlock_t GlobalMid_Lock; /* protects above & list operations on midQ entries */
20242024

20252025
/*

fs/smb/client/connect.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4194,6 +4194,9 @@ tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink)
41944194
*
41954195
* If one doesn't exist then insert a new tcon_link struct into the tree and
41964196
* try to construct a new one.
4197+
*
4198+
* REMEMBER to call cifs_put_tlink() after successful calls to cifs_sb_tlink,
4199+
* to avoid refcount issues
41974200
*/
41984201
struct tcon_link *
41994202
cifs_sb_tlink(struct cifs_sb_info *cifs_sb)

fs/smb/client/file.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2912,9 +2912,7 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to)
29122912
if (!CIFS_CACHE_READ(cinode))
29132913
return netfs_unbuffered_read_iter(iocb, to);
29142914

2915-
if (cap_unix(tcon->ses) &&
2916-
(CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
2917-
((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0)) {
2915+
if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0) {
29182916
if (iocb->ki_flags & IOCB_DIRECT)
29192917
return netfs_unbuffered_read_iter(iocb, to);
29202918
return netfs_buffered_read_iter(iocb, to);

fs/smb/client/ioctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,11 @@ static int cifs_shutdown(struct super_block *sb, unsigned long arg)
229229

230230
shutdown_good:
231231
trace_smb3_shutdown_done(flags, tcon->tid);
232+
cifs_put_tlink(tlink);
232233
return 0;
233234
shutdown_out_err:
234235
trace_smb3_shutdown_err(rc, flags, tcon->tid);
236+
cifs_put_tlink(tlink);
235237
return rc;
236238
}
237239

fs/smb/client/link.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@ cifs_symlink(struct mnt_idmap *idmap, struct inode *inode,
588588
tlink = cifs_sb_tlink(cifs_sb);
589589
if (IS_ERR(tlink)) {
590590
rc = PTR_ERR(tlink);
591+
/* BB could be clearer if skipped put_tlink on error here, but harmless */
591592
goto symlink_exit;
592593
}
593594
pTcon = tlink_tcon(tlink);

fs/smb/client/reparse.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,8 @@ int parse_reparse_point(struct reparse_data_buffer *buf,
378378
u32 plen, struct cifs_sb_info *cifs_sb,
379379
bool unicode, struct cifs_open_info_data *data)
380380
{
381+
struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
382+
381383
data->reparse.buf = buf;
382384

383385
/* See MS-FSCC 2.1.2 */
@@ -394,12 +396,13 @@ int parse_reparse_point(struct reparse_data_buffer *buf,
394396
case IO_REPARSE_TAG_LX_FIFO:
395397
case IO_REPARSE_TAG_LX_CHR:
396398
case IO_REPARSE_TAG_LX_BLK:
397-
return 0;
399+
break;
398400
default:
399-
cifs_dbg(VFS, "%s: unhandled reparse tag: 0x%08x\n",
400-
__func__, le32_to_cpu(buf->ReparseTag));
401-
return -EOPNOTSUPP;
401+
cifs_tcon_dbg(VFS | ONCE, "unhandled reparse tag: 0x%08x\n",
402+
le32_to_cpu(buf->ReparseTag));
403+
break;
402404
}
405+
return 0;
403406
}
404407

405408
int smb2_parse_reparse_point(struct cifs_sb_info *cifs_sb,

0 commit comments

Comments
 (0)