All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next v2] cifs: convert list_for_each to entry variant in smb2misc.c
@ 2021-06-18  4:02 Baokun Li
  2021-06-18  4:16 ` Steve French
  0 siblings, 1 reply; 3+ messages in thread
From: Baokun Li @ 2021-06-18  4:02 UTC (permalink / raw)
  To: libaokun1, Steve French, Dan Carpenter
  Cc: linux-kernel, linux-cifs, samba-technical, kernel-janitors, Hulk Robot

convert list_for_each() to list_for_each_entry() where
applicable.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
V1->V2:
	Convert the missing list_for_each to entry

 fs/cifs/smb2misc.c | 33 ++++++++-------------------------
 1 file changed, 8 insertions(+), 25 deletions(-)

diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 06d555d4da9a..aba048153f79 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -164,12 +164,10 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *srvr)
 		struct smb2_transform_hdr *thdr =
 			(struct smb2_transform_hdr *)buf;
 		struct cifs_ses *ses = NULL;
-		struct list_head *tmp;
 
 		/* decrypt frame now that it is completely read in */
 		spin_lock(&cifs_tcp_ses_lock);
-		list_for_each(tmp, &srvr->smb_ses_list) {
-			ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
+		list_for_each_entry(ses, &srvr->smb_ses_list, smb_ses_list) {
 			if (ses->Suid == thdr->SessionId)
 				break;
 
@@ -548,7 +546,6 @@ static bool
 smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp)
 {
 	__u8 lease_state;
-	struct list_head *tmp;
 	struct cifsFileInfo *cfile;
 	struct cifsInodeInfo *cinode;
 	int ack_req = le32_to_cpu(rsp->Flags &
@@ -556,8 +553,7 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp)
 
 	lease_state = le32_to_cpu(rsp->NewLeaseState);
 
-	list_for_each(tmp, &tcon->openFileList) {
-		cfile = list_entry(tmp, struct cifsFileInfo, tlist);
+	list_for_each_entry(cfile, &tcon->openFileList, tlist) {
 		cinode = CIFS_I(d_inode(cfile->dentry));
 
 		if (memcmp(cinode->lease_key, rsp->LeaseKey,
@@ -618,7 +614,6 @@ static bool
 smb2_is_valid_lease_break(char *buffer)
 {
 	struct smb2_lease_break *rsp = (struct smb2_lease_break *)buffer;
-	struct list_head *tmp, *tmp1, *tmp2;
 	struct TCP_Server_Info *server;
 	struct cifs_ses *ses;
 	struct cifs_tcon *tcon;
@@ -628,15 +623,9 @@ smb2_is_valid_lease_break(char *buffer)
 
 	/* look up tcon based on tid & uid */
 	spin_lock(&cifs_tcp_ses_lock);
-	list_for_each(tmp, &cifs_tcp_ses_list) {
-		server = list_entry(tmp, struct TCP_Server_Info, tcp_ses_list);
-
-		list_for_each(tmp1, &server->smb_ses_list) {
-			ses = list_entry(tmp1, struct cifs_ses, smb_ses_list);
-
-			list_for_each(tmp2, &ses->tcon_list) {
-				tcon = list_entry(tmp2, struct cifs_tcon,
-						  tcon_list);
+	list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
+		list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
+			list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
 				spin_lock(&tcon->open_file_lock);
 				cifs_stats_inc(
 				    &tcon->stats.cifs_stats.num_oplock_brks);
@@ -687,7 +676,6 @@ bool
 smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
 {
 	struct smb2_oplock_break *rsp = (struct smb2_oplock_break *)buffer;
-	struct list_head *tmp, *tmp1, *tmp2;
 	struct cifs_ses *ses;
 	struct cifs_tcon *tcon;
 	struct cifsInodeInfo *cinode;
@@ -710,16 +698,11 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
 
 	/* look up tcon based on tid & uid */
 	spin_lock(&cifs_tcp_ses_lock);
-	list_for_each(tmp, &server->smb_ses_list) {
-		ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
-
-		list_for_each(tmp1, &ses->tcon_list) {
-			tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);
+	list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
+		list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
 
 			spin_lock(&tcon->open_file_lock);
-			list_for_each(tmp2, &tcon->openFileList) {
-				cfile = list_entry(tmp2, struct cifsFileInfo,
-						     tlist);
+			list_for_each_entry(cfile, &tcon->openFileList, tlist) {
 				if (rsp->PersistentFid !=
 				    cfile->fid.persistent_fid ||
 				    rsp->VolatileFid !=
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next v2] cifs: convert list_for_each to entry variant in smb2misc.c
  2021-06-18  4:02 [PATCH -next v2] cifs: convert list_for_each to entry variant in smb2misc.c Baokun Li
@ 2021-06-18  4:16 ` Steve French
  0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2021-06-18  4:16 UTC (permalink / raw)
  To: Baokun Li
  Cc: Steve French, Dan Carpenter, LKML, CIFS, samba-technical,
	kernel-janitors, Hulk Robot

tentatively merged into cifs-2.6.git for-next

On Thu, Jun 17, 2021 at 11:02 PM Baokun Li <libaokun1@huawei.com> wrote:
>
> convert list_for_each() to list_for_each_entry() where
> applicable.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Baokun Li <libaokun1@huawei.com>
> ---
> V1->V2:
>         Convert the missing list_for_each to entry
>
>  fs/cifs/smb2misc.c | 33 ++++++++-------------------------
>  1 file changed, 8 insertions(+), 25 deletions(-)
>
> diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
> index 06d555d4da9a..aba048153f79 100644
> --- a/fs/cifs/smb2misc.c
> +++ b/fs/cifs/smb2misc.c
> @@ -164,12 +164,10 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *srvr)
>                 struct smb2_transform_hdr *thdr =
>                         (struct smb2_transform_hdr *)buf;
>                 struct cifs_ses *ses = NULL;
> -               struct list_head *tmp;
>
>                 /* decrypt frame now that it is completely read in */
>                 spin_lock(&cifs_tcp_ses_lock);
> -               list_for_each(tmp, &srvr->smb_ses_list) {
> -                       ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
> +               list_for_each_entry(ses, &srvr->smb_ses_list, smb_ses_list) {
>                         if (ses->Suid == thdr->SessionId)
>                                 break;
>
> @@ -548,7 +546,6 @@ static bool
>  smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp)
>  {
>         __u8 lease_state;
> -       struct list_head *tmp;
>         struct cifsFileInfo *cfile;
>         struct cifsInodeInfo *cinode;
>         int ack_req = le32_to_cpu(rsp->Flags &
> @@ -556,8 +553,7 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp)
>
>         lease_state = le32_to_cpu(rsp->NewLeaseState);
>
> -       list_for_each(tmp, &tcon->openFileList) {
> -               cfile = list_entry(tmp, struct cifsFileInfo, tlist);
> +       list_for_each_entry(cfile, &tcon->openFileList, tlist) {
>                 cinode = CIFS_I(d_inode(cfile->dentry));
>
>                 if (memcmp(cinode->lease_key, rsp->LeaseKey,
> @@ -618,7 +614,6 @@ static bool
>  smb2_is_valid_lease_break(char *buffer)
>  {
>         struct smb2_lease_break *rsp = (struct smb2_lease_break *)buffer;
> -       struct list_head *tmp, *tmp1, *tmp2;
>         struct TCP_Server_Info *server;
>         struct cifs_ses *ses;
>         struct cifs_tcon *tcon;
> @@ -628,15 +623,9 @@ smb2_is_valid_lease_break(char *buffer)
>
>         /* look up tcon based on tid & uid */
>         spin_lock(&cifs_tcp_ses_lock);
> -       list_for_each(tmp, &cifs_tcp_ses_list) {
> -               server = list_entry(tmp, struct TCP_Server_Info, tcp_ses_list);
> -
> -               list_for_each(tmp1, &server->smb_ses_list) {
> -                       ses = list_entry(tmp1, struct cifs_ses, smb_ses_list);
> -
> -                       list_for_each(tmp2, &ses->tcon_list) {
> -                               tcon = list_entry(tmp2, struct cifs_tcon,
> -                                                 tcon_list);
> +       list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
> +               list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
> +                       list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
>                                 spin_lock(&tcon->open_file_lock);
>                                 cifs_stats_inc(
>                                     &tcon->stats.cifs_stats.num_oplock_brks);
> @@ -687,7 +676,6 @@ bool
>  smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
>  {
>         struct smb2_oplock_break *rsp = (struct smb2_oplock_break *)buffer;
> -       struct list_head *tmp, *tmp1, *tmp2;
>         struct cifs_ses *ses;
>         struct cifs_tcon *tcon;
>         struct cifsInodeInfo *cinode;
> @@ -710,16 +698,11 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
>
>         /* look up tcon based on tid & uid */
>         spin_lock(&cifs_tcp_ses_lock);
> -       list_for_each(tmp, &server->smb_ses_list) {
> -               ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
> -
> -               list_for_each(tmp1, &ses->tcon_list) {
> -                       tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);
> +       list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
> +               list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
>
>                         spin_lock(&tcon->open_file_lock);
> -                       list_for_each(tmp2, &tcon->openFileList) {
> -                               cfile = list_entry(tmp2, struct cifsFileInfo,
> -                                                    tlist);
> +                       list_for_each_entry(cfile, &tcon->openFileList, tlist) {
>                                 if (rsp->PersistentFid !=
>                                     cfile->fid.persistent_fid ||
>                                     rsp->VolatileFid !=
> --
> 2.31.1
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next v2] cifs: convert list_for_each to entry variant in smb2misc.c
@ 2021-06-18  6:47 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-06-18  6:47 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 11411 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210618040232.2550645-1-libaokun1@huawei.com>
References: <20210618040232.2550645-1-libaokun1@huawei.com>
TO: Baokun Li <libaokun1@huawei.com>

Hi Baokun,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on next-20210617]

url:    https://github.com/0day-ci/linux/commits/Baokun-Li/cifs-convert-list_for_each-to-entry-variant-in-smb2misc-c/20210618-115515
base:    7d9c6b8147bdd76d7eb2cf6f74f84c6918ae0939
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago
config: x86_64-randconfig-c022-20210618 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> fs/cifs/smb2misc.c:170:2-21: iterator with update on line 174

vim +170 fs/cifs/smb2misc.c

136ff1b4b65edf Steve French    2018-04-08  147  
093b2bdad3221e Pavel Shilovsky 2011-06-08  148  int
98170fb53587a4 Ronnie Sahlberg 2018-05-31  149  smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *srvr)
093b2bdad3221e Pavel Shilovsky 2011-06-08  150  {
1fc6ad2f10ad6f Ronnie Sahlberg 2018-06-01  151  	struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)buf;
98170fb53587a4 Ronnie Sahlberg 2018-05-31  152  	struct smb2_sync_pdu *pdu = (struct smb2_sync_pdu *)shdr;
373512ec5c105e Steve French    2015-12-18  153  	__u64 mid;
093b2bdad3221e Pavel Shilovsky 2011-06-08  154  	__u32 clc_len;  /* calculated length */
093b2bdad3221e Pavel Shilovsky 2011-06-08  155  	int command;
98170fb53587a4 Ronnie Sahlberg 2018-05-31  156  	int pdu_size = sizeof(struct smb2_sync_pdu);
98170fb53587a4 Ronnie Sahlberg 2018-05-31  157  	int hdr_size = sizeof(struct smb2_sync_hdr);
093b2bdad3221e Pavel Shilovsky 2011-06-08  158  
093b2bdad3221e Pavel Shilovsky 2011-06-08  159  	/*
093b2bdad3221e Pavel Shilovsky 2011-06-08  160  	 * Add function to do table lookup of StructureSize by command
093b2bdad3221e Pavel Shilovsky 2011-06-08  161  	 * ie Validate the wct via smb2_struct_sizes table above
093b2bdad3221e Pavel Shilovsky 2011-06-08  162  	 */
31473fc4f9653b Pavel Shilovsky 2016-10-24  163  	if (shdr->ProtocolId == SMB2_TRANSFORM_PROTO_NUM) {
373512ec5c105e Steve French    2015-12-18  164  		struct smb2_transform_hdr *thdr =
373512ec5c105e Steve French    2015-12-18  165  			(struct smb2_transform_hdr *)buf;
373512ec5c105e Steve French    2015-12-18  166  		struct cifs_ses *ses = NULL;
373512ec5c105e Steve French    2015-12-18  167  
373512ec5c105e Steve French    2015-12-18  168  		/* decrypt frame now that it is completely read in */
373512ec5c105e Steve French    2015-12-18  169  		spin_lock(&cifs_tcp_ses_lock);
dc85102637272c Baokun Li       2021-06-18 @170  		list_for_each_entry(ses, &srvr->smb_ses_list, smb_ses_list) {
373512ec5c105e Steve French    2015-12-18  171  			if (ses->Suid == thdr->SessionId)
373512ec5c105e Steve French    2015-12-18  172  				break;
373512ec5c105e Steve French    2015-12-18  173  
373512ec5c105e Steve French    2015-12-18 @174  			ses = NULL;
373512ec5c105e Steve French    2015-12-18  175  		}
373512ec5c105e Steve French    2015-12-18  176  		spin_unlock(&cifs_tcp_ses_lock);
373512ec5c105e Steve French    2015-12-18  177  		if (ses == NULL) {
373512ec5c105e Steve French    2015-12-18  178  			cifs_dbg(VFS, "no decryption - session id not found\n");
373512ec5c105e Steve French    2015-12-18  179  			return 1;
373512ec5c105e Steve French    2015-12-18  180  		}
373512ec5c105e Steve French    2015-12-18  181  	}
373512ec5c105e Steve French    2015-12-18  182  
31473fc4f9653b Pavel Shilovsky 2016-10-24  183  	mid = le64_to_cpu(shdr->MessageId);
98170fb53587a4 Ronnie Sahlberg 2018-05-31  184  	if (len < pdu_size) {
98170fb53587a4 Ronnie Sahlberg 2018-05-31  185  		if ((len >= hdr_size)
31473fc4f9653b Pavel Shilovsky 2016-10-24  186  		    && (shdr->Status != 0)) {
093b2bdad3221e Pavel Shilovsky 2011-06-08  187  			pdu->StructureSize2 = 0;
093b2bdad3221e Pavel Shilovsky 2011-06-08  188  			/*
093b2bdad3221e Pavel Shilovsky 2011-06-08  189  			 * As with SMB/CIFS, on some error cases servers may
093b2bdad3221e Pavel Shilovsky 2011-06-08  190  			 * not return wct properly
093b2bdad3221e Pavel Shilovsky 2011-06-08  191  			 */
093b2bdad3221e Pavel Shilovsky 2011-06-08  192  			return 0;
093b2bdad3221e Pavel Shilovsky 2011-06-08  193  		} else {
f96637be081141 Joe Perches     2013-05-04  194  			cifs_dbg(VFS, "Length less than SMB header size\n");
093b2bdad3221e Pavel Shilovsky 2011-06-08  195  		}
093b2bdad3221e Pavel Shilovsky 2011-06-08  196  		return 1;
093b2bdad3221e Pavel Shilovsky 2011-06-08  197  	}
1fc6ad2f10ad6f Ronnie Sahlberg 2018-06-01  198  	if (len > CIFSMaxBufSize + MAX_SMB2_HDR_SIZE) {
f96637be081141 Joe Perches     2013-05-04  199  		cifs_dbg(VFS, "SMB length greater than maximum, mid=%llu\n",
f96637be081141 Joe Perches     2013-05-04  200  			 mid);
093b2bdad3221e Pavel Shilovsky 2011-06-08  201  		return 1;
093b2bdad3221e Pavel Shilovsky 2011-06-08  202  	}
093b2bdad3221e Pavel Shilovsky 2011-06-08  203  
31473fc4f9653b Pavel Shilovsky 2016-10-24  204  	if (check_smb2_hdr(shdr, mid))
093b2bdad3221e Pavel Shilovsky 2011-06-08  205  		return 1;
093b2bdad3221e Pavel Shilovsky 2011-06-08  206  
31473fc4f9653b Pavel Shilovsky 2016-10-24  207  	if (shdr->StructureSize != SMB2_HEADER_STRUCTURE_SIZE) {
a0a3036b81f1f6 Joe Perches     2020-04-14  208  		cifs_dbg(VFS, "Invalid structure size %u\n",
31473fc4f9653b Pavel Shilovsky 2016-10-24  209  			 le16_to_cpu(shdr->StructureSize));
093b2bdad3221e Pavel Shilovsky 2011-06-08  210  		return 1;
093b2bdad3221e Pavel Shilovsky 2011-06-08  211  	}
093b2bdad3221e Pavel Shilovsky 2011-06-08  212  
31473fc4f9653b Pavel Shilovsky 2016-10-24  213  	command = le16_to_cpu(shdr->Command);
093b2bdad3221e Pavel Shilovsky 2011-06-08  214  	if (command >= NUMBER_OF_SMB2_COMMANDS) {
a0a3036b81f1f6 Joe Perches     2020-04-14  215  		cifs_dbg(VFS, "Invalid SMB2 command %d\n", command);
093b2bdad3221e Pavel Shilovsky 2011-06-08  216  		return 1;
093b2bdad3221e Pavel Shilovsky 2011-06-08  217  	}
093b2bdad3221e Pavel Shilovsky 2011-06-08  218  
093b2bdad3221e Pavel Shilovsky 2011-06-08  219  	if (smb2_rsp_struct_sizes[command] != pdu->StructureSize2) {
31473fc4f9653b Pavel Shilovsky 2016-10-24  220  		if (command != SMB2_OPLOCK_BREAK_HE && (shdr->Status == 0 ||
983c88a497914d Pavel Shilovsky 2012-09-18  221  		    pdu->StructureSize2 != SMB2_ERROR_STRUCTURE_SIZE2)) {
093b2bdad3221e Pavel Shilovsky 2011-06-08  222  			/* error packets have 9 byte structure size */
a0a3036b81f1f6 Joe Perches     2020-04-14  223  			cifs_dbg(VFS, "Invalid response size %u for command %d\n",
093b2bdad3221e Pavel Shilovsky 2011-06-08  224  				 le16_to_cpu(pdu->StructureSize2), command);
093b2bdad3221e Pavel Shilovsky 2011-06-08  225  			return 1;
31473fc4f9653b Pavel Shilovsky 2016-10-24  226  		} else if (command == SMB2_OPLOCK_BREAK_HE
31473fc4f9653b Pavel Shilovsky 2016-10-24  227  			   && (shdr->Status == 0)
0822f51426b51b Pavel Shilovsky 2012-09-19  228  			   && (le16_to_cpu(pdu->StructureSize2) != 44)
0822f51426b51b Pavel Shilovsky 2012-09-19  229  			   && (le16_to_cpu(pdu->StructureSize2) != 36)) {
0822f51426b51b Pavel Shilovsky 2012-09-19  230  			/* special case for SMB2.1 lease break message */
a0a3036b81f1f6 Joe Perches     2020-04-14  231  			cifs_dbg(VFS, "Invalid response size %d for oplock break\n",
0822f51426b51b Pavel Shilovsky 2012-09-19  232  				 le16_to_cpu(pdu->StructureSize2));
0822f51426b51b Pavel Shilovsky 2012-09-19  233  			return 1;
093b2bdad3221e Pavel Shilovsky 2011-06-08  234  		}
093b2bdad3221e Pavel Shilovsky 2011-06-08  235  	}
093b2bdad3221e Pavel Shilovsky 2011-06-08  236  
98170fb53587a4 Ronnie Sahlberg 2018-05-31  237  	clc_len = smb2_calc_size(buf, srvr);
093b2bdad3221e Pavel Shilovsky 2011-06-08  238  
136ff1b4b65edf Steve French    2018-04-08  239  	if (shdr->Command == SMB2_NEGOTIATE)
1fc6ad2f10ad6f Ronnie Sahlberg 2018-06-01  240  		clc_len += get_neg_ctxt_len(shdr, len, clc_len);
0fdfef9aa7ee68 Steve French    2018-06-28  241  
98170fb53587a4 Ronnie Sahlberg 2018-05-31  242  	if (len != clc_len) {
98170fb53587a4 Ronnie Sahlberg 2018-05-31  243  		cifs_dbg(FYI, "Calculated size %u length %u mismatch mid %llu\n",
98170fb53587a4 Ronnie Sahlberg 2018-05-31  244  			 clc_len, len, mid);
b42bf88828cde6 Pavel Shilovsky 2013-08-14  245  		/* create failed on symlink */
b42bf88828cde6 Pavel Shilovsky 2013-08-14  246  		if (command == SMB2_CREATE_HE &&
31473fc4f9653b Pavel Shilovsky 2016-10-24  247  		    shdr->Status == STATUS_STOPPED_ON_SYMLINK)
b42bf88828cde6 Pavel Shilovsky 2013-08-14  248  			return 0;
983c88a497914d Pavel Shilovsky 2012-09-18  249  		/* Windows 7 server returns 24 bytes more */
98170fb53587a4 Ronnie Sahlberg 2018-05-31  250  		if (clc_len + 24 == len && command == SMB2_OPLOCK_BREAK_HE)
983c88a497914d Pavel Shilovsky 2012-09-18  251  			return 0;
754789a1c04610 Steve French    2014-08-15  252  		/* server can return one byte more due to implied bcc[0] */
98170fb53587a4 Ronnie Sahlberg 2018-05-31  253  		if (clc_len == len + 1)
7411286088d5ba Pavel Shilovsky 2012-07-27  254  			return 0;
754789a1c04610 Steve French    2014-08-15  255  
e6c47dd0da1e3a Ronnie Sahlberg 2018-08-22  256  		/*
e6c47dd0da1e3a Ronnie Sahlberg 2018-08-22  257  		 * Some windows servers (win2016) will pad also the final
e6c47dd0da1e3a Ronnie Sahlberg 2018-08-22  258  		 * PDU in a compound to 8 bytes.
e6c47dd0da1e3a Ronnie Sahlberg 2018-08-22  259  		 */
e6c47dd0da1e3a Ronnie Sahlberg 2018-08-22  260  		if (((clc_len + 7) & ~7) == len)
e6c47dd0da1e3a Ronnie Sahlberg 2018-08-22  261  			return 0;
e6c47dd0da1e3a Ronnie Sahlberg 2018-08-22  262  
754789a1c04610 Steve French    2014-08-15  263  		/*
754789a1c04610 Steve French    2014-08-15  264  		 * MacOS server pads after SMB2.1 write response with 3 bytes
754789a1c04610 Steve French    2014-08-15  265  		 * of junk. Other servers match RFC1001 len to actual
754789a1c04610 Steve French    2014-08-15  266  		 * SMB2/SMB3 frame length (header + smb2 response specific data)
25f2573512d7b3 Steve French    2018-08-29  267  		 * Some windows servers also pad up to 8 bytes when compounding.
754789a1c04610 Steve French    2014-08-15  268  		 */
037d050724ed30 Steve French    2019-11-08  269  		if (clc_len < len)
754789a1c04610 Steve French    2014-08-15  270  			return 0;
037d050724ed30 Steve French    2019-11-08  271  
25f2573512d7b3 Steve French    2018-08-29  272  		pr_warn_once(
25f2573512d7b3 Steve French    2018-08-29  273  			"srv rsp too short, len %d not %d. cmd:%d mid:%llu\n",
25f2573512d7b3 Steve French    2018-08-29  274  			len, clc_len, command, mid);
754789a1c04610 Steve French    2014-08-15  275  
093b2bdad3221e Pavel Shilovsky 2011-06-08  276  		return 1;
093b2bdad3221e Pavel Shilovsky 2011-06-08  277  	}
093b2bdad3221e Pavel Shilovsky 2011-06-08  278  	return 0;
093b2bdad3221e Pavel Shilovsky 2011-06-08  279  }
093b2bdad3221e Pavel Shilovsky 2011-06-08  280  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 45147 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-18  6:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18  4:02 [PATCH -next v2] cifs: convert list_for_each to entry variant in smb2misc.c Baokun Li
2021-06-18  4:16 ` Steve French
2021-06-18  6:47 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.