Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] smb3: add indatalen that can be a non-zero value to calculation of credit charge in smb2 ioctl
       [not found] <CGME20200611022619epcas1p46fd9d1d54396f0a4206b550949377d99@epcas1p4.samsung.com>
@ 2020-06-11  2:21 ` Namjae Jeon
  2020-06-12 11:00   ` Aurélien Aptel
  0 siblings, 1 reply; 3+ messages in thread
From: Namjae Jeon @ 2020-06-11  2:21 UTC (permalink / raw)
  To: linux-cifs; +Cc: linkinjeon, Namjae Jeon, Stable, Aurelien Aptel, Steve French

Some of tests in xfstests failed with cifsd kernel server since commit
e80ddeb2f70e. cifsd kernel server validates credit charge from client
by calculating it base on max((InputCount + OutputCount) and
(MaxInputResponse + MaxOutputResponse)) according to specification.

MS-SMB2 specification describe credit charge calculation of smb2 ioctl :

If Connection.SupportsMultiCredit is TRUE, the server MUST validate
CreditCharge based on the maximum of (InputCount + OutputCount) and
(MaxInputResponse + MaxOutputResponse), as specified in section 3.3.5.2.5.
If the validation fails, it MUST fail the IOCTL request with
STATUS_INVALID_PARAMETER.

This patch add indatalen that can be a non-zero value to calculation of
credit charge in SMB2_ioctl_init().

Fixes: e80ddeb2f70e ("smb3: fix incorrect number of credits when ioctl
MaxOutputResponse > 64K")
Cc: Stable <stable@vger.kernel.org>
Cc: Aurelien Aptel <aaptel@suse.com>
Cc: Steve French <smfrench@gmail.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
---
 fs/cifs/smb2pdu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index ded96b529a4d..86d894499fbb 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2973,7 +2973,9 @@ SMB2_ioctl_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
 	 * response size smaller.
 	 */
 	req->MaxOutputResponse = cpu_to_le32(max_response_size);
-	req->sync_hdr.CreditCharge = cpu_to_le16(DIV_ROUND_UP(max_response_size, SMB2_MAX_BUFFER_SIZE));
+	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
-- 
2.17.1


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

* Re: [PATCH] smb3: add indatalen that can be a non-zero value to calculation of credit charge in smb2 ioctl
  2020-06-11  2:21 ` [PATCH] smb3: add indatalen that can be a non-zero value to calculation of credit charge in smb2 ioctl Namjae Jeon
@ 2020-06-12 11:00   ` Aurélien Aptel
  2020-06-12 23:37     ` Namjae Jeon
  0 siblings, 1 reply; 3+ messages in thread
From: Aurélien Aptel @ 2020-06-12 11:00 UTC (permalink / raw)
  To: Namjae Jeon, linux-cifs; +Cc: linkinjeon, Namjae Jeon, Stable, Steve French

Hi Namjae,

Nice to see a patch :)

Reviewed-by: Aurelien Aptel <aaptel@suse.com>

Cheers,
-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)

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

* Re: [PATCH] smb3: add indatalen that can be a non-zero value to calculation of credit charge in smb2 ioctl
  2020-06-12 11:00   ` Aurélien Aptel
@ 2020-06-12 23:37     ` Namjae Jeon
  0 siblings, 0 replies; 3+ messages in thread
From: Namjae Jeon @ 2020-06-12 23:37 UTC (permalink / raw)
  To: Aurélien Aptel; +Cc: Namjae Jeon, linux-cifs, Stable, Steve French

2020-06-12 20:00 GMT+09:00, Aurélien Aptel <aaptel@suse.com>:
> Hi Namjae,
Hi Aurélien,
>
> Nice to see a patch :)
>
> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Thanks for your review!!
>
> Cheers,
> --
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
>

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

end of thread, other threads:[~2020-06-12 23:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20200611022619epcas1p46fd9d1d54396f0a4206b550949377d99@epcas1p4.samsung.com>
2020-06-11  2:21 ` [PATCH] smb3: add indatalen that can be a non-zero value to calculation of credit charge in smb2 ioctl Namjae Jeon
2020-06-12 11:00   ` Aurélien Aptel
2020-06-12 23:37     ` Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox