Commit e0f8e1a7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'v6.15-rc8-ksmbd-server-fixes' of git://git.samba.org/ksmbd

Pull smb server fixes from Steve French:

 - Fix for rename regression due to the recent VFS lookup changes

 - Fix write failure

 - locking fix for oplock handling

* tag 'v6.15-rc8-ksmbd-server-fixes' of git://git.samba.org/ksmbd:
  ksmbd: use list_first_entry_or_null for opinfo_get_list()
  ksmbd: fix rename failure
  ksmbd: fix stream write failure
parents 3d0ebc36 10379171
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -146,11 +146,8 @@ static struct oplock_info *opinfo_get_list(struct ksmbd_inode *ci)
{
	struct oplock_info *opinfo;

	if (list_empty(&ci->m_op_list))
		return NULL;

	down_read(&ci->m_lock);
	opinfo = list_first_entry(&ci->m_op_list, struct oplock_info,
	opinfo = list_first_entry_or_null(&ci->m_op_list, struct oplock_info,
					  op_entry);
	if (opinfo) {
		if (opinfo->conn == NULL ||
+7 −9
Original line number Diff line number Diff line
@@ -409,10 +409,15 @@ static int ksmbd_vfs_stream_write(struct ksmbd_file *fp, char *buf, loff_t *pos,
	ksmbd_debug(VFS, "write stream data pos : %llu, count : %zd\n",
		    *pos, count);

	if (*pos >= XATTR_SIZE_MAX) {
		pr_err("stream write position %lld is out of bounds\n",	*pos);
		return -EINVAL;
	}

	size = *pos + count;
	if (size > XATTR_SIZE_MAX) {
		size = XATTR_SIZE_MAX;
		count = (*pos + count) - XATTR_SIZE_MAX;
		count = XATTR_SIZE_MAX - *pos;
	}

	v_len = ksmbd_vfs_getcasexattr(idmap,
@@ -426,13 +431,6 @@ static int ksmbd_vfs_stream_write(struct ksmbd_file *fp, char *buf, loff_t *pos,
		goto out;
	}

	if (v_len <= *pos) {
		pr_err("stream write position %lld is out of bounds (stream length: %zd)\n",
				*pos, v_len);
		err = -EINVAL;
		goto out;
	}

	if (v_len < size) {
		wbuf = kvzalloc(size, KSMBD_DEFAULT_GFP);
		if (!wbuf) {
@@ -684,7 +682,7 @@ int ksmbd_vfs_rename(struct ksmbd_work *work, const struct path *old_path,
	struct ksmbd_file *parent_fp;
	int new_type;
	int err, lookup_flags = LOOKUP_NO_SYMLINKS;
	int target_lookup_flags = LOOKUP_RENAME_TARGET;
	int target_lookup_flags = LOOKUP_RENAME_TARGET | LOOKUP_CREATE;

	if (ksmbd_override_fsids(work))
		return -ENOMEM;