mirror of
https://github.com/LuckfoxTECH/luckfox-pico.git
synced 2026-01-19 09:52:31 +01:00
project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp: Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem. sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately. sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades. sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for fastboot. Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
@@ -898,7 +898,7 @@ cifs_loose_read_iter(struct kiocb *iocb, struct iov_iter *iter)
|
||||
ssize_t rc;
|
||||
struct inode *inode = file_inode(iocb->ki_filp);
|
||||
|
||||
if (iocb->ki_filp->f_flags & O_DIRECT)
|
||||
if (iocb->ki_flags & IOCB_DIRECT)
|
||||
return cifs_user_readv(iocb, iter);
|
||||
|
||||
rc = cifs_revalidate_mapping(inode);
|
||||
@@ -1033,7 +1033,7 @@ struct file_system_type cifs_fs_type = {
|
||||
};
|
||||
MODULE_ALIAS_FS("cifs");
|
||||
|
||||
static struct file_system_type smb3_fs_type = {
|
||||
struct file_system_type smb3_fs_type = {
|
||||
.owner = THIS_MODULE,
|
||||
.name = "smb3",
|
||||
.mount = smb3_do_mount,
|
||||
@@ -1221,8 +1221,11 @@ static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off,
|
||||
ssize_t rc;
|
||||
struct cifsFileInfo *cfile = dst_file->private_data;
|
||||
|
||||
if (cfile->swapfile)
|
||||
return -EOPNOTSUPP;
|
||||
if (cfile->swapfile) {
|
||||
rc = -EOPNOTSUPP;
|
||||
free_xid(xid);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = cifs_file_copychunk_range(xid, src_file, off, dst_file, destoff,
|
||||
len, flags);
|
||||
|
||||
@@ -51,7 +51,7 @@ static inline unsigned long cifs_get_time(struct dentry *dentry)
|
||||
return (unsigned long) dentry->d_fsdata;
|
||||
}
|
||||
|
||||
extern struct file_system_type cifs_fs_type;
|
||||
extern struct file_system_type cifs_fs_type, smb3_fs_type;
|
||||
extern const struct address_space_operations cifs_addr_ops;
|
||||
extern const struct address_space_operations cifs_addr_ops_smallbuf;
|
||||
|
||||
|
||||
@@ -1982,11 +1982,13 @@ extern mempool_t *cifs_mid_poolp;
|
||||
|
||||
/* Operations for different SMB versions */
|
||||
#define SMB1_VERSION_STRING "1.0"
|
||||
#define SMB20_VERSION_STRING "2.0"
|
||||
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
|
||||
extern struct smb_version_operations smb1_operations;
|
||||
extern struct smb_version_values smb1_values;
|
||||
#define SMB20_VERSION_STRING "2.0"
|
||||
extern struct smb_version_operations smb20_operations;
|
||||
extern struct smb_version_values smb20_values;
|
||||
#endif /* CIFS_ALLOW_INSECURE_LEGACY */
|
||||
#define SMB21_VERSION_STRING "2.1"
|
||||
extern struct smb_version_operations smb21_operations;
|
||||
extern struct smb_version_values smb21_values;
|
||||
|
||||
@@ -230,6 +230,8 @@ extern unsigned int setup_special_user_owner_ACE(struct cifs_ace *pace);
|
||||
extern void dequeue_mid(struct mid_q_entry *mid, bool malformed);
|
||||
extern int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf,
|
||||
unsigned int to_read);
|
||||
extern ssize_t cifs_discard_from_socket(struct TCP_Server_Info *server,
|
||||
size_t to_read);
|
||||
extern int cifs_read_page_from_socket(struct TCP_Server_Info *server,
|
||||
struct page *page,
|
||||
unsigned int page_offset,
|
||||
|
||||
@@ -1451,9 +1451,9 @@ cifs_discard_remaining_data(struct TCP_Server_Info *server)
|
||||
while (remaining > 0) {
|
||||
int length;
|
||||
|
||||
length = cifs_read_from_socket(server, server->bigbuf,
|
||||
min_t(unsigned int, remaining,
|
||||
CIFSMaxBufSize + MAX_HEADER_SIZE(server)));
|
||||
length = cifs_discard_from_socket(server,
|
||||
min_t(size_t, remaining,
|
||||
CIFSMaxBufSize + MAX_HEADER_SIZE(server)));
|
||||
if (length < 0)
|
||||
return length;
|
||||
server->total_read += length;
|
||||
|
||||
@@ -695,9 +695,6 @@ cifs_readv_from_socket(struct TCP_Server_Info *server, struct msghdr *smb_msg)
|
||||
int length = 0;
|
||||
int total_read;
|
||||
|
||||
smb_msg->msg_control = NULL;
|
||||
smb_msg->msg_controllen = 0;
|
||||
|
||||
for (total_read = 0; msg_data_left(smb_msg); total_read += length) {
|
||||
try_to_freeze();
|
||||
|
||||
@@ -748,18 +745,33 @@ int
|
||||
cifs_read_from_socket(struct TCP_Server_Info *server, char *buf,
|
||||
unsigned int to_read)
|
||||
{
|
||||
struct msghdr smb_msg;
|
||||
struct msghdr smb_msg = {};
|
||||
struct kvec iov = {.iov_base = buf, .iov_len = to_read};
|
||||
iov_iter_kvec(&smb_msg.msg_iter, READ, &iov, 1, to_read);
|
||||
|
||||
return cifs_readv_from_socket(server, &smb_msg);
|
||||
}
|
||||
|
||||
ssize_t
|
||||
cifs_discard_from_socket(struct TCP_Server_Info *server, size_t to_read)
|
||||
{
|
||||
struct msghdr smb_msg = {};
|
||||
|
||||
/*
|
||||
* iov_iter_discard already sets smb_msg.type and count and iov_offset
|
||||
* and cifs_readv_from_socket sets msg_control and msg_controllen
|
||||
* so little to initialize in struct msghdr
|
||||
*/
|
||||
iov_iter_discard(&smb_msg.msg_iter, READ, to_read);
|
||||
|
||||
return cifs_readv_from_socket(server, &smb_msg);
|
||||
}
|
||||
|
||||
int
|
||||
cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page,
|
||||
unsigned int page_offset, unsigned int to_read)
|
||||
{
|
||||
struct msghdr smb_msg;
|
||||
struct msghdr smb_msg = {};
|
||||
struct bio_vec bv = {
|
||||
.bv_page = page, .bv_len = to_read, .bv_offset = page_offset};
|
||||
iov_iter_bvec(&smb_msg.msg_iter, READ, &bv, 1, to_read);
|
||||
|
||||
@@ -1735,11 +1735,13 @@ int cifs_flock(struct file *file, int cmd, struct file_lock *fl)
|
||||
struct cifsFileInfo *cfile;
|
||||
__u32 type;
|
||||
|
||||
rc = -EACCES;
|
||||
xid = get_xid();
|
||||
|
||||
if (!(fl->fl_flags & FL_FLOCK))
|
||||
return -ENOLCK;
|
||||
if (!(fl->fl_flags & FL_FLOCK)) {
|
||||
rc = -ENOLCK;
|
||||
free_xid(xid);
|
||||
return rc;
|
||||
}
|
||||
|
||||
cfile = (struct cifsFileInfo *)file->private_data;
|
||||
tcon = tlink_tcon(cfile->tlink);
|
||||
@@ -1758,8 +1760,9 @@ int cifs_flock(struct file *file, int cmd, struct file_lock *fl)
|
||||
* if no lock or unlock then nothing to do since we do not
|
||||
* know what it is
|
||||
*/
|
||||
rc = -EOPNOTSUPP;
|
||||
free_xid(xid);
|
||||
return -EOPNOTSUPP;
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = cifs_setlk(file, fl, type, wait_flag, posix_lck, lock, unlock,
|
||||
@@ -3244,6 +3247,9 @@ static ssize_t __cifs_writev(
|
||||
|
||||
ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from)
|
||||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
|
||||
cifs_revalidate_mapping(file->f_inode);
|
||||
return __cifs_writev(iocb, from, true);
|
||||
}
|
||||
|
||||
@@ -3933,6 +3939,15 @@ static ssize_t __cifs_readv(
|
||||
len = ctx->len;
|
||||
}
|
||||
|
||||
if (direct) {
|
||||
rc = filemap_write_and_wait_range(file->f_inode->i_mapping,
|
||||
offset, offset + len - 1);
|
||||
if (rc) {
|
||||
kref_put(&ctx->refcount, cifs_aio_ctx_release);
|
||||
return -EAGAIN;
|
||||
}
|
||||
}
|
||||
|
||||
/* grab a lock here due to read response handlers can access ctx */
|
||||
mutex_lock(&ctx->aio_mutex);
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
|
||||
rc = put_user(ExtAttrBits &
|
||||
FS_FL_USER_VISIBLE,
|
||||
(int __user *)arg);
|
||||
if (rc != EOPNOTSUPP)
|
||||
if (rc != -EOPNOTSUPP)
|
||||
break;
|
||||
}
|
||||
#endif /* CONFIG_CIFS_POSIX */
|
||||
@@ -222,7 +222,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
|
||||
* pSMBFile->fid.netfid,
|
||||
* extAttrBits,
|
||||
* &ExtAttrMask);
|
||||
* if (rc != EOPNOTSUPP)
|
||||
* if (rc != -EOPNOTSUPP)
|
||||
* break;
|
||||
*/
|
||||
|
||||
|
||||
@@ -97,6 +97,9 @@ parse_mf_symlink(const u8 *buf, unsigned int buf_len, unsigned int *_link_len,
|
||||
if (rc != 1)
|
||||
return -EINVAL;
|
||||
|
||||
if (link_len > CIFS_MF_SYMLINK_LINK_MAXLEN)
|
||||
return -EINVAL;
|
||||
|
||||
rc = symlink_hash(link_len, link_str, md5_hash);
|
||||
if (rc) {
|
||||
cifs_dbg(FYI, "%s: MD5 hash failure: %d\n", __func__, rc);
|
||||
|
||||
@@ -1053,18 +1053,23 @@ static struct super_block *__cifs_get_super(void (*f)(struct super_block *, void
|
||||
.data = data,
|
||||
.sb = NULL,
|
||||
};
|
||||
struct file_system_type **fs_type = (struct file_system_type *[]) {
|
||||
&cifs_fs_type, &smb3_fs_type, NULL,
|
||||
};
|
||||
|
||||
iterate_supers_type(&cifs_fs_type, f, &sd);
|
||||
|
||||
if (!sd.sb)
|
||||
return ERR_PTR(-EINVAL);
|
||||
/*
|
||||
* Grab an active reference in order to prevent automounts (DFS links)
|
||||
* of expiring and then freeing up our cifs superblock pointer while
|
||||
* we're doing failover.
|
||||
*/
|
||||
cifs_sb_active(sd.sb);
|
||||
return sd.sb;
|
||||
for (; *fs_type; fs_type++) {
|
||||
iterate_supers_type(*fs_type, f, &sd);
|
||||
if (sd.sb) {
|
||||
/*
|
||||
* Grab an active reference in order to prevent automounts (DFS links)
|
||||
* of expiring and then freeing up our cifs superblock pointer while
|
||||
* we're doing failover.
|
||||
*/
|
||||
cifs_sb_active(sd.sb);
|
||||
return sd.sb;
|
||||
}
|
||||
}
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
static void __cifs_put_super(struct super_block *sb)
|
||||
|
||||
@@ -306,6 +306,7 @@ out:
|
||||
cifs_put_tcp_session(chan->server, 0);
|
||||
unload_nls(vol.local_nls);
|
||||
|
||||
free_xid(xid);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,6 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms,
|
||||
nr_ioctl_req.Reserved = 0;
|
||||
rc = SMB2_ioctl(xid, oparms->tcon, fid->persistent_fid,
|
||||
fid->volatile_fid, FSCTL_LMR_REQUEST_RESILIENCY,
|
||||
true /* is_fsctl */,
|
||||
(char *)&nr_ioctl_req, sizeof(nr_ioctl_req),
|
||||
CIFSMaxBufSize, NULL, NULL /* no return info */);
|
||||
if (rc == -EOPNOTSUPP) {
|
||||
|
||||
@@ -371,8 +371,6 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
num_rqst++;
|
||||
|
||||
if (cfile) {
|
||||
cifsFileInfo_put(cfile);
|
||||
cfile = NULL;
|
||||
rc = compound_send_recv(xid, ses, server,
|
||||
flags, num_rqst - 2,
|
||||
&rqst[1], &resp_buftype[1],
|
||||
|
||||
@@ -587,7 +587,7 @@ SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon)
|
||||
struct cifs_ses *ses = tcon->ses;
|
||||
|
||||
rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,
|
||||
FSCTL_QUERY_NETWORK_INTERFACE_INFO, true /* is_fsctl */,
|
||||
FSCTL_QUERY_NETWORK_INTERFACE_INFO,
|
||||
NULL /* no data input */, 0 /* no data input */,
|
||||
CIFSMaxBufSize, (char **)&out_buf, &ret_data_len);
|
||||
if (rc == -EOPNOTSUPP) {
|
||||
@@ -1000,9 +1000,7 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size,
|
||||
size_t name_len, value_len, user_name_len;
|
||||
|
||||
while (src_size > 0) {
|
||||
name = &src->ea_data[0];
|
||||
name_len = (size_t)src->ea_name_length;
|
||||
value = &src->ea_data[src->ea_name_length + 1];
|
||||
value_len = (size_t)le16_to_cpu(src->ea_value_length);
|
||||
|
||||
if (name_len == 0)
|
||||
@@ -1014,6 +1012,9 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size,
|
||||
goto out;
|
||||
}
|
||||
|
||||
name = &src->ea_data[0];
|
||||
value = &src->ea_data[src->ea_name_length + 1];
|
||||
|
||||
if (ea_name) {
|
||||
if (ea_name_len == name_len &&
|
||||
memcmp(ea_name, name, name_len) == 0) {
|
||||
@@ -1255,6 +1256,8 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
COMPOUND_FID, current->tgid,
|
||||
FILE_FULL_EA_INFORMATION,
|
||||
SMB2_O_INFO_FILE, 0, data, size);
|
||||
if (rc)
|
||||
goto sea_exit;
|
||||
smb2_set_next_command(tcon, &rqst[1]);
|
||||
smb2_set_related(&rqst[1]);
|
||||
|
||||
@@ -1265,6 +1268,8 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
rqst[2].rq_nvec = 1;
|
||||
rc = SMB2_close_init(tcon, server,
|
||||
&rqst[2], COMPOUND_FID, COMPOUND_FID, false);
|
||||
if (rc)
|
||||
goto sea_exit;
|
||||
smb2_set_related(&rqst[2]);
|
||||
|
||||
rc = compound_send_recv(xid, ses, server,
|
||||
@@ -1469,9 +1474,8 @@ SMB2_request_res_key(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
struct resume_key_req *res_key;
|
||||
|
||||
rc = SMB2_ioctl(xid, tcon, persistent_fid, volatile_fid,
|
||||
FSCTL_SRV_REQUEST_RESUME_KEY, true /* is_fsctl */,
|
||||
NULL, 0 /* no input */, CIFSMaxBufSize,
|
||||
(char **)&res_key, &ret_data_len);
|
||||
FSCTL_SRV_REQUEST_RESUME_KEY, NULL, 0 /* no input */,
|
||||
CIFSMaxBufSize, (char **)&res_key, &ret_data_len);
|
||||
|
||||
if (rc) {
|
||||
cifs_tcon_dbg(VFS, "refcpy ioctl error %d getting resume key\n", rc);
|
||||
@@ -1610,7 +1614,7 @@ smb2_ioctl_query_info(const unsigned int xid,
|
||||
rqst[1].rq_nvec = SMB2_IOCTL_IOV_SIZE;
|
||||
|
||||
rc = SMB2_ioctl_init(tcon, server, &rqst[1], COMPOUND_FID, COMPOUND_FID,
|
||||
qi.info_type, true, buffer, qi.output_buffer_length,
|
||||
qi.info_type, buffer, qi.output_buffer_length,
|
||||
CIFSMaxBufSize - MAX_SMB2_CREATE_RESPONSE_SIZE -
|
||||
MAX_SMB2_CLOSE_RESPONSE_SIZE);
|
||||
free_req1_func = SMB2_ioctl_free;
|
||||
@@ -1744,9 +1748,17 @@ smb2_copychunk_range(const unsigned int xid,
|
||||
int chunks_copied = 0;
|
||||
bool chunk_sizes_updated = false;
|
||||
ssize_t bytes_written, total_bytes_written = 0;
|
||||
struct inode *inode;
|
||||
|
||||
pcchunk = kmalloc(sizeof(struct copychunk_ioctl), GFP_KERNEL);
|
||||
|
||||
/*
|
||||
* We need to flush all unwritten data before we can send the
|
||||
* copychunk ioctl to the server.
|
||||
*/
|
||||
inode = d_inode(trgtfile->dentry);
|
||||
filemap_write_and_wait(inode->i_mapping);
|
||||
|
||||
if (pcchunk == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -1778,9 +1790,8 @@ smb2_copychunk_range(const unsigned int xid,
|
||||
retbuf = NULL;
|
||||
rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid,
|
||||
trgtfile->fid.volatile_fid, FSCTL_SRV_COPYCHUNK_WRITE,
|
||||
true /* is_fsctl */, (char *)pcchunk,
|
||||
sizeof(struct copychunk_ioctl), CIFSMaxBufSize,
|
||||
(char **)&retbuf, &ret_data_len);
|
||||
(char *)pcchunk, sizeof(struct copychunk_ioctl),
|
||||
CIFSMaxBufSize, (char **)&retbuf, &ret_data_len);
|
||||
if (rc == 0) {
|
||||
if (ret_data_len !=
|
||||
sizeof(struct copychunk_ioctl_rsp)) {
|
||||
@@ -1940,7 +1951,6 @@ static bool smb2_set_sparse(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
|
||||
rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
|
||||
cfile->fid.volatile_fid, FSCTL_SET_SPARSE,
|
||||
true /* is_fctl */,
|
||||
&setsparse, 1, CIFSMaxBufSize, NULL, NULL);
|
||||
if (rc) {
|
||||
tcon->broken_sparse_sup = true;
|
||||
@@ -2023,7 +2033,6 @@ smb2_duplicate_extents(const unsigned int xid,
|
||||
rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid,
|
||||
trgtfile->fid.volatile_fid,
|
||||
FSCTL_DUPLICATE_EXTENTS_TO_FILE,
|
||||
true /* is_fsctl */,
|
||||
(char *)&dup_ext_buf,
|
||||
sizeof(struct duplicate_extents_to_file),
|
||||
CIFSMaxBufSize, NULL,
|
||||
@@ -2058,7 +2067,6 @@ smb3_set_integrity(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
return SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
|
||||
cfile->fid.volatile_fid,
|
||||
FSCTL_SET_INTEGRITY_INFORMATION,
|
||||
true /* is_fsctl */,
|
||||
(char *)&integr_info,
|
||||
sizeof(struct fsctl_set_integrity_information_req),
|
||||
CIFSMaxBufSize, NULL,
|
||||
@@ -2111,7 +2119,6 @@ smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
|
||||
cfile->fid.volatile_fid,
|
||||
FSCTL_SRV_ENUMERATE_SNAPSHOTS,
|
||||
true /* is_fsctl */,
|
||||
NULL, 0 /* no input data */, max_response_size,
|
||||
(char **)&retbuf,
|
||||
&ret_data_len);
|
||||
@@ -2753,7 +2760,6 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
|
||||
do {
|
||||
rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,
|
||||
FSCTL_DFS_GET_REFERRALS,
|
||||
true /* is_fsctl */,
|
||||
(char *)dfs_req, dfs_req_size, CIFSMaxBufSize,
|
||||
(char **)&dfs_rsp, &dfs_rsp_size);
|
||||
} while (rc == -EAGAIN);
|
||||
@@ -2955,8 +2961,7 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
|
||||
rc = SMB2_ioctl_init(tcon, server,
|
||||
&rqst[1], fid.persistent_fid,
|
||||
fid.volatile_fid, FSCTL_GET_REPARSE_POINT,
|
||||
true /* is_fctl */, NULL, 0,
|
||||
fid.volatile_fid, FSCTL_GET_REPARSE_POINT, NULL, 0,
|
||||
CIFSMaxBufSize -
|
||||
MAX_SMB2_CREATE_RESPONSE_SIZE -
|
||||
MAX_SMB2_CLOSE_RESPONSE_SIZE);
|
||||
@@ -3136,8 +3141,7 @@ smb2_query_reparse_tag(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
|
||||
rc = SMB2_ioctl_init(tcon, server,
|
||||
&rqst[1], COMPOUND_FID,
|
||||
COMPOUND_FID, FSCTL_GET_REPARSE_POINT,
|
||||
true /* is_fctl */, NULL, 0,
|
||||
COMPOUND_FID, FSCTL_GET_REPARSE_POINT, NULL, 0,
|
||||
CIFSMaxBufSize -
|
||||
MAX_SMB2_CREATE_RESPONSE_SIZE -
|
||||
MAX_SMB2_CLOSE_RESPONSE_SIZE);
|
||||
@@ -3400,7 +3404,7 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
|
||||
fsctl_buf.BeyondFinalZero = cpu_to_le64(offset + len);
|
||||
|
||||
rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
|
||||
cfile->fid.volatile_fid, FSCTL_SET_ZERO_DATA, true,
|
||||
cfile->fid.volatile_fid, FSCTL_SET_ZERO_DATA,
|
||||
(char *)&fsctl_buf,
|
||||
sizeof(struct file_zero_data_information),
|
||||
0, NULL, NULL);
|
||||
@@ -3430,7 +3434,7 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
|
||||
static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon,
|
||||
loff_t offset, loff_t len)
|
||||
{
|
||||
struct inode *inode;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct cifsFileInfo *cfile = file->private_data;
|
||||
struct file_zero_data_information fsctl_buf;
|
||||
long rc;
|
||||
@@ -3439,14 +3443,12 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon,
|
||||
|
||||
xid = get_xid();
|
||||
|
||||
inode = d_inode(cfile->dentry);
|
||||
|
||||
inode_lock(inode);
|
||||
/* Need to make file sparse, if not already, before freeing range. */
|
||||
/* Consider adding equivalent for compressed since it could also work */
|
||||
if (!smb2_set_sparse(xid, tcon, cfile, inode, set_sparse)) {
|
||||
rc = -EOPNOTSUPP;
|
||||
free_xid(xid);
|
||||
return rc;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3462,9 +3464,11 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon,
|
||||
|
||||
rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
|
||||
cfile->fid.volatile_fid, FSCTL_SET_ZERO_DATA,
|
||||
true /* is_fctl */, (char *)&fsctl_buf,
|
||||
(char *)&fsctl_buf,
|
||||
sizeof(struct file_zero_data_information),
|
||||
CIFSMaxBufSize, NULL, NULL);
|
||||
out:
|
||||
inode_unlock(inode);
|
||||
free_xid(xid);
|
||||
return rc;
|
||||
}
|
||||
@@ -3521,7 +3525,7 @@ static int smb3_simple_fallocate_range(unsigned int xid,
|
||||
in_data.length = cpu_to_le64(len);
|
||||
rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
|
||||
cfile->fid.volatile_fid,
|
||||
FSCTL_QUERY_ALLOCATED_RANGES, true,
|
||||
FSCTL_QUERY_ALLOCATED_RANGES,
|
||||
(char *)&in_data, sizeof(in_data),
|
||||
1024 * sizeof(struct file_allocated_range_buffer),
|
||||
(char **)&out_data, &out_data_len);
|
||||
@@ -3624,7 +3628,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) == 0)
|
||||
if (cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE)
|
||||
smb2_set_sparse(xid, tcon, cfile, inode, false);
|
||||
|
||||
eof = cpu_to_le64(off + len);
|
||||
@@ -3762,7 +3766,7 @@ static loff_t smb3_llseek(struct file *file, struct cifs_tcon *tcon, loff_t offs
|
||||
|
||||
rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
|
||||
cfile->fid.volatile_fid,
|
||||
FSCTL_QUERY_ALLOCATED_RANGES, true,
|
||||
FSCTL_QUERY_ALLOCATED_RANGES,
|
||||
(char *)&in_data, sizeof(in_data),
|
||||
sizeof(struct file_allocated_range_buffer),
|
||||
(char **)&out_data, &out_data_len);
|
||||
@@ -3822,7 +3826,7 @@ static int smb3_fiemap(struct cifs_tcon *tcon,
|
||||
|
||||
rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
|
||||
cfile->fid.volatile_fid,
|
||||
FSCTL_QUERY_ALLOCATED_RANGES, true,
|
||||
FSCTL_QUERY_ALLOCATED_RANGES,
|
||||
(char *)&in_data, sizeof(in_data),
|
||||
1024 * sizeof(struct file_allocated_range_buffer),
|
||||
(char **)&out_data, &out_data_len);
|
||||
@@ -4024,11 +4028,13 @@ smb3_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
|
||||
static bool
|
||||
smb2_is_read_op(__u32 oplock)
|
||||
{
|
||||
return oplock == SMB2_OPLOCK_LEVEL_II;
|
||||
}
|
||||
#endif /* CIFS_ALLOW_INSECURE_LEGACY */
|
||||
|
||||
static bool
|
||||
smb21_is_read_op(__u32 oplock)
|
||||
@@ -5114,7 +5120,7 @@ out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
|
||||
struct smb_version_operations smb20_operations = {
|
||||
.compare_fids = smb2_compare_fids,
|
||||
.setup_request = smb2_setup_request,
|
||||
@@ -5212,6 +5218,7 @@ struct smb_version_operations smb20_operations = {
|
||||
.llseek = smb3_llseek,
|
||||
.is_status_io_timeout = smb2_is_status_io_timeout,
|
||||
};
|
||||
#endif /* CIFS_ALLOW_INSECURE_LEGACY */
|
||||
|
||||
struct smb_version_operations smb21_operations = {
|
||||
.compare_fids = smb2_compare_fids,
|
||||
@@ -5540,6 +5547,7 @@ struct smb_version_operations smb311_operations = {
|
||||
.is_status_io_timeout = smb2_is_status_io_timeout,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
|
||||
struct smb_version_values smb20_values = {
|
||||
.version_string = SMB20_VERSION_STRING,
|
||||
.protocol_id = SMB20_PROT_ID,
|
||||
@@ -5560,6 +5568,7 @@ struct smb_version_values smb20_values = {
|
||||
.signing_required = SMB2_NEGOTIATE_SIGNING_REQUIRED,
|
||||
.create_lease_size = sizeof(struct create_lease),
|
||||
};
|
||||
#endif /* ALLOW_INSECURE_LEGACY */
|
||||
|
||||
struct smb_version_values smb21_values = {
|
||||
.version_string = SMB21_VERSION_STRING,
|
||||
|
||||
@@ -281,6 +281,9 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
|
||||
ses->binding_chan = NULL;
|
||||
mutex_unlock(&tcon->ses->session_mutex);
|
||||
goto failed;
|
||||
} else if (rc) {
|
||||
mutex_unlock(&ses->session_mutex);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
/*
|
||||
@@ -1072,13 +1075,13 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon)
|
||||
pneg_inbuf->Dialects[0] =
|
||||
cpu_to_le16(server->vals->protocol_id);
|
||||
pneg_inbuf->DialectCount = cpu_to_le16(1);
|
||||
/* structure is big enough for 3 dialects, sending only 1 */
|
||||
/* structure is big enough for 4 dialects, sending only 1 */
|
||||
inbuflen = sizeof(*pneg_inbuf) -
|
||||
sizeof(pneg_inbuf->Dialects[0]) * 2;
|
||||
sizeof(pneg_inbuf->Dialects[0]) * 3;
|
||||
}
|
||||
|
||||
rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,
|
||||
FSCTL_VALIDATE_NEGOTIATE_INFO, true /* is_fsctl */,
|
||||
FSCTL_VALIDATE_NEGOTIATE_INFO,
|
||||
(char *)pneg_inbuf, inbuflen, CIFSMaxBufSize,
|
||||
(char **)&pneg_rsp, &rsplen);
|
||||
if (rc == -EOPNOTSUPP) {
|
||||
@@ -2291,7 +2294,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len)
|
||||
unsigned int acelen, acl_size, ace_count;
|
||||
unsigned int owner_offset = 0;
|
||||
unsigned int group_offset = 0;
|
||||
struct smb3_acl acl;
|
||||
struct smb3_acl acl = {};
|
||||
|
||||
*len = roundup(sizeof(struct crt_sd_ctxt) + (sizeof(struct cifs_ace) * 4), 8);
|
||||
|
||||
@@ -2364,6 +2367,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len)
|
||||
acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */
|
||||
acl.AclSize = cpu_to_le16(acl_size);
|
||||
acl.AceCount = cpu_to_le16(ace_count);
|
||||
/* acl.Sbz1 and Sbz2 MBZ so are not set here, but initialized above */
|
||||
memcpy(aclptr, &acl, sizeof(struct smb3_acl));
|
||||
|
||||
buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd);
|
||||
@@ -2919,7 +2923,7 @@ int
|
||||
SMB2_ioctl_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
|
||||
struct smb_rqst *rqst,
|
||||
u64 persistent_fid, u64 volatile_fid, u32 opcode,
|
||||
bool is_fsctl, char *in_data, u32 indatalen,
|
||||
char *in_data, u32 indatalen,
|
||||
__u32 max_response_size)
|
||||
{
|
||||
struct smb2_ioctl_req *req;
|
||||
@@ -2994,10 +2998,8 @@ SMB2_ioctl_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
|
||||
req->sync_hdr.CreditCharge =
|
||||
cpu_to_le16(DIV_ROUND_UP(max(indatalen, max_response_size),
|
||||
SMB2_MAX_BUFFER_SIZE));
|
||||
if (is_fsctl)
|
||||
req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL);
|
||||
else
|
||||
req->Flags = 0;
|
||||
/* always an FSCTL (for now) */
|
||||
req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL);
|
||||
|
||||
/* validate negotiate request must be signed - see MS-SMB2 3.2.5.5 */
|
||||
if (opcode == FSCTL_VALIDATE_NEGOTIATE_INFO)
|
||||
@@ -3024,9 +3026,9 @@ SMB2_ioctl_free(struct smb_rqst *rqst)
|
||||
*/
|
||||
int
|
||||
SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
|
||||
u64 volatile_fid, u32 opcode, bool is_fsctl,
|
||||
char *in_data, u32 indatalen, u32 max_out_data_len,
|
||||
char **out_data, u32 *plen /* returned data len */)
|
||||
u64 volatile_fid, u32 opcode, char *in_data, u32 indatalen,
|
||||
u32 max_out_data_len, char **out_data,
|
||||
u32 *plen /* returned data len */)
|
||||
{
|
||||
struct smb_rqst rqst;
|
||||
struct smb2_ioctl_rsp *rsp = NULL;
|
||||
@@ -3068,7 +3070,7 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
|
||||
|
||||
rc = SMB2_ioctl_init(tcon, server,
|
||||
&rqst, persistent_fid, volatile_fid, opcode,
|
||||
is_fsctl, in_data, indatalen, max_out_data_len);
|
||||
in_data, indatalen, max_out_data_len);
|
||||
if (rc)
|
||||
goto ioctl_exit;
|
||||
|
||||
@@ -3150,7 +3152,7 @@ SMB2_set_compression(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
cpu_to_le16(COMPRESSION_FORMAT_DEFAULT);
|
||||
|
||||
rc = SMB2_ioctl(xid, tcon, persistent_fid, volatile_fid,
|
||||
FSCTL_SET_COMPRESSION, true /* is_fsctl */,
|
||||
FSCTL_SET_COMPRESSION,
|
||||
(char *)&fsctl_input /* data input */,
|
||||
2 /* in data len */, CIFSMaxBufSize /* max out data */,
|
||||
&ret_data /* out data */, NULL);
|
||||
|
||||
@@ -155,13 +155,13 @@ extern int SMB2_open_init(struct cifs_tcon *tcon,
|
||||
extern void SMB2_open_free(struct smb_rqst *rqst);
|
||||
extern int SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
u64 persistent_fid, u64 volatile_fid, u32 opcode,
|
||||
bool is_fsctl, char *in_data, u32 indatalen, u32 maxoutlen,
|
||||
char *in_data, u32 indatalen, u32 maxoutlen,
|
||||
char **out_data, u32 *plen /* returned data len */);
|
||||
extern int SMB2_ioctl_init(struct cifs_tcon *tcon,
|
||||
struct TCP_Server_Info *server,
|
||||
struct smb_rqst *rqst,
|
||||
u64 persistent_fid, u64 volatile_fid, u32 opcode,
|
||||
bool is_fsctl, char *in_data, u32 indatalen,
|
||||
char *in_data, u32 indatalen,
|
||||
__u32 max_response_size);
|
||||
extern void SMB2_ioctl_free(struct smb_rqst *rqst);
|
||||
extern int SMB2_change_notify(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
|
||||
@@ -209,10 +209,6 @@ smb_send_kvec(struct TCP_Server_Info *server, struct msghdr *smb_msg,
|
||||
|
||||
*sent = 0;
|
||||
|
||||
smb_msg->msg_name = (struct sockaddr *) &server->dstaddr;
|
||||
smb_msg->msg_namelen = sizeof(struct sockaddr);
|
||||
smb_msg->msg_control = NULL;
|
||||
smb_msg->msg_controllen = 0;
|
||||
if (server->noblocksnd)
|
||||
smb_msg->msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL;
|
||||
else
|
||||
@@ -324,7 +320,7 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
|
||||
sigset_t mask, oldmask;
|
||||
size_t total_len = 0, sent, size;
|
||||
struct socket *ssocket = server->ssocket;
|
||||
struct msghdr smb_msg;
|
||||
struct msghdr smb_msg = {};
|
||||
__be32 rfc1002_marker;
|
||||
|
||||
if (cifs_rdma_enabled(server)) {
|
||||
|
||||
Reference in New Issue
Block a user