Commit 66ace9a8 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 7eb61cc6 5e51224d
...@@ -75,9 +75,9 @@ unsigned int sign_CIFS_PDUs = 1; ...@@ -75,9 +75,9 @@ unsigned int sign_CIFS_PDUs = 1;
/* /*
* Global transaction id (XID) information * Global transaction id (XID) information
*/ */
unsigned int GlobalCurrentXid; /* protected by GlobalMid_Sem */ unsigned int GlobalCurrentXid; /* protected by GlobalMid_Lock */
unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Sem */ unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Lock */
unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Sem */ unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Lock */
spinlock_t GlobalMid_Lock; /* protects above & list operations on midQ entries */ spinlock_t GlobalMid_Lock; /* protects above & list operations on midQ entries */
/* /*
......
...@@ -2017,9 +2017,9 @@ extern spinlock_t cifs_tcp_ses_lock; ...@@ -2017,9 +2017,9 @@ extern spinlock_t cifs_tcp_ses_lock;
/* /*
* Global transaction id (XID) information * Global transaction id (XID) information
*/ */
extern unsigned int GlobalCurrentXid; /* protected by GlobalMid_Sem */ extern unsigned int GlobalCurrentXid; /* protected by GlobalMid_Lock */
extern unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Sem */ extern unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Lock */
extern unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Sem */ extern unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Lock */
extern spinlock_t GlobalMid_Lock; /* protects above & list operations on midQ entries */ extern spinlock_t GlobalMid_Lock; /* protects above & list operations on midQ entries */
/* /*
......
...@@ -4194,6 +4194,9 @@ tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink) ...@@ -4194,6 +4194,9 @@ tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink)
* *
* If one doesn't exist then insert a new tcon_link struct into the tree and * If one doesn't exist then insert a new tcon_link struct into the tree and
* try to construct a new one. * try to construct a new one.
*
* REMEMBER to call cifs_put_tlink() after successful calls to cifs_sb_tlink,
* to avoid refcount issues
*/ */
struct tcon_link * struct tcon_link *
cifs_sb_tlink(struct cifs_sb_info *cifs_sb) cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
......
...@@ -2912,9 +2912,7 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to) ...@@ -2912,9 +2912,7 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to)
if (!CIFS_CACHE_READ(cinode)) if (!CIFS_CACHE_READ(cinode))
return netfs_unbuffered_read_iter(iocb, to); return netfs_unbuffered_read_iter(iocb, to);
if (cap_unix(tcon->ses) && if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0) {
(CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) &&
((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0)) {
if (iocb->ki_flags & IOCB_DIRECT) if (iocb->ki_flags & IOCB_DIRECT)
return netfs_unbuffered_read_iter(iocb, to); return netfs_unbuffered_read_iter(iocb, to);
return netfs_buffered_read_iter(iocb, to); return netfs_buffered_read_iter(iocb, to);
......
...@@ -229,9 +229,11 @@ static int cifs_shutdown(struct super_block *sb, unsigned long arg) ...@@ -229,9 +229,11 @@ static int cifs_shutdown(struct super_block *sb, unsigned long arg)
shutdown_good: shutdown_good:
trace_smb3_shutdown_done(flags, tcon->tid); trace_smb3_shutdown_done(flags, tcon->tid);
cifs_put_tlink(tlink);
return 0; return 0;
shutdown_out_err: shutdown_out_err:
trace_smb3_shutdown_err(rc, flags, tcon->tid); trace_smb3_shutdown_err(rc, flags, tcon->tid);
cifs_put_tlink(tlink);
return rc; return rc;
} }
......
...@@ -588,6 +588,7 @@ cifs_symlink(struct mnt_idmap *idmap, struct inode *inode, ...@@ -588,6 +588,7 @@ cifs_symlink(struct mnt_idmap *idmap, struct inode *inode,
tlink = cifs_sb_tlink(cifs_sb); tlink = cifs_sb_tlink(cifs_sb);
if (IS_ERR(tlink)) { if (IS_ERR(tlink)) {
rc = PTR_ERR(tlink); rc = PTR_ERR(tlink);
/* BB could be clearer if skipped put_tlink on error here, but harmless */
goto symlink_exit; goto symlink_exit;
} }
pTcon = tlink_tcon(tlink); pTcon = tlink_tcon(tlink);
......
...@@ -378,6 +378,8 @@ int parse_reparse_point(struct reparse_data_buffer *buf, ...@@ -378,6 +378,8 @@ int parse_reparse_point(struct reparse_data_buffer *buf,
u32 plen, struct cifs_sb_info *cifs_sb, u32 plen, struct cifs_sb_info *cifs_sb,
bool unicode, struct cifs_open_info_data *data) bool unicode, struct cifs_open_info_data *data)
{ {
struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
data->reparse.buf = buf; data->reparse.buf = buf;
/* See MS-FSCC 2.1.2 */ /* See MS-FSCC 2.1.2 */
...@@ -394,12 +396,13 @@ int parse_reparse_point(struct reparse_data_buffer *buf, ...@@ -394,12 +396,13 @@ int parse_reparse_point(struct reparse_data_buffer *buf,
case IO_REPARSE_TAG_LX_FIFO: case IO_REPARSE_TAG_LX_FIFO:
case IO_REPARSE_TAG_LX_CHR: case IO_REPARSE_TAG_LX_CHR:
case IO_REPARSE_TAG_LX_BLK: case IO_REPARSE_TAG_LX_BLK:
return 0; break;
default: default:
cifs_dbg(VFS, "%s: unhandled reparse tag: 0x%08x\n", cifs_tcon_dbg(VFS | ONCE, "unhandled reparse tag: 0x%08x\n",
__func__, le32_to_cpu(buf->ReparseTag)); le32_to_cpu(buf->ReparseTag));
return -EOPNOTSUPP; break;
} }
return 0;
} }
int smb2_parse_reparse_point(struct cifs_sb_info *cifs_sb, int smb2_parse_reparse_point(struct cifs_sb_info *cifs_sb,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment