@@ -6116,7 +6116,6 @@ static noinline int smb2_read_pipe(struct ksmbd_work *work)
61166116static int smb2_set_remote_key_for_rdma (struct ksmbd_work * work ,
61176117 struct smb2_buffer_desc_v1 * desc ,
61186118 __le32 Channel ,
6119- __le16 ChannelInfoOffset ,
61206119 __le16 ChannelInfoLength )
61216120{
61226121 unsigned int i , ch_count ;
@@ -6142,22 +6141,21 @@ static int smb2_set_remote_key_for_rdma(struct ksmbd_work *work,
61426141
61436142 work -> need_invalidate_rkey =
61446143 (Channel == SMB2_CHANNEL_RDMA_V1_INVALIDATE );
6145- work -> remote_key = le32_to_cpu (desc -> token );
6144+ if (Channel == SMB2_CHANNEL_RDMA_V1_INVALIDATE )
6145+ work -> remote_key = le32_to_cpu (desc -> token );
61466146 return 0 ;
61476147}
61486148
61496149static ssize_t smb2_read_rdma_channel (struct ksmbd_work * work ,
61506150 struct smb2_read_req * req , void * data_buf ,
61516151 size_t length )
61526152{
6153- struct smb2_buffer_desc_v1 * desc =
6154- (struct smb2_buffer_desc_v1 * )& req -> Buffer [0 ];
61556153 int err ;
61566154
61576155 err = ksmbd_conn_rdma_write (work -> conn , data_buf , length ,
6158- le32_to_cpu ( desc -> token ),
6159- le64_to_cpu ( desc -> offset ),
6160- le32_to_cpu ( desc -> length ));
6156+ ( struct smb2_buffer_desc_v1 * )
6157+ (( char * ) req + le16_to_cpu ( req -> ReadChannelInfoOffset ) ),
6158+ le16_to_cpu ( req -> ReadChannelInfoLength ));
61616159 if (err )
61626160 return err ;
61636161
@@ -6201,7 +6199,6 @@ int smb2_read(struct ksmbd_work *work)
62016199 (struct smb2_buffer_desc_v1 * )
62026200 ((char * )req + ch_offset ),
62036201 req -> Channel ,
6204- req -> ReadChannelInfoOffset ,
62056202 req -> ReadChannelInfoLength );
62066203 if (err )
62076204 goto out ;
@@ -6379,21 +6376,18 @@ static ssize_t smb2_write_rdma_channel(struct ksmbd_work *work,
63796376 struct ksmbd_file * fp ,
63806377 loff_t offset , size_t length , bool sync )
63816378{
6382- struct smb2_buffer_desc_v1 * desc ;
63836379 char * data_buf ;
63846380 int ret ;
63856381 ssize_t nbytes ;
63866382
6387- desc = (struct smb2_buffer_desc_v1 * )& req -> Buffer [0 ];
6388-
63896383 data_buf = kvmalloc (length , GFP_KERNEL | __GFP_ZERO );
63906384 if (!data_buf )
63916385 return - ENOMEM ;
63926386
63936387 ret = ksmbd_conn_rdma_read (work -> conn , data_buf , length ,
6394- le32_to_cpu ( desc -> token ),
6395- le64_to_cpu ( desc -> offset ),
6396- le32_to_cpu ( desc -> length ));
6388+ ( struct smb2_buffer_desc_v1 * )
6389+ (( char * ) req + le16_to_cpu ( req -> WriteChannelInfoOffset ) ),
6390+ le16_to_cpu ( req -> WriteChannelInfoLength ));
63976391 if (ret < 0 ) {
63986392 kvfree (data_buf );
63996393 return ret ;
@@ -6445,7 +6439,6 @@ int smb2_write(struct ksmbd_work *work)
64456439 (struct smb2_buffer_desc_v1 * )
64466440 ((char * )req + ch_offset ),
64476441 req -> Channel ,
6448- req -> WriteChannelInfoOffset ,
64496442 req -> WriteChannelInfoLength );
64506443 if (err )
64516444 goto out ;
0 commit comments