Merge tag '6.1-rc-ksmbd-fixes' of git://git.samba.org/ksmbd
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 7 Oct 2022 15:19:26 +0000 (08:19 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 7 Oct 2022 15:19:26 +0000 (08:19 -0700)
Pull ksmbd updates from Steve French:

 - RDMA (smbdirect) fixes

 - fixes for SMB3.1.1 POSIX Extensions (especially for id mapping)

 - various casemapping fixes for mount and lookup

 - UID mapping fixes

 - fix confusing error message

 - protocol negotiation fixes, including NTLMSSP fix

 - two encryption fixes

 - directory listing fix

 - some cleanup fixes

* tag '6.1-rc-ksmbd-fixes' of git://git.samba.org/ksmbd: (24 commits)
  ksmbd: validate share name from share config response
  ksmbd: call ib_drain_qp when disconnected
  ksmbd: make utf-8 file name comparison work in __caseless_lookup()
  ksmbd: Fix user namespace mapping
  ksmbd: hide socket error message when ipv6 config is disable
  ksmbd: reduce server smbdirect max send/receive segment sizes
  ksmbd: decrease the number of SMB3 smbdirect server SGEs
  ksmbd: Fix wrong return value and message length check in smb2_ioctl()
  ksmbd: set NTLMSSP_NEGOTIATE_SEAL flag to challenge blob
  ksmbd: fix encryption failure issue for session logoff response
  ksmbd: fix endless loop when encryption for response fails
  ksmbd: fill sids in SMB_FIND_FILE_POSIX_INFO response
  ksmbd: set file permission mode to match Samba server posix extension behavior
  ksmbd: change security id to the one samba used for posix extension
  ksmbd: update documentation
  ksmbd: casefold utf-8 share names and fix ascii lowercase conversion
  ksmbd: port to vfs{g,u}id_t and associated helpers
  ksmbd: fix incorrect handling of iterate_dir
  MAINTAINERS: remove Hyunchul Lee from ksmbd maintainers
  MAINTAINERS: Add Tom Talpey as ksmbd reviewer
  ...

1  2 
MAINTAINERS
fs/ksmbd/smb2pdu.c
fs/ksmbd/vfs.c

diff --cc MAINTAINERS
Simple merge
@@@ -3800,17 -3809,14 +3809,12 @@@ static bool __query_dir(struct dir_cont
        d_info->name_len        = namlen;
        rc = reserve_populate_dentry(d_info, priv->info_level);
        if (rc)
 -              return rc;
 -      if (d_info->flags & SMB2_RETURN_SINGLE_ENTRY) {
 +              return false;
 +      if (d_info->flags & SMB2_RETURN_SINGLE_ENTRY)
                d_info->out_buf_len = 0;
 -              return 0;
 -      }
 -      return 0;
 +      return true;
  }
  
- static void restart_ctx(struct dir_context *ctx)
- {
-       ctx->pos = 0;
- }
  static int verify_info_level(int info_level)
  {
        switch (info_level) {
diff --cc fs/ksmbd/vfs.c
@@@ -1149,13 -1150,23 +1148,23 @@@ static bool __caseless_lookup(struct di
        buf = container_of(ctx, struct ksmbd_readdir_data, ctx);
  
        if (buf->used != namlen)
 -              return 0;
 +              return true;
-       if (!strncasecmp((char *)buf->private, name, namlen)) {
+       if (IS_ENABLED(CONFIG_UNICODE) && buf->um) {
+               const struct qstr q_buf = {.name = buf->private,
+                                          .len = buf->used};
+               const struct qstr q_name = {.name = name,
+                                           .len = namlen};
+               cmp = utf8_strncasecmp(buf->um, &q_buf, &q_name);
+       }
+       if (cmp < 0)
+               cmp = strncasecmp((char *)buf->private, name, namlen);
+       if (!cmp) {
                memcpy((char *)buf->private, name, namlen);
                buf->dirent_count = 1;
 -              return -EEXIST;
 +              return false;
        }
 -      return 0;
 +      return true;
  }
  
  /**