Commit 5ab39e08 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag '5.8-rc4-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs fixes from Steve French:
 "Four cifs/smb3 fixes: the three for stable fix problems found recently
  with change notification including a reference count leak"

* tag '5.8-rc4-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: update internal module version number
  cifs: fix reference leak for tlink
  smb3: fix unneeded error message on change notify
  cifs: remove the retry in cifs_poxis_lock_set
  smb3: fix access denied on change notify request to some servers
parents 49decddd a8dab63e
...@@ -156,5 +156,5 @@ extern int cifs_truncate_page(struct address_space *mapping, loff_t from); ...@@ -156,5 +156,5 @@ extern int cifs_truncate_page(struct address_space *mapping, loff_t from);
extern const struct export_operations cifs_export_ops; extern const struct export_operations cifs_export_ops;
#endif /* CONFIG_CIFS_NFSD_EXPORT */ #endif /* CONFIG_CIFS_NFSD_EXPORT */
#define CIFS_VERSION "2.27" #define CIFS_VERSION "2.28"
#endif /* _CIFSFS_H */ #endif /* _CIFSFS_H */
...@@ -1149,20 +1149,20 @@ cifs_posix_lock_test(struct file *file, struct file_lock *flock) ...@@ -1149,20 +1149,20 @@ cifs_posix_lock_test(struct file *file, struct file_lock *flock)
/* /*
* Set the byte-range lock (posix style). Returns: * Set the byte-range lock (posix style). Returns:
* 1) 0, if we set the lock and don't need to request to the server; * 1) <0, if the error occurs while setting the lock;
* 2) 1, if we need to request to the server; * 2) 0, if we set the lock and don't need to request to the server;
* 3) <0, if the error occurs while setting the lock. * 3) FILE_LOCK_DEFERRED, if we will wait for some other file_lock;
* 4) FILE_LOCK_DEFERRED + 1, if we need to request to the server.
*/ */
static int static int
cifs_posix_lock_set(struct file *file, struct file_lock *flock) cifs_posix_lock_set(struct file *file, struct file_lock *flock)
{ {
struct cifsInodeInfo *cinode = CIFS_I(file_inode(file)); struct cifsInodeInfo *cinode = CIFS_I(file_inode(file));
int rc = 1; int rc = FILE_LOCK_DEFERRED + 1;
if ((flock->fl_flags & FL_POSIX) == 0) if ((flock->fl_flags & FL_POSIX) == 0)
return rc; return rc;
try_again:
cifs_down_write(&cinode->lock_sem); cifs_down_write(&cinode->lock_sem);
if (!cinode->can_cache_brlcks) { if (!cinode->can_cache_brlcks) {
up_write(&cinode->lock_sem); up_write(&cinode->lock_sem);
...@@ -1171,13 +1171,6 @@ cifs_posix_lock_set(struct file *file, struct file_lock *flock) ...@@ -1171,13 +1171,6 @@ cifs_posix_lock_set(struct file *file, struct file_lock *flock)
rc = posix_lock_file(file, flock, NULL); rc = posix_lock_file(file, flock, NULL);
up_write(&cinode->lock_sem); up_write(&cinode->lock_sem);
if (rc == FILE_LOCK_DEFERRED) {
rc = wait_event_interruptible(flock->fl_wait,
list_empty(&flock->fl_blocked_member));
if (!rc)
goto try_again;
locks_delete_block(flock);
}
return rc; return rc;
} }
...@@ -1652,7 +1645,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type, ...@@ -1652,7 +1645,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
int posix_lock_type; int posix_lock_type;
rc = cifs_posix_lock_set(file, flock); rc = cifs_posix_lock_set(file, flock);
if (!rc || rc < 0) if (rc <= FILE_LOCK_DEFERRED)
return rc; return rc;
if (type & server->vals->shared_lock_type) if (type & server->vals->shared_lock_type)
......
...@@ -169,6 +169,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) ...@@ -169,6 +169,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
unsigned int xid; unsigned int xid;
struct cifsFileInfo *pSMBFile = filep->private_data; struct cifsFileInfo *pSMBFile = filep->private_data;
struct cifs_tcon *tcon; struct cifs_tcon *tcon;
struct tcon_link *tlink;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
__u64 ExtAttrBits = 0; __u64 ExtAttrBits = 0;
__u64 caps; __u64 caps;
...@@ -307,13 +308,19 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) ...@@ -307,13 +308,19 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
break; break;
} }
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
tcon = tlink_tcon(cifs_sb_tlink(cifs_sb)); tlink = cifs_sb_tlink(cifs_sb);
if (IS_ERR(tlink)) {
rc = PTR_ERR(tlink);
break;
}
tcon = tlink_tcon(tlink);
if (tcon && tcon->ses->server->ops->notify) { if (tcon && tcon->ses->server->ops->notify) {
rc = tcon->ses->server->ops->notify(xid, rc = tcon->ses->server->ops->notify(xid,
filep, (void __user *)arg); filep, (void __user *)arg);
cifs_dbg(FYI, "ioctl notify rc %d\n", rc); cifs_dbg(FYI, "ioctl notify rc %d\n", rc);
} else } else
rc = -EOPNOTSUPP; rc = -EOPNOTSUPP;
cifs_put_tlink(tlink);
break; break;
default: default:
cifs_dbg(FYI, "unsupported ioctl\n"); cifs_dbg(FYI, "unsupported ioctl\n");
......
...@@ -354,9 +354,13 @@ smb2_get_data_area_len(int *off, int *len, struct smb2_sync_hdr *shdr) ...@@ -354,9 +354,13 @@ smb2_get_data_area_len(int *off, int *len, struct smb2_sync_hdr *shdr)
((struct smb2_ioctl_rsp *)shdr)->OutputCount); ((struct smb2_ioctl_rsp *)shdr)->OutputCount);
break; break;
case SMB2_CHANGE_NOTIFY: case SMB2_CHANGE_NOTIFY:
*off = le16_to_cpu(
((struct smb2_change_notify_rsp *)shdr)->OutputBufferOffset);
*len = le32_to_cpu(
((struct smb2_change_notify_rsp *)shdr)->OutputBufferLength);
break;
default: default:
/* BB FIXME for unimplemented cases above */ cifs_dbg(VFS, "no length check for command %d\n", le16_to_cpu(shdr->Command));
cifs_dbg(VFS, "no length check for command\n");
break; break;
} }
......
...@@ -2148,7 +2148,7 @@ smb3_notify(const unsigned int xid, struct file *pfile, ...@@ -2148,7 +2148,7 @@ smb3_notify(const unsigned int xid, struct file *pfile,
tcon = cifs_sb_master_tcon(cifs_sb); tcon = cifs_sb_master_tcon(cifs_sb);
oparms.tcon = tcon; oparms.tcon = tcon;
oparms.desired_access = FILE_READ_ATTRIBUTES; oparms.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA;
oparms.disposition = FILE_OPEN; oparms.disposition = FILE_OPEN;
oparms.create_options = cifs_create_options(cifs_sb, 0); oparms.create_options = cifs_create_options(cifs_sb, 0);
oparms.fid = &fid; oparms.fid = &fid;
......
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