1. 10 Jan, 2024 1 commit
  2. 09 Jan, 2024 9 commits
    • Namjae Jeon's avatar
      ksmbd: send lease break notification on FILE_RENAME_INFORMATION · 3fc74c65
      Namjae Jeon authored
      Send lease break notification on FILE_RENAME_INFORMATION request.
      This patch fix smb2.lease.v2_epoch2 test failure.
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      3fc74c65
    • Namjae Jeon's avatar
      ksmbd: don't allow O_TRUNC open on read-only share · d592a915
      Namjae Jeon authored
      When file is changed using notepad on read-only share(read_only = yes in
      ksmbd.conf), There is a problem where existing data is truncated.
      notepad in windows try to O_TRUNC open(FILE_OVERWRITE_IF) and all data
      in file is truncated. This patch don't allow  O_TRUNC open on read-only
      share and add KSMBD_TREE_CONN_FLAG_WRITABLE check in smb2_set_info().
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      d592a915
    • Randy Dunlap's avatar
      ksmbd: vfs: fix all kernel-doc warnings · 8d99c113
      Randy Dunlap authored
      Fix all kernel-doc warnings in vfs.c:
      
      vfs.c:54: warning: Function parameter or member 'parent' not described in 'ksmbd_vfs_lock_parent'
      vfs.c:54: warning: Function parameter or member 'child' not described in 'ksmbd_vfs_lock_parent'
      vfs.c:54: warning: No description found for return value of 'ksmbd_vfs_lock_parent'
      vfs.c:372: warning: Function parameter or member 'fp' not described in 'ksmbd_vfs_read'
      vfs.c:372: warning: Excess function parameter 'fid' description in 'ksmbd_vfs_read'
      vfs.c:489: warning: Function parameter or member 'fp' not described in 'ksmbd_vfs_write'
      vfs.c:489: warning: Excess function parameter 'fid' description in 'ksmbd_vfs_write'
      vfs.c:555: warning: Function parameter or member 'path' not described in 'ksmbd_vfs_getattr'
      vfs.c:555: warning: Function parameter or member 'stat' not described in 'ksmbd_vfs_getattr'
      vfs.c:555: warning: Excess function parameter 'work' description in 'ksmbd_vfs_getattr'
      vfs.c:555: warning: Excess function parameter 'fid' description in 'ksmbd_vfs_getattr'
      vfs.c:555: warning: Excess function parameter 'attrs' description in 'ksmbd_vfs_getattr'
      vfs.c:572: warning: Function parameter or member 'p_id' not described in 'ksmbd_vfs_fsync'
      vfs.c:595: warning: Function parameter or member 'work' not described in 'ksmbd_vfs_remove_file'
      vfs.c:595: warning: Function parameter or member 'path' not described in 'ksmbd_vfs_remove_file'
      vfs.c:595: warning: Excess function parameter 'name' description in 'ksmbd_vfs_remove_file'
      vfs.c:633: warning: Function parameter or member 'work' not described in 'ksmbd_vfs_link'
      vfs.c:805: warning: Function parameter or member 'fp' not described in 'ksmbd_vfs_truncate'
      vfs.c:805: warning: Excess function parameter 'fid' description in 'ksmbd_vfs_truncate'
      vfs.c:846: warning: Excess function parameter 'size' description in 'ksmbd_vfs_listxattr'
      vfs.c:953: warning: Function parameter or member 'option' not described in 'ksmbd_vfs_set_fadvise'
      vfs.c:953: warning: Excess function parameter 'options' description in 'ksmbd_vfs_set_fadvise'
      vfs.c:1167: warning: Function parameter or member 'um' not described in 'ksmbd_vfs_lookup_in_dir'
      vfs.c:1203: warning: Function parameter or member 'work' not described in 'ksmbd_vfs_kern_path_locked'
      vfs.c:1641: warning: No description found for return value of 'ksmbd_vfs_init_kstat'
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Namjae Jeon <linkinjeon@kernel.org>
      Cc: Steve French <sfrench@samba.org>
      Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Tom Talpey <tom@talpey.com>
      Cc: linux-cifs@vger.kernel.org
      Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      8d99c113
    • Randy Dunlap's avatar
      ksmbd: auth: fix most kernel-doc warnings · b4068f1e
      Randy Dunlap authored
      Fix 12 of 17 kernel-doc warnings in auth.c:
      
      auth.c:221: warning: Function parameter or member 'conn' not described in 'ksmbd_auth_ntlmv2'
      auth.c:221: warning: Function parameter or member 'cryptkey' not described in 'ksmbd_auth_ntlmv2'
      auth.c:305: warning: Function parameter or member 'blob_len' not described in 'ksmbd_decode_ntlmssp_auth_blob'
      auth.c:305: warning: Function parameter or member 'conn' not described in 'ksmbd_decode_ntlmssp_auth_blob'
      auth.c:305: warning: Excess function parameter 'usr' description in 'ksmbd_decode_ntlmssp_auth_blob'
      auth.c:385: warning: Function parameter or member 'blob_len' not described in 'ksmbd_decode_ntlmssp_neg_blob'
      auth.c:385: warning: Function parameter or member 'conn' not described in 'ksmbd_decode_ntlmssp_neg_blob'
      auth.c:385: warning: Excess function parameter 'rsp' description in 'ksmbd_decode_ntlmssp_neg_blob'
      auth.c:385: warning: Excess function parameter 'sess' description in 'ksmbd_decode_ntlmssp_neg_blob'
      auth.c:413: warning: Function parameter or member 'conn' not described in 'ksmbd_build_ntlmssp_challenge_blob'
      auth.c:413: warning: Excess function parameter 'rsp' description in 'ksmbd_build_ntlmssp_challenge_blob'
      auth.c:413: warning: Excess function parameter 'sess' description in 'ksmbd_build_ntlmssp_challenge_blob'
      
      The other 5 are only present when a W=1 kernel build is done or
      when scripts/kernel-doc is run with -Wall. They are:
      
      auth.c:81: warning: No description found for return value of 'ksmbd_gen_sess_key'
      auth.c:385: warning: No description found for return value of 'ksmbd_decode_ntlmssp_neg_blob'
      auth.c:413: warning: No description found for return value of 'ksmbd_build_ntlmssp_challenge_blob'
      auth.c:577: warning: No description found for return value of 'ksmbd_sign_smb2_pdu'
      auth.c:628: warning: No description found for return value of 'ksmbd_sign_smb3_pdu'
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Namjae Jeon <linkinjeon@kernel.org>
      Cc: Steve French <sfrench@samba.org>
      Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Tom Talpey <tom@talpey.com>
      Cc: linux-cifs@vger.kernel.org
      Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      b4068f1e
    • Christophe JAILLET's avatar
      ksmbd: Remove usage of the deprecated ida_simple_xx() API · ebfee7ad
      Christophe JAILLET authored
      ida_alloc() and ida_free() should be preferred to the deprecated
      ida_simple_get() and ida_simple_remove().
      
      This is less verbose.
      
      Note that the upper limit of ida_simple_get() is exclusive, but the one of
      ida_alloc_range() is inclusive. So change a 0xFFFFFFFF into a 0xFFFFFFFE in
      order to keep the same behavior.
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      ebfee7ad
    • Namjae Jeon's avatar
      ksmbd: don't increment epoch if current state and request state are same · b6e9a44e
      Namjae Jeon authored
      If existing lease state and request state are same, don't increment
      epoch in create context.
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      b6e9a44e
    • Namjae Jeon's avatar
      ksmbd: fix potential circular locking issue in smb2_set_ea() · 6fc0a265
      Namjae Jeon authored
      smb2_set_ea() can be called in parent inode lock range.
      So add get_write argument to smb2_set_ea() not to call nested
      mnt_want_write().
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      6fc0a265
    • Namjae Jeon's avatar
      ksmbd: set v2 lease version on lease upgrade · bb05367a
      Namjae Jeon authored
      If file opened with v2 lease is upgraded with v1 lease, smb server
      should response v2 lease create context to client.
      This patch fix smb2.lease.v2_epoch2 test failure.
      
      This test case assumes the following scenario:
       1. smb2 create with v2 lease(R, LEASE1 key)
       2. smb server return smb2 create response with v2 lease context(R,
      LEASE1 key, epoch + 1)
       3. smb2 create with v1 lease(RH, LEASE1 key)
       4. smb server return smb2 create response with v2 lease context(RH,
      LEASE1 key, epoch + 2)
      
      i.e. If same client(same lease key) try to open a file that is being
      opened with v2 lease with v1 lease, smb server should return v2 lease.
      Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Acked-by: default avatarTom Talpey <tom@talpey.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      bb05367a
    • Li Nan's avatar
      ksmbd: validate the zero field of packet header · 516b3eb8
      Li Nan authored
      The SMB2 Protocol requires that "The first byte of the Direct TCP
      transport packet header MUST be zero (0x00)"[1]. Commit 1c1bcf2d
      ("ksmbd: validate smb request protocol id") removed the validation of
      this 1-byte zero. Add the validation back now.
      
      [1]: [MS-SMB2] - v20230227, page 30.
      https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-SMB2/%5bMS-SMB2%5d-230227.pdf
      
      Fixes: 1c1bcf2d ("ksmbd: validate smb request protocol id")
      Signed-off-by: default avatarLi Nan <linan122@huawei.com>
      Acked-by: default avatarTom Talpey <tom@talpey.com>
      Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      516b3eb8
  3. 07 Jan, 2024 1 commit
  4. 06 Jan, 2024 2 commits
  5. 05 Jan, 2024 25 commits
  6. 04 Jan, 2024 2 commits
    • Linus Torvalds's avatar
      x86/csum: clean up `csum_partial' further · a476aae3
      Linus Torvalds authored
      Commit 688eb819 ("x86/csum: Improve performance of `csum_partial`")
      ended up improving the code generation for the IP csum calculations, and
      in particular special-casing the 40-byte case that is a hot case for
      IPv6 headers.
      
      It then had _another_ special case for the 64-byte unrolled loop, which
      did two chains of 32-byte blocks, which allows modern CPU's to improve
      performance by doing the chains in parallel thanks to renaming the carry
      flag.
      
      This just unifies the special cases and combines them into just one
      single helper the 40-byte csum case, and replaces the 64-byte case by a
      80-byte case that just does that single helper twice.  It avoids having
      all these different versions of inline assembly, and actually improved
      performance further in my tests.
      
      There was never anything magical about the 64-byte unrolled case, even
      though it happens to be a common size (and typically is the cacheline
      size).
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a476aae3
    • Noah Goldstein's avatar
      x86/csum: Remove unnecessary odd handling · 5d4acb62
      Noah Goldstein authored
      The special case for odd aligned buffers is unnecessary and mostly
      just adds overhead. Aligned buffers is the expectations, and even for
      unaligned buffer, the only case that was helped is if the buffer was
      1-byte from word aligned which is ~1/7 of the cases. Overall it seems
      highly unlikely to be worth to extra branch.
      
      It was left in the previous perf improvement patch because I was
      erroneously comparing the exact output of `csum_partial(...)`, but
      really we only need `csum_fold(csum_partial(...))` to match so its
      safe to remove.
      
      All csum kunit tests pass.
      Signed-off-by: default avatarNoah Goldstein <goldstein.w.n@gmail.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarDavid Laight <david.laight@aculab.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5d4acb62