mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:24:47 +01:00
eight client fixes
-----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEE6fsu8pdIjtWE/DpLiiy9cAdyT1EFAmmrTDwACgkQiiy9cAdy T1HHOAwAmGbU/6pbT09bNdSAdqfU41FLgKNQ2w6/cKliicpUON2uG9XEYkPi4NtP U34zJP2gdYByC+9cxw7sHgZJkT4FQko3HCzQUT/nSgGVjGI2zOywXroa4FOCCs07 sLRk7TerbjGceIB8Uw2OQsk8Bv2WxWn2MaVa27UffDF5DOuy85zFR4eLyAXI22mO Rg0aGjQYbAgXePYbsfPYUZr2E9HjZtr1u0w3zgzQxi+tIiZtYcvxea7xGd/S1ftj CGjpulyPK/pyteoFYtYJC5qZXDVaFfgrvH0mjCR2powlFx+HHjskPnj0fFqikksh W5ZkSxYlT+VcGJQFBmkJVBpaSPH10WO8mFTrEiPwwgrP8nese8CMFTtNM4f8tDjH LJMsM6VBpxWxd0donpM96ZshOXvoMSIss9nuvHkQrvgIbKQAs3NFQdGUCeGgYqMh ur25LZBmXUqz78uHRQHj7dnlSGxjLmHUUCKRoPR3Tm9yDE39ea9KlsVxxjXQaur8 JqG9I1ZF =Nnap -----END PGP SIGNATURE----- Merge tag 'v7.0-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6 Pull smb client fixes from Steve French: - Fix potential oops on open failure - Fix unmount to better free deferred closes - Use proper constant-time MAC comparison function - Two buffer allocation size fixes - Two minor cleanups - make SMB2 kunit tests a distinct module * tag 'v7.0-rc2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: smb: client: fix oops due to uninitialised var in smb2_unlink() cifs: open files should not hold ref on superblock smb: client: Compare MACs in constant time smb/client: remove unused SMB311_posix_query_info() smb/client: fix buffer size for smb311_posix_qinfo in SMB311_posix_query_info() smb/client: fix buffer size for smb311_posix_qinfo in smb2_compound_op() smb: update some doc references smb/client: make SMB2 maperror KUnit tests a separate module
This commit is contained in:
commit
e0c505cb76
16 changed files with 107 additions and 58 deletions
|
|
@ -56,4 +56,6 @@ $(obj)/smb2maperror.o: $(obj)/smb2_mapping_table.c
|
||||||
quiet_cmd_gen_smb2_mapping = GEN $@
|
quiet_cmd_gen_smb2_mapping = GEN $@
|
||||||
cmd_gen_smb2_mapping = perl $(src)/gen_smb2_mapping $< $@
|
cmd_gen_smb2_mapping = perl $(src)/gen_smb2_mapping $< $@
|
||||||
|
|
||||||
|
obj-$(CONFIG_SMB_KUNIT_TESTS) += smb2maperror_test.o
|
||||||
|
|
||||||
clean-files += smb2_mapping_table.c
|
clean-files += smb2_mapping_table.c
|
||||||
|
|
|
||||||
|
|
@ -332,10 +332,14 @@ static void cifs_kill_sb(struct super_block *sb)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need to release all dentries for the cached directories
|
* We need to release all dentries for the cached directories
|
||||||
* before we kill the sb.
|
* and close all deferred file handles before we kill the sb.
|
||||||
*/
|
*/
|
||||||
if (cifs_sb->root) {
|
if (cifs_sb->root) {
|
||||||
close_all_cached_dirs(cifs_sb);
|
close_all_cached_dirs(cifs_sb);
|
||||||
|
cifs_close_all_deferred_files_sb(cifs_sb);
|
||||||
|
|
||||||
|
/* Wait for all pending oplock breaks to complete */
|
||||||
|
flush_workqueue(cifsoplockd_wq);
|
||||||
|
|
||||||
/* finally release root dentry */
|
/* finally release root dentry */
|
||||||
dput(cifs_sb->root);
|
dput(cifs_sb->root);
|
||||||
|
|
@ -868,7 +872,6 @@ static void cifs_umount_begin(struct super_block *sb)
|
||||||
spin_unlock(&tcon->tc_lock);
|
spin_unlock(&tcon->tc_lock);
|
||||||
spin_unlock(&cifs_tcp_ses_lock);
|
spin_unlock(&cifs_tcp_ses_lock);
|
||||||
|
|
||||||
cifs_close_all_deferred_files(tcon);
|
|
||||||
/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
|
/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
|
||||||
/* cancel_notify_requests(tcon); */
|
/* cancel_notify_requests(tcon); */
|
||||||
if (tcon->ses && tcon->ses->server) {
|
if (tcon->ses && tcon->ses->server) {
|
||||||
|
|
|
||||||
|
|
@ -261,6 +261,7 @@ void cifs_close_deferred_file(struct cifsInodeInfo *cifs_inode);
|
||||||
|
|
||||||
void cifs_close_all_deferred_files(struct cifs_tcon *tcon);
|
void cifs_close_all_deferred_files(struct cifs_tcon *tcon);
|
||||||
|
|
||||||
|
void cifs_close_all_deferred_files_sb(struct cifs_sb_info *cifs_sb);
|
||||||
void cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon,
|
void cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon,
|
||||||
struct dentry *dentry);
|
struct dentry *dentry);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -711,8 +711,6 @@ struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
|
||||||
mutex_init(&cfile->fh_mutex);
|
mutex_init(&cfile->fh_mutex);
|
||||||
spin_lock_init(&cfile->file_info_lock);
|
spin_lock_init(&cfile->file_info_lock);
|
||||||
|
|
||||||
cifs_sb_active(inode->i_sb);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the server returned a read oplock and we have mandatory brlocks,
|
* If the server returned a read oplock and we have mandatory brlocks,
|
||||||
* set oplock level to None.
|
* set oplock level to None.
|
||||||
|
|
@ -767,7 +765,6 @@ static void cifsFileInfo_put_final(struct cifsFileInfo *cifs_file)
|
||||||
struct inode *inode = d_inode(cifs_file->dentry);
|
struct inode *inode = d_inode(cifs_file->dentry);
|
||||||
struct cifsInodeInfo *cifsi = CIFS_I(inode);
|
struct cifsInodeInfo *cifsi = CIFS_I(inode);
|
||||||
struct cifsLockInfo *li, *tmp;
|
struct cifsLockInfo *li, *tmp;
|
||||||
struct super_block *sb = inode->i_sb;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete any outstanding lock records. We'll lose them when the file
|
* Delete any outstanding lock records. We'll lose them when the file
|
||||||
|
|
@ -785,7 +782,6 @@ static void cifsFileInfo_put_final(struct cifsFileInfo *cifs_file)
|
||||||
|
|
||||||
cifs_put_tlink(cifs_file->tlink);
|
cifs_put_tlink(cifs_file->tlink);
|
||||||
dput(cifs_file->dentry);
|
dput(cifs_file->dentry);
|
||||||
cifs_sb_deactive(sb);
|
|
||||||
kfree(cifs_file->symlink_target);
|
kfree(cifs_file->symlink_target);
|
||||||
kfree(cifs_file);
|
kfree(cifs_file);
|
||||||
}
|
}
|
||||||
|
|
@ -3163,12 +3159,6 @@ void cifs_oplock_break(struct work_struct *work)
|
||||||
__u64 persistent_fid, volatile_fid;
|
__u64 persistent_fid, volatile_fid;
|
||||||
__u16 net_fid;
|
__u16 net_fid;
|
||||||
|
|
||||||
/*
|
|
||||||
* Hold a reference to the superblock to prevent it and its inodes from
|
|
||||||
* being freed while we are accessing cinode. Otherwise, _cifsFileInfo_put()
|
|
||||||
* may release the last reference to the sb and trigger inode eviction.
|
|
||||||
*/
|
|
||||||
cifs_sb_active(sb);
|
|
||||||
wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS,
|
wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS,
|
||||||
TASK_UNINTERRUPTIBLE);
|
TASK_UNINTERRUPTIBLE);
|
||||||
|
|
||||||
|
|
@ -3253,7 +3243,6 @@ oplock_break_ack:
|
||||||
cifs_put_tlink(tlink);
|
cifs_put_tlink(tlink);
|
||||||
out:
|
out:
|
||||||
cifs_done_oplock_break(cinode);
|
cifs_done_oplock_break(cinode);
|
||||||
cifs_sb_deactive(sb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cifs_swap_activate(struct swap_info_struct *sis,
|
static int cifs_swap_activate(struct swap_info_struct *sis,
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,11 @@
|
||||||
#include "fs_context.h"
|
#include "fs_context.h"
|
||||||
#include "cached_dir.h"
|
#include "cached_dir.h"
|
||||||
|
|
||||||
|
struct tcon_list {
|
||||||
|
struct list_head entry;
|
||||||
|
struct cifs_tcon *tcon;
|
||||||
|
};
|
||||||
|
|
||||||
/* The xid serves as a useful identifier for each incoming vfs request,
|
/* The xid serves as a useful identifier for each incoming vfs request,
|
||||||
in a similar way to the mid which is useful to track each sent smb,
|
in a similar way to the mid which is useful to track each sent smb,
|
||||||
and CurrentXid can also provide a running counter (although it
|
and CurrentXid can also provide a running counter (although it
|
||||||
|
|
@ -554,6 +559,43 @@ cifs_close_all_deferred_files(struct cifs_tcon *tcon)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cifs_close_all_deferred_files_sb(struct cifs_sb_info *cifs_sb)
|
||||||
|
{
|
||||||
|
struct rb_root *root = &cifs_sb->tlink_tree;
|
||||||
|
struct rb_node *node;
|
||||||
|
struct cifs_tcon *tcon;
|
||||||
|
struct tcon_link *tlink;
|
||||||
|
struct tcon_list *tmp_list, *q;
|
||||||
|
LIST_HEAD(tcon_head);
|
||||||
|
|
||||||
|
spin_lock(&cifs_sb->tlink_tree_lock);
|
||||||
|
for (node = rb_first(root); node; node = rb_next(node)) {
|
||||||
|
tlink = rb_entry(node, struct tcon_link, tl_rbnode);
|
||||||
|
tcon = tlink_tcon(tlink);
|
||||||
|
if (IS_ERR(tcon))
|
||||||
|
continue;
|
||||||
|
tmp_list = kmalloc_obj(struct tcon_list, GFP_ATOMIC);
|
||||||
|
if (tmp_list == NULL)
|
||||||
|
break;
|
||||||
|
tmp_list->tcon = tcon;
|
||||||
|
/* Take a reference on tcon to prevent it from being freed */
|
||||||
|
spin_lock(&tcon->tc_lock);
|
||||||
|
++tcon->tc_count;
|
||||||
|
trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count,
|
||||||
|
netfs_trace_tcon_ref_get_close_defer_files);
|
||||||
|
spin_unlock(&tcon->tc_lock);
|
||||||
|
list_add_tail(&tmp_list->entry, &tcon_head);
|
||||||
|
}
|
||||||
|
spin_unlock(&cifs_sb->tlink_tree_lock);
|
||||||
|
|
||||||
|
list_for_each_entry_safe(tmp_list, q, &tcon_head, entry) {
|
||||||
|
cifs_close_all_deferred_files(tmp_list->tcon);
|
||||||
|
list_del(&tmp_list->entry);
|
||||||
|
cifs_put_tcon(tmp_list->tcon, netfs_trace_tcon_ref_put_close_defer_files);
|
||||||
|
kfree(tmp_list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon,
|
void cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon,
|
||||||
struct dentry *dentry)
|
struct dentry *dentry)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include <linux/fips.h>
|
#include <linux/fips.h>
|
||||||
#include <crypto/md5.h>
|
#include <crypto/md5.h>
|
||||||
|
#include <crypto/utils.h>
|
||||||
#include "cifsproto.h"
|
#include "cifsproto.h"
|
||||||
#include "smb1proto.h"
|
#include "smb1proto.h"
|
||||||
#include "cifs_debug.h"
|
#include "cifs_debug.h"
|
||||||
|
|
@ -131,7 +132,7 @@ int cifs_verify_signature(struct smb_rqst *rqst,
|
||||||
/* cifs_dump_mem("what we think it should be: ",
|
/* cifs_dump_mem("what we think it should be: ",
|
||||||
what_we_think_sig_should_be, 16); */
|
what_we_think_sig_should_be, 16); */
|
||||||
|
|
||||||
if (memcmp(server_response_sig, what_we_think_sig_should_be, 8))
|
if (crypto_memneq(server_response_sig, what_we_think_sig_should_be, 8))
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -46,4 +46,16 @@ enum smb2_compound_ops {
|
||||||
#define END_OF_CHAIN 4
|
#define END_OF_CHAIN 4
|
||||||
#define RELATED_REQUEST 8
|
#define RELATED_REQUEST 8
|
||||||
|
|
||||||
|
/*
|
||||||
|
*****************************************************************
|
||||||
|
* Struct definitions go here
|
||||||
|
*****************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct status_to_posix_error {
|
||||||
|
__u32 smb2_status;
|
||||||
|
int posix_error;
|
||||||
|
char *status_string;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* _SMB2_GLOB_H */
|
#endif /* _SMB2_GLOB_H */
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ replay_again:
|
||||||
cfile->fid.volatile_fid,
|
cfile->fid.volatile_fid,
|
||||||
SMB_FIND_FILE_POSIX_INFO,
|
SMB_FIND_FILE_POSIX_INFO,
|
||||||
SMB2_O_INFO_FILE, 0,
|
SMB2_O_INFO_FILE, 0,
|
||||||
sizeof(struct smb311_posix_qinfo *) +
|
sizeof(struct smb311_posix_qinfo) +
|
||||||
(PATH_MAX * 2) +
|
(PATH_MAX * 2) +
|
||||||
(sizeof(struct smb_sid) * 2), 0, NULL);
|
(sizeof(struct smb_sid) * 2), 0, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -335,7 +335,7 @@ replay_again:
|
||||||
COMPOUND_FID,
|
COMPOUND_FID,
|
||||||
SMB_FIND_FILE_POSIX_INFO,
|
SMB_FIND_FILE_POSIX_INFO,
|
||||||
SMB2_O_INFO_FILE, 0,
|
SMB2_O_INFO_FILE, 0,
|
||||||
sizeof(struct smb311_posix_qinfo *) +
|
sizeof(struct smb311_posix_qinfo) +
|
||||||
(PATH_MAX * 2) +
|
(PATH_MAX * 2) +
|
||||||
(sizeof(struct smb_sid) * 2), 0, NULL);
|
(sizeof(struct smb_sid) * 2), 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
@ -1216,6 +1216,7 @@ again:
|
||||||
memset(resp_buftype, 0, sizeof(resp_buftype));
|
memset(resp_buftype, 0, sizeof(resp_buftype));
|
||||||
memset(rsp_iov, 0, sizeof(rsp_iov));
|
memset(rsp_iov, 0, sizeof(rsp_iov));
|
||||||
|
|
||||||
|
memset(open_iov, 0, sizeof(open_iov));
|
||||||
rqst[0].rq_iov = open_iov;
|
rqst[0].rq_iov = open_iov;
|
||||||
rqst[0].rq_nvec = ARRAY_SIZE(open_iov);
|
rqst[0].rq_nvec = ARRAY_SIZE(open_iov);
|
||||||
|
|
||||||
|
|
@ -1240,14 +1241,15 @@ again:
|
||||||
creq = rqst[0].rq_iov[0].iov_base;
|
creq = rqst[0].rq_iov[0].iov_base;
|
||||||
creq->ShareAccess = FILE_SHARE_DELETE_LE;
|
creq->ShareAccess = FILE_SHARE_DELETE_LE;
|
||||||
|
|
||||||
|
memset(&close_iov, 0, sizeof(close_iov));
|
||||||
rqst[1].rq_iov = &close_iov;
|
rqst[1].rq_iov = &close_iov;
|
||||||
rqst[1].rq_nvec = 1;
|
rqst[1].rq_nvec = 1;
|
||||||
|
|
||||||
rc = SMB2_close_init(tcon, server, &rqst[1],
|
rc = SMB2_close_init(tcon, server, &rqst[1],
|
||||||
COMPOUND_FID, COMPOUND_FID, false);
|
COMPOUND_FID, COMPOUND_FID, false);
|
||||||
smb2_set_related(&rqst[1]);
|
|
||||||
if (rc)
|
if (rc)
|
||||||
goto err_free;
|
goto err_free;
|
||||||
|
smb2_set_related(&rqst[1]);
|
||||||
|
|
||||||
if (retries) {
|
if (retries) {
|
||||||
/* Back-off before retry */
|
/* Back-off before retry */
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include "cifsglob.h"
|
|
||||||
#include "cifsproto.h"
|
#include "cifsproto.h"
|
||||||
#include "cifs_debug.h"
|
#include "cifs_debug.h"
|
||||||
#include "smb2proto.h"
|
#include "smb2proto.h"
|
||||||
|
|
@ -16,12 +15,6 @@
|
||||||
#include "../common/smb2status.h"
|
#include "../common/smb2status.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
struct status_to_posix_error {
|
|
||||||
__u32 smb2_status;
|
|
||||||
int posix_error;
|
|
||||||
char *status_string;
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct status_to_posix_error smb2_error_map_table[] = {
|
static const struct status_to_posix_error smb2_error_map_table[] = {
|
||||||
/*
|
/*
|
||||||
* Automatically generated by the `gen_smb2_mapping` script,
|
* Automatically generated by the `gen_smb2_mapping` script,
|
||||||
|
|
@ -115,10 +108,19 @@ int __init smb2_init_maperror(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SMB_CLIENT_KUNIT_AVAILABLE \
|
#if IS_ENABLED(CONFIG_SMB_KUNIT_TESTS)
|
||||||
((IS_MODULE(CONFIG_CIFS) && IS_ENABLED(CONFIG_KUNIT)) || \
|
/* Previous prototype for eliminating the build warning. */
|
||||||
(IS_BUILTIN(CONFIG_CIFS) && IS_BUILTIN(CONFIG_KUNIT)))
|
const struct status_to_posix_error *smb2_get_err_map_test(__u32 smb2_status);
|
||||||
|
|
||||||
#if SMB_CLIENT_KUNIT_AVAILABLE && IS_ENABLED(CONFIG_SMB_KUNIT_TESTS)
|
const struct status_to_posix_error *smb2_get_err_map_test(__u32 smb2_status)
|
||||||
#include "smb2maperror_test.c"
|
{
|
||||||
#endif /* CONFIG_SMB_KUNIT_TESTS */
|
return smb2_get_err_map(smb2_status);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(smb2_get_err_map_test);
|
||||||
|
|
||||||
|
const struct status_to_posix_error *smb2_error_map_table_test = smb2_error_map_table;
|
||||||
|
EXPORT_SYMBOL_GPL(smb2_error_map_table_test);
|
||||||
|
|
||||||
|
unsigned int smb2_error_map_num = ARRAY_SIZE(smb2_error_map_table);
|
||||||
|
EXPORT_SYMBOL_GPL(smb2_error_map_num);
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,18 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <kunit/test.h>
|
#include <kunit/test.h>
|
||||||
|
#include "smb2glob.h"
|
||||||
|
|
||||||
|
const struct status_to_posix_error *smb2_get_err_map_test(__u32 smb2_status);
|
||||||
|
extern const struct status_to_posix_error *smb2_error_map_table_test;
|
||||||
|
extern unsigned int smb2_error_map_num;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_cmp_map(struct kunit *test, const struct status_to_posix_error *expect)
|
test_cmp_map(struct kunit *test, const struct status_to_posix_error *expect)
|
||||||
{
|
{
|
||||||
const struct status_to_posix_error *result;
|
const struct status_to_posix_error *result;
|
||||||
|
|
||||||
result = smb2_get_err_map(expect->smb2_status);
|
result = smb2_get_err_map_test(expect->smb2_status);
|
||||||
KUNIT_EXPECT_PTR_NE(test, NULL, result);
|
KUNIT_EXPECT_PTR_NE(test, NULL, result);
|
||||||
KUNIT_EXPECT_EQ(test, expect->smb2_status, result->smb2_status);
|
KUNIT_EXPECT_EQ(test, expect->smb2_status, result->smb2_status);
|
||||||
KUNIT_EXPECT_EQ(test, expect->posix_error, result->posix_error);
|
KUNIT_EXPECT_EQ(test, expect->posix_error, result->posix_error);
|
||||||
|
|
@ -26,8 +31,8 @@ static void maperror_test_check_search(struct kunit *test)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(smb2_error_map_table); i++)
|
for (i = 0; i < smb2_error_map_num; i++)
|
||||||
test_cmp_map(test, &smb2_error_map_table[i]);
|
test_cmp_map(test, &smb2_error_map_table_test[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kunit_case maperror_test_cases[] = {
|
static struct kunit_case maperror_test_cases[] = {
|
||||||
|
|
@ -43,3 +48,4 @@ static struct kunit_suite maperror_suite = {
|
||||||
kunit_test_suite(maperror_suite);
|
kunit_test_suite(maperror_suite);
|
||||||
|
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
MODULE_DESCRIPTION("KUnit tests of SMB2 maperror");
|
||||||
|
|
|
||||||
|
|
@ -3989,24 +3989,6 @@ int SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* currently unused, as now we are doing compounding instead (see smb311_posix_query_path_info) */
|
|
||||||
int
|
|
||||||
SMB311_posix_query_info(const unsigned int xid, struct cifs_tcon *tcon,
|
|
||||||
u64 persistent_fid, u64 volatile_fid,
|
|
||||||
struct smb311_posix_qinfo *data, u32 *plen)
|
|
||||||
{
|
|
||||||
size_t output_len = sizeof(struct smb311_posix_qinfo *) +
|
|
||||||
(sizeof(struct smb_sid) * 2) + (PATH_MAX * 2);
|
|
||||||
*plen = 0;
|
|
||||||
|
|
||||||
return query_info(xid, tcon, persistent_fid, volatile_fid,
|
|
||||||
SMB_FIND_FILE_POSIX_INFO, SMB2_O_INFO_FILE, 0,
|
|
||||||
output_len, sizeof(struct smb311_posix_qinfo), (void **)&data, plen);
|
|
||||||
/* Note caller must free "data" (passed in above). It may be allocated in query_info call */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
SMB2_query_acl(const unsigned int xid, struct cifs_tcon *tcon,
|
SMB2_query_acl(const unsigned int xid, struct cifs_tcon *tcon,
|
||||||
u64 persistent_fid, u64 volatile_fid,
|
u64 persistent_fid, u64 volatile_fid,
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ struct smb2_file_reparse_point_info {
|
||||||
__le32 Tag;
|
__le32 Tag;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
/* See MS-FSCC 2.4.21 */
|
/* See MS-FSCC 2.4.26 */
|
||||||
struct smb2_file_id_information {
|
struct smb2_file_id_information {
|
||||||
__le64 VolumeSerialNumber;
|
__le64 VolumeSerialNumber;
|
||||||
__u64 PersistentFileId; /* opaque endianness */
|
__u64 PersistentFileId; /* opaque endianness */
|
||||||
|
|
@ -251,7 +251,10 @@ struct smb2_file_id_extd_directory_info {
|
||||||
|
|
||||||
extern char smb2_padding[7];
|
extern char smb2_padding[7];
|
||||||
|
|
||||||
/* equivalent of the contents of SMB3.1.1 POSIX open context response */
|
/*
|
||||||
|
* See POSIX-SMB2 2.2.14.2.16
|
||||||
|
* Link: https://gitlab.com/samba-team/smb3-posix-spec/-/blob/master/smb3_posix_extensions.md
|
||||||
|
*/
|
||||||
struct create_posix_rsp {
|
struct create_posix_rsp {
|
||||||
u32 nlink;
|
u32 nlink;
|
||||||
u32 reparse_tag;
|
u32 reparse_tag;
|
||||||
|
|
|
||||||
|
|
@ -167,9 +167,6 @@ int SMB2_flush_init(const unsigned int xid, struct smb_rqst *rqst,
|
||||||
struct cifs_tcon *tcon, struct TCP_Server_Info *server,
|
struct cifs_tcon *tcon, struct TCP_Server_Info *server,
|
||||||
u64 persistent_fid, u64 volatile_fid);
|
u64 persistent_fid, u64 volatile_fid);
|
||||||
void SMB2_flush_free(struct smb_rqst *rqst);
|
void SMB2_flush_free(struct smb_rqst *rqst);
|
||||||
int SMB311_posix_query_info(const unsigned int xid, struct cifs_tcon *tcon,
|
|
||||||
u64 persistent_fid, u64 volatile_fid,
|
|
||||||
struct smb311_posix_qinfo *data, u32 *plen);
|
|
||||||
int SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon,
|
int SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon,
|
||||||
u64 persistent_fid, u64 volatile_fid,
|
u64 persistent_fid, u64 volatile_fid,
|
||||||
struct smb2_file_all_info *data);
|
struct smb2_file_all_info *data);
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
#include <crypto/aead.h>
|
#include <crypto/aead.h>
|
||||||
#include <crypto/sha2.h>
|
#include <crypto/sha2.h>
|
||||||
|
#include <crypto/utils.h>
|
||||||
#include "cifsglob.h"
|
#include "cifsglob.h"
|
||||||
#include "cifsproto.h"
|
#include "cifsproto.h"
|
||||||
#include "smb2proto.h"
|
#include "smb2proto.h"
|
||||||
|
|
@ -617,7 +618,8 @@ smb2_verify_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
if (memcmp(server_response_sig, shdr->Signature, SMB2_SIGNATURE_SIZE)) {
|
if (crypto_memneq(server_response_sig, shdr->Signature,
|
||||||
|
SMB2_SIGNATURE_SIZE)) {
|
||||||
cifs_dbg(VFS, "sign fail cmd 0x%x message id 0x%llx\n",
|
cifs_dbg(VFS, "sign fail cmd 0x%x message id 0x%llx\n",
|
||||||
shdr->Command, shdr->MessageId);
|
shdr->Command, shdr->MessageId);
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,7 @@
|
||||||
EM(netfs_trace_tcon_ref_get_cached_laundromat, "GET Ch-Lau") \
|
EM(netfs_trace_tcon_ref_get_cached_laundromat, "GET Ch-Lau") \
|
||||||
EM(netfs_trace_tcon_ref_get_cached_lease_break, "GET Ch-Lea") \
|
EM(netfs_trace_tcon_ref_get_cached_lease_break, "GET Ch-Lea") \
|
||||||
EM(netfs_trace_tcon_ref_get_cancelled_close, "GET Cn-Cls") \
|
EM(netfs_trace_tcon_ref_get_cancelled_close, "GET Cn-Cls") \
|
||||||
|
EM(netfs_trace_tcon_ref_get_close_defer_files, "GET Cl-Def") \
|
||||||
EM(netfs_trace_tcon_ref_get_dfs_refer, "GET DfsRef") \
|
EM(netfs_trace_tcon_ref_get_dfs_refer, "GET DfsRef") \
|
||||||
EM(netfs_trace_tcon_ref_get_find, "GET Find ") \
|
EM(netfs_trace_tcon_ref_get_find, "GET Find ") \
|
||||||
EM(netfs_trace_tcon_ref_get_find_sess_tcon, "GET FndSes") \
|
EM(netfs_trace_tcon_ref_get_find_sess_tcon, "GET FndSes") \
|
||||||
|
|
@ -187,6 +188,7 @@
|
||||||
EM(netfs_trace_tcon_ref_put_cancelled_close, "PUT Cn-Cls") \
|
EM(netfs_trace_tcon_ref_put_cancelled_close, "PUT Cn-Cls") \
|
||||||
EM(netfs_trace_tcon_ref_put_cancelled_close_fid, "PUT Cn-Fid") \
|
EM(netfs_trace_tcon_ref_put_cancelled_close_fid, "PUT Cn-Fid") \
|
||||||
EM(netfs_trace_tcon_ref_put_cancelled_mid, "PUT Cn-Mid") \
|
EM(netfs_trace_tcon_ref_put_cancelled_mid, "PUT Cn-Mid") \
|
||||||
|
EM(netfs_trace_tcon_ref_put_close_defer_files, "PUT Cl-Def") \
|
||||||
EM(netfs_trace_tcon_ref_put_mnt_ctx, "PUT MntCtx") \
|
EM(netfs_trace_tcon_ref_put_mnt_ctx, "PUT MntCtx") \
|
||||||
EM(netfs_trace_tcon_ref_put_dfs_refer, "PUT DfsRfr") \
|
EM(netfs_trace_tcon_ref_put_dfs_refer, "PUT DfsRfr") \
|
||||||
EM(netfs_trace_tcon_ref_put_reconnect_server, "PUT Reconn") \
|
EM(netfs_trace_tcon_ref_put_reconnect_server, "PUT Reconn") \
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,10 @@ struct create_durable_rsp {
|
||||||
} Data;
|
} Data;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
/* equivalent of the contents of SMB3.1.1 POSIX open context response */
|
/*
|
||||||
|
* See POSIX-SMB2 2.2.14.2.16
|
||||||
|
* Link: https://gitlab.com/samba-team/smb3-posix-spec/-/blob/master/smb3_posix_extensions.md
|
||||||
|
*/
|
||||||
struct create_posix_rsp {
|
struct create_posix_rsp {
|
||||||
struct create_context_hdr ccontext;
|
struct create_context_hdr ccontext;
|
||||||
__u8 Name[16];
|
__u8 Name[16];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue