Commit Graph

1013574 Commits

Author SHA1 Message Date
Namjae Jeon
ade62d8b42 cifsd: set epoch in smb2_lease_break response
When running generic/591 after smb2 leases is enable, all smb2 lease ack
requests failed in ksmbd. because cifs client seems to support only smb2
v2 lease. So cifs doesn't update lease state in ack request if epoch is
not set in smb2 lease break request from ksmbd. epoch is used for smb2
v2 leases. So this patch add smb2 create v2 lease context and set
increased epoch in smb2 lease break response.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-06-07 09:22:53 +09:00
Namjae Jeon
6c4e675ad3 cifsd: fix list_add double add BUG_ON trap in setup_async_work()
BUG_ON trap is coming when running xfstests generic/591 and
smb2 leases = yes in smb.conf.

[  597.224978] list_add double add: new=ffff9110d292bb20,
prev=ffff9110d292bb20, next=ffff9110d6c389e8.
[  597.225073] ------------[ cut here ]------------
[  597.225077] kernel BUG at lib/list_debug.c:31!
[  597.225090] invalid opcode: 0000 [#1] SMP PTI
[  597.225095] CPU: 2 PID: 501 Comm: kworker/2:3 Tainted: G           OE
5.13.0-rc1+ #2
[  597.225099] Hardware name: SAMSUNG ELECTRONICS CO., LTD. Samsung
DeskTop System/SAMSUNG_DT1234567890, BIOS P04KBM.022.121023.SK
10/23/2012
[  597.225102] Workqueue: ksmbd-io handle_ksmbd_work [ksmbd]
[  597.225125] RIP: 0010:__list_add_valid+0x66/0x70
[  597.225132] Code: 0b 48 89 c1 4c 89 c6 48 c7 c7 c8 08 c0 95 e8 fd 54
66 00 0f 0b 48 89 f2 4c 89 c1 48 89 fe 48 c7 c7 20 09 c0 95 e8 e6 54 66
00 <0f> 0b 0f 1f 84 00 00 00 00 00 55 48 8b 07 48 b9 00 01 00 00 00 00
[  597.225136] RSP: 0018:ffffb9c9408dbac0 EFLAGS: 00010282
[  597.225139] RAX: 0000000000000058 RBX: ffff9110d292ba40 RCX:
0000000000000000
[  597.225142] RDX: 0000000000000000 RSI: ffff9111da328c30 RDI:
ffff9111da328c30
[  597.225144] RBP: ffffb9c9408dbac0 R08: 0000000000000001 R09:
0000000000000001
[  597.225147] R10: 0000000003dd35ed R11: ffffb9c9408db888 R12:
ffff9110d6c38998
[  597.225149] R13: ffff9110d6c38800 R14: ffff9110d292bb20 R15:
ffff9110d292bb20
[  597.225152] FS:  0000000000000000(0000) GS:ffff9111da300000(0000)
knlGS:0000000000000000
[  597.225155] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  597.225157] CR2: 00007fd1629f84d0 CR3: 00000000c9a12006 CR4:
00000000001706e0
[  597.225160] Call Trace:
[  597.225163]  setup_async_work+0xa2/0x120 [ksmbd]
[  597.225191]  oplock_break+0x396/0x5d0 [ksmbd]
[  597.225206]  smb_grant_oplock+0x7a1/0x900 [ksmbd]
[  597.225218]  ? smb_grant_oplock+0x7a1/0x900 [ksmbd]
[  597.225231]  smb2_open+0xbbb/0x2960 [ksmbd]
[  597.225243]  ? smb2_open+0xbbb/0x2960 [ksmbd]
[  597.225257]  ? find_held_lock+0x35/0xa0
[  597.225261]  ? xa_load+0xaf/0x160
[  597.225268]  handle_ksmbd_work+0x2e0/0x420 [ksmbd]
[  597.225280]  ? handle_ksmbd_work+0x2e0/0x420 [ksmbd]
[  597.225292]  process_one_work+0x25a/0x5d0
[  597.225298]  worker_thread+0x3f/0x3a0
[  597.225302]  ? __kthread_parkme+0x6f/0xa0
[  597.225306]  ? process_one_work+0x5d0/0x5d0
[  597.225309]  kthread+0x142/0x160
[  597.225313]  ? kthread_park+0x90/0x90
[  597.225316]  ret_from_fork+0x22/0x30

same work struct can be add to list in smb_break_all_write_oplock() and
smb_grant_oplock(). If client send invalid lease break ack to server,
This issue can occur by calling both functions.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-06-07 09:10:16 +09:00
Namjae Jeon
97d7f3d3e0 cifsd: fix additional warnings from checkpatch.pl --strict
Fix additional warnings from checkpatch.pl --strict.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-06-01 14:06:58 +09:00
Namjae Jeon
2ae1a6cc43 cifsd: fix potential read overflow in ksmbd_vfs_stream_read()
If *pos or *pos + count is greater than v_len, It will read beyond
the stream_buf buffer. This patch add the check and cut down count with
size of the buffer.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-06-01 09:26:22 +09:00
Yang Yingliang
fd6de099d7 cifsd: check return value of ksmbd_vfs_getcasexattr() correctly
If ksmbd_vfs_getcasexattr() returns -ENOMEM, stream_buf is NULL,
it will cause null-ptr-deref when using it to copy memory. So we
need check the return value of ksmbd_vfs_getcasexattr() by comparing
with 0.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-06-01 09:26:20 +09:00
Yang Yingliang
673b9ba7a1 cifsd: fix memleak in ksmbd_vfs_stream_read()
Before ksmbd_vfs_stream_read() return, memory allocate in
ksmbd_vfs_getcasexattr() need be freed.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-31 13:52:59 +09:00
Yang Yingliang
113ef68d47 cifsd: fix memleak in ksmbd_vfs_stream_write()
Before assigning wbuf to stream_buf, memory allocate in
ksmbd_vfs_getcasexattr() need be freed.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-31 13:52:55 +09:00
Hyunchul Lee
d7e5852b4d cifsd: make alignment match open parenthesis
checkpatch.pl complains as the following:

Alignment should match open parenthesis.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-31 13:48:38 +09:00
Hyunchul Lee
40c594b647 cifsd: enclose macro variables in parenthesis
checkpatch.pl complains as the following:

CHECK: Macro argument 'fp' may be better as '(fp)' to avoid
precedence issues.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-31 13:48:29 +09:00
Namjae Jeon
152de8c68d cifsd: fix Control flow issues in ksmbd_build_ntlmssp_challenge_blob()
Fix a defect reported by Coverity Scan.

*** CID 1504970:  Control flow issues  (NO_EFFECT)
/fs/cifsd/auth.c: 622 in ksmbd_build_ntlmssp_challenge_blob()
616             name = kmalloc(2 + UNICODE_LEN(len), GFP_KERNEL);
617             if (!name)
618                     return -ENOMEM;
619
620             conv_len = smb_strtoUTF16((__le16 *)name,
ksmbd_netbios_name(), len,
621                                       sess->conn->local_nls);
>>>     CID 1504970:  Control flow issues  (NO_EFFECT)
>>>     This less-than-zero comparison of an unsigned value is never true.
622             if (conv_len < 0 || conv_len > len) {
623                     kfree(name);
624                     return -EINVAL;
625             }
626
627             uni_len = UNICODE_LEN(conv_len);

Reported-by: Coverity Scan <scan-admin@coverity.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-29 08:00:39 +09:00
Hyunchul Lee
a6a5fa7780 cifsd: lookup a file with LOOKUP_FOLLOW only if 'follow symlinks = yes'
Some vfs help functions lookup a file with
LOOKUP_FOLLOW regardless of the "follow symlinks"
option.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 19:13:54 +09:00
Namjae Jeon
fc2d1b58c4 cifsd: Prefer kernel type 'u16' over 'uint16_t'
Fix a warning from checkpatch.pl --strict:

 CHECK: Prefer kernel type 'u16' over 'uint16_t'
 #112: FILE: server.c:112:
 +       uint16_t command;

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:13:59 +09:00
Namjae Jeon
c986ed981a cifsd: remove unnecessary parentheses around
Fix warnings from checkpatch.pl --strict :

 CHECK: Unnecessary parentheses around 'brk_op->o_lease->new_state ==
 SMB2_LEASE_NONE_LE'
 #1511: FILE: oplock.c:1511:
 +               if (brk_op->is_lease &&
 +                   (brk_op->o_lease->new_state == SMB2_LEASE_NONE_LE)
 &&
 +                   atomic_read(&brk_op->breaking_cnt))

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:13:55 +09:00
Namjae Jeon
070fb21e59 cifsd: Alignment should match open parenthesis
Fix warnings "Alignment should match open parenthesis" from
checkpatch.pl --strict.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:13:51 +09:00
Namjae Jeon
fe30ea69ff cifsd: Blank lines aren't necessary after an open brace '{'
Blank lines aren't necessary after an open brace '{'.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:13:46 +09:00
Namjae Jeon
10268f7d57 cifsd: No space is necessary after a cast
No space is necessary after a cast.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:13:41 +09:00
Namjae Jeon
2f5205c237 cifsd: don't use multiple blank lines
don't use multiple blank lines.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:13:37 +09:00
Namjae Jeon
c8ed11522b cifsd: spaces preferred around that '/'
Fix "CHECK: paces preferred around that '/' from checkpatch.pl --strict.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:13:30 +09:00
Namjae Jeon
a2d6321b45 cifsd: braces {} should be used on all arms of this statement
Fix "CHECK: braces {} should be used on all arms of this statement"
from checkpatch.pl --strict.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:13:26 +09:00
Namjae Jeon
a2d0b5034a cifsd: add the check to prevent potential overflow with smb_strtoUTF16() and UNICODE_LEN()
Add the check to prevent potential overflow with smb_strtoUTF16() and
UNICODE_LEN().

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:13:21 +09:00
Namjae Jeon
7047805976 cifsd: alignment match open parenthesis
Alignment match open parenthesis.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:13:16 +09:00
Namjae Jeon
0e579cd17f cifsd: return -ENOMEM about error from ksmbd_crypto_ctx_find_xxx calls
Return -ENOMEM about error from ksmbd_crypto_ctx_find_xxx calls.
And remove unneeded return value print in debug message.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:13:12 +09:00
Namjae Jeon
d3cd8c4915 cifsd: simplify error handling in ksmbd_gen_preauth_integrity_hash()
Simplify error handling in ksmbd_gen_preauth_integrity_hash().

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:13:07 +09:00
Namjae Jeon
12fc704441 cifsd: call kzalloc() directly instead of wrapper
Call kzalloc() directly instead of wrapper function.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:13:03 +09:00
Namjae Jeon
533a45da1a cifsd: add default case in switch statment in alloc_shash_desc()
Add default case in switch statment in alloc_shash_desc().

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:12:57 +09:00
Namjae Jeon
73b8b08539 cifsd: change success handling to failure handling
Change success handling to failure handling in ksmbd_crypt_message().

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:12:53 +09:00
Namjae Jeon
27aa646db0 cifsd: fix wrong return value in ksmbd_crypt_message()
Change error return instead of returning always success return.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:12:48 +09:00
Namjae Jeon
03f1c3d388 cifsd: remove unneeded initialization of rc variable in ksmbd_crypt_message()
Remove unneeded initialization of rc variable in ksmbd_crypt_message().

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:12:42 +09:00
Namjae Jeon
08591ccfdd cifsd: len can never be negative in ksmbd_init_sg()
Dan pointed out len can not be negative.
This patch remove unneeded negative check in loop.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:12:37 +09:00
Namjae Jeon
41a7848a01 cifsd: add the check if nvec is zero
Dan Carpenter pointed out that memory can be corrupted when nvec is zero.
This patch add the check to prevent it.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:12:33 +09:00
Namjae Jeon
522dcc7626 cifsd: never return 1 on failure
Never return 1 on failure.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:12:29 +09:00
Namjae Jeon
876edcc4cf cifsd: return zero in always success case
Return zero in always success case.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:12:26 +09:00
Namjae Jeon
b72802aa77 cifsd: set error return value for memcmp() difference
Set error return value for memcmp() difference.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:12:20 +09:00
Namjae Jeon
192cc732c6 cifsd: remove unneeded type casting
Remove unneeded type casting.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:12:16 +09:00
Namjae Jeon
4a6b022826 cifsd: simplify error handling in ksmbd_auth_ntlm()
simplify error handling in ksmbd_auth_ntlm().

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:12:11 +09:00
Namjae Jeon
7e38ea254c cifsd: move ret check before the out label
Move ret check before the out label.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:12:04 +09:00
Namjae Jeon
fd43cbbe0a cifsd: just return smbhash() instead of using rc return value
Just return smbhash() instead of using rc return value.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:12:00 +09:00
Namjae Jeon
9409670237 cifsd: move fips_enabled check before the str_to_key()
Move fips_enabled check before the str_to_key().

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:11:53 +09:00
Namjae Jeon
8bae4419ce cifsd: add goto fail in neg_token_init_mech_type()
Add goto fail in neg_token_init_mech_type().

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:11:45 +09:00
Namjae Jeon
3566a2b0f7 cifsd: use memcmp instead of for loop check in oid_eq()
Use memcmp instead of for loop check in oid_eq().

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:11:41 +09:00
Namjae Jeon
cdd10398e7 cifsd: add goto fail in asn1_oid_decode()
Add goto fail in asn1_oid_decode() to clean-up exception handling code.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-26 18:11:35 +09:00
Wei Yongjun
be29a3709b cifsd: fix build error without CONFIG_OID_REGISTRY
Fix build error when CONFIG_OID_REGISTRY is not set:

mips-linux-gnu-ld: fs/cifsd/asn1.o: in function `gssapi_this_mech':
asn1.c:(.text+0xaa0): undefined reference to `sprint_oid'
mips-linux-gnu-ld: fs/cifsd/asn1.o: in function `neg_token_init_mech_type':
asn1.c:(.text+0xbec): undefined reference to `sprint_oid'

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-21 09:33:22 +09:00
Namjae Jeon
eb817368f5 cifsd: add support for FSCTL_DUPLICATE_EXTENTS_TO_FILE
Add support for FSCTL_DUPLICATE_EXTENTS_TO_FILE in smb2 ioctl.

Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-18 10:38:41 +09:00
Marios Makassikis
8602c3e2ce cifsd: Do not use 0 or 0xFFFFFFFF for TreeID
Returning TreeID=0 is valid behaviour according to [MS-SMB2] 2.2.1.2:

  TreeId (4 bytes): Uniquely identifies the tree connect for the command.
  This MUST be 0 for the SMB2 TREE_CONNECT Request. The TreeId can be
  any unsigned 32-bit integer that is received from a previous
  SMB2 TREE_CONNECT Response. TreeId SHOULD be set to 0 for the
  following commands:
   [...]

However, some client implementations reject it as invalid. Windows10
assigns ids starting from 1, and samba4 returns a random uint32_t
which suggests there may be other clients that consider it is
invalid behaviour.

Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-18 10:31:03 +09:00
Namjae Jeon
50bf80a553 cifsd: fix xfstests generic/504 test failure
If lock length in smb2 lock request from client is over
flock max length size, lock length is changed to flock max length
and don't return error response.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-14 12:28:36 +09:00
kernel test robot
5616015f54 cifsd: fix boolreturn.cocci warnings
fs/cifsd/smb2pdu.c:8098:8-9: WARNING: return of 0/1 in function
'smb2_is_sign_req' with return type bool

 Return statements in functions returning bool should use  true/false
instead of 1/0.
Generated by: scripts/coccinelle/misc/boolreturn.cocci

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-12 09:25:53 +09:00
Namjae Jeon
5ce0716593 cifsd: fix build break from asn1
build break from asn1 happened on some environment.

  CHECK   /home/smfrench/smb3-kernel/fs/cifsd/smb2misc.c
  CC [M]  /home/smfrench/smb3-kernel/fs/cifsd/asn1.o
/home/smfrench/smb3-kernel/fs/cifsd/asn1.c:21:10: fatal error:
spnego_negtokeninit.asn1.h: No such file or directory
   21 | #include "spnego_negtokeninit.asn1.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.build:271:
/home/smfrench/smb3-kernel/fs/cifsd/asn1.o] Error 1
make: *** [Makefile:1857: /home/smfrench/smb3-kernel/fs/cifsd] Error 2
make: Leaving directory
'/usr/src/linux-headers-5.12.0-051200rc8-generic'

This patch fix that asn1 compiler build *.asn1 file before compiling
asn.c

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-11 10:46:50 +09:00
Namjae Jeon
3d47e54623 cifsd: fix WARNING: Too many leading tabs
WARNING: Too many leading tabs - consider code refactoring
3066: FILE: fs/cifsd/smb2pdu.c:2733:
+                                               if (fattr.cf_dacls)

Fix a warning from checkpatch.pl.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-11 10:46:47 +09:00
Namjae Jeon
63c454f839 cifsd: fix WARNING: Possible unnecessary 'out of memory' message
WARNING: Possible unnecessary 'out of memory' message
902: FILE: fs/cifsd/smb2pdu.c:569:
+       if (!work->response_buf) {
+               ksmbd_err("Failed to allocate %zu bytes buffer\n", sz);

Fix a warning from checkpatch.pl.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-11 10:46:42 +09:00
Hyunchul Lee
fad4161b5c cifsd: decoding gss token using lib/asn1_decoder.c
Decode gss token of SMB2_SESSSION_SETUP using
lib/asn1_decoder.c

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2021-05-11 10:46:38 +09:00