Commit 55f626f2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull smb client fixes from Steve French:
 "Five smb3 client fixes, most also for stable:

   - Two multichannel fixes (one to fix potential handle leak on retry)

   - Work around possible serious data corruption (due to change in
     folios in 6.3, for cases when non standard maximum write size
     negotiated)

   - Symlink creation fix

   - Multiuser automount fix"

* tag '6.8-rc4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  smb: Fix regression in writes when non-standard maximum write size negotiated
  smb: client: handle path separator of created SMB symlinks
  smb: client: set correct id, uid and cruid for multiuser automounts
  cifs: update the same create_guid on replay
  cifs: fix underflow in parse_server_interfaces()
parents c1ca10ce 4860abb9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -242,6 +242,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,
		.desired_access =  FILE_READ_DATA | FILE_READ_ATTRIBUTES,
		.disposition = FILE_OPEN,
		.fid = pfid,
		.replay = !!(retries),
	};

	rc = SMB2_open_init(tcon, server,
+1 −0
Original line number Diff line number Diff line
@@ -1378,6 +1378,7 @@ struct cifs_open_parms {
	struct cifs_fid *fid;
	umode_t mode;
	bool reconnect:1;
	bool replay:1; /* indicates that this open is for a replay */
};

struct cifs_fid {
+12 −2
Original line number Diff line number Diff line
@@ -3444,8 +3444,18 @@ int cifs_mount_get_tcon(struct cifs_mount_ctx *mnt_ctx)
	 * the user on mount
	 */
	if ((cifs_sb->ctx->wsize == 0) ||
	    (cifs_sb->ctx->wsize > server->ops->negotiate_wsize(tcon, ctx)))
		cifs_sb->ctx->wsize = server->ops->negotiate_wsize(tcon, ctx);
	    (cifs_sb->ctx->wsize > server->ops->negotiate_wsize(tcon, ctx))) {
		cifs_sb->ctx->wsize =
			round_down(server->ops->negotiate_wsize(tcon, ctx), PAGE_SIZE);
		/*
		 * in the very unlikely event that the server sent a max write size under PAGE_SIZE,
		 * (which would get rounded down to 0) then reset wsize to absolute minimum eg 4096
		 */
		if (cifs_sb->ctx->wsize == 0) {
			cifs_sb->ctx->wsize = PAGE_SIZE;
			cifs_dbg(VFS, "wsize too small, reset to minimum ie PAGE_SIZE, usually 4096\n");
		}
	}
	if ((cifs_sb->ctx->rsize == 0) ||
	    (cifs_sb->ctx->rsize > server->ops->negotiate_rsize(tcon, ctx)))
		cifs_sb->ctx->rsize = server->ops->negotiate_rsize(tcon, ctx);
+11 −0
Original line number Diff line number Diff line
@@ -1111,6 +1111,17 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
	case Opt_wsize:
		ctx->wsize = result.uint_32;
		ctx->got_wsize = true;
		if (ctx->wsize % PAGE_SIZE != 0) {
			ctx->wsize = round_down(ctx->wsize, PAGE_SIZE);
			if (ctx->wsize == 0) {
				ctx->wsize = PAGE_SIZE;
				cifs_dbg(VFS, "wsize too small, reset to minimum %ld\n", PAGE_SIZE);
			} else {
				cifs_dbg(VFS,
					 "wsize rounded down to %d to multiple of PAGE_SIZE %ld\n",
					 ctx->wsize, PAGE_SIZE);
			}
		}
		break;
	case Opt_acregmax:
		ctx->acregmax = HZ * result.uint_32;
+16 −0
Original line number Diff line number Diff line
@@ -168,6 +168,21 @@ static char *automount_fullpath(struct dentry *dentry, void *page)
	return s;
}

static void fs_context_set_ids(struct smb3_fs_context *ctx)
{
	kuid_t uid = current_fsuid();
	kgid_t gid = current_fsgid();

	if (ctx->multiuser) {
		if (!ctx->uid_specified)
			ctx->linux_uid = uid;
		if (!ctx->gid_specified)
			ctx->linux_gid = gid;
	}
	if (!ctx->cruid_specified)
		ctx->cred_uid = uid;
}

/*
 * Create a vfsmount that we can automount
 */
@@ -205,6 +220,7 @@ static struct vfsmount *cifs_do_automount(struct path *path)
	tmp.leaf_fullpath = NULL;
	tmp.UNC = tmp.prepath = NULL;
	tmp.dfs_root_ses = NULL;
	fs_context_set_ids(&tmp);

	rc = smb3_fs_context_dup(ctx, &tmp);
	if (rc) {
Loading