netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/smc: Remove validation of reserved bits in CLC Decline message
@ 2025-08-29 10:26 Mahanta Jambigi
  2025-08-29 14:58 ` Dust Li
  2025-09-02  7:08 ` Simon Horman
  0 siblings, 2 replies; 8+ messages in thread
From: Mahanta Jambigi @ 2025-08-29 10:26 UTC (permalink / raw)
  To: andrew+netdev, davem, edumazet, kuba, pabeni, alibuda, dust.li,
	sidraya, wenjia
  Cc: pasic, horms, tonylu, guwen, netdev, linux-s390, linux-rdma,
	Mahanta Jambigi, Alexandra Winter

Currently SMC code is validating the reserved bits while parsing the incoming
CLC decline message & when this validation fails, its treated as a protocol
error. As a result, the SMC connection is terminated instead of falling back to
TCP. As per RFC7609[1] specs we shouldn't be validating the reserved bits that
is part of CLC message. This patch fixes this issue.

CLC Decline message format can viewed here[2].

[1] https://datatracker.ietf.org/doc/html/rfc7609#page-92
[2] https://datatracker.ietf.org/doc/html/rfc7609#page-105

Fixes: 8ade200(net/smc: add v2 format of CLC decline message)

Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
Reference-ID: LTC214332
Reviewed-by: Sidraya Jayagond <sidraya@linux.ibm.com>
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>

---
 net/smc/smc_clc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
index 5a4db151fe95..08be56dfb3f2 100644
--- a/net/smc/smc_clc.c
+++ b/net/smc/smc_clc.c
@@ -426,8 +426,6 @@ smc_clc_msg_decl_valid(struct smc_clc_msg_decline *dclc)
 {
 	struct smc_clc_msg_hdr *hdr = &dclc->hdr;
 
-	if (hdr->typev1 != SMC_TYPE_R && hdr->typev1 != SMC_TYPE_D)
-		return false;
 	if (hdr->version == SMC_V1) {
 		if (ntohs(hdr->length) != sizeof(struct smc_clc_msg_decline))
 			return false;
-- 
2.48.1


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

* Re: [PATCH net] net/smc: Remove validation of reserved bits in CLC Decline message
  2025-08-29 10:26 [PATCH net] net/smc: Remove validation of reserved bits in CLC Decline message Mahanta Jambigi
@ 2025-08-29 14:58 ` Dust Li
  2025-09-01  6:12   ` Mahanta Jambigi
  2025-09-02  7:08 ` Simon Horman
  1 sibling, 1 reply; 8+ messages in thread
From: Dust Li @ 2025-08-29 14:58 UTC (permalink / raw)
  To: Mahanta Jambigi, andrew+netdev, davem, edumazet, kuba, pabeni,
	alibuda, sidraya, wenjia
  Cc: pasic, horms, tonylu, guwen, netdev, linux-s390, linux-rdma,
	Alexandra Winter

On 2025-08-29 12:26:26, Mahanta Jambigi wrote:
>Currently SMC code is validating the reserved bits while parsing the incoming
>CLC decline message & when this validation fails, its treated as a protocol
>error. As a result, the SMC connection is terminated instead of falling back to
>TCP. As per RFC7609[1] specs we shouldn't be validating the reserved bits that
>is part of CLC message. This patch fixes this issue.
>
>CLC Decline message format can viewed here[2].
>
>[1] https://datatracker.ietf.org/doc/html/rfc7609#page-92
>[2] https://datatracker.ietf.org/doc/html/rfc7609#page-105
>
>Fixes: 8ade200(net/smc: add v2 format of CLC decline message)
>
>Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
>Reference-ID: LTC214332

I think this is your internal ID ? It's better not to leave that
in the upstream patches.

>Reviewed-by: Sidraya Jayagond <sidraya@linux.ibm.com>
>Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
>
>---
> net/smc/smc_clc.c | 2 --
> 1 file changed, 2 deletions(-)
>
>diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
>index 5a4db151fe95..08be56dfb3f2 100644
>--- a/net/smc/smc_clc.c
>+++ b/net/smc/smc_clc.c
>@@ -426,8 +426,6 @@ smc_clc_msg_decl_valid(struct smc_clc_msg_decline *dclc)
> {
> 	struct smc_clc_msg_hdr *hdr = &dclc->hdr;
> 
>-	if (hdr->typev1 != SMC_TYPE_R && hdr->typev1 != SMC_TYPE_D)
>-		return false;

Here it's checking the typev1 in smc_clc_msg_hdr, but your commit message
says it's validating the reserved bits:

  Currently SMC code is validating the reserved bits while parsing the incoming
  CLC decline message & when this validation fails, its treated as a protocol
  error.

Did I miss something ?

Best regards,
Dust

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

* Re: [PATCH net] net/smc: Remove validation of reserved bits in CLC Decline message
  2025-08-29 14:58 ` Dust Li
@ 2025-09-01  6:12   ` Mahanta Jambigi
  2025-09-02  4:08     ` Dust Li
  0 siblings, 1 reply; 8+ messages in thread
From: Mahanta Jambigi @ 2025-09-01  6:12 UTC (permalink / raw)
  To: dust.li, andrew+netdev, davem, edumazet, kuba, pabeni, alibuda,
	sidraya, wenjia
  Cc: pasic, horms, tonylu, guwen, netdev, linux-s390, linux-rdma,
	Alexandra Winter



On 29/08/25 8:28 pm, Dust Li wrote:
>>
>> Fixes: 8ade200(net/smc: add v2 format of CLC decline message)
>>
>> Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
>> Reference-ID: LTC214332
> 
> I think this is your internal ID ? It's better not to leave that
> in the upstream patches.

Oops, I missed to remove it. Sure, I'll remove it.

> 
>> Reviewed-by: Sidraya Jayagond <sidraya@linux.ibm.com>
>> Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
>>
>> ---
>> net/smc/smc_clc.c | 2 --
>> 1 file changed, 2 deletions(-)
>>
>> diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
>> index 5a4db151fe95..08be56dfb3f2 100644
>> --- a/net/smc/smc_clc.c
>> +++ b/net/smc/smc_clc.c
>> @@ -426,8 +426,6 @@ smc_clc_msg_decl_valid(struct smc_clc_msg_decline *dclc)
>> {
>> 	struct smc_clc_msg_hdr *hdr = &dclc->hdr;
>>
>> -	if (hdr->typev1 != SMC_TYPE_R && hdr->typev1 != SMC_TYPE_D)
>> -		return false;
> 
> Here it's checking the typev1 in smc_clc_msg_hdr, but your commit message
> says it's validating the reserved bits:
> 
>    Currently SMC code is validating the reserved bits while parsing the incoming
>    CLC decline message & when this validation fails, its treated as a protocol
>    error.
> 
> Did I miss something ?

If you refer to struct *smc_clc_msg_hdr* in smc_clc.h file, typev1 
member represents bits 4 & 5 at offset 7. If we compare it with the CLC 
Decline message header, it represents one of the reserved(5-7 bits) at 
offset 7. You can refer to below link for reserved bits.

https://datatracker.ietf.org/doc/html/rfc7609#page-105

> 
> Best regards,
> Dust


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

* Re: [PATCH net] net/smc: Remove validation of reserved bits in CLC Decline message
  2025-09-01  6:12   ` Mahanta Jambigi
@ 2025-09-02  4:08     ` Dust Li
  2025-09-02  6:05       ` Mahanta Jambigi
  0 siblings, 1 reply; 8+ messages in thread
From: Dust Li @ 2025-09-02  4:08 UTC (permalink / raw)
  To: Mahanta Jambigi, andrew+netdev, davem, edumazet, kuba, pabeni,
	alibuda, sidraya, wenjia
  Cc: pasic, horms, tonylu, guwen, netdev, linux-s390, linux-rdma,
	Alexandra Winter

On 2025-09-01 11:42:38, Mahanta Jambigi wrote:
>
>
>On 29/08/25 8:28 pm, Dust Li wrote:
>> > 
>> > Fixes: 8ade200(net/smc: add v2 format of CLC decline message)
>> > 
>> > Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
>> > Reference-ID: LTC214332
>> 
>> I think this is your internal ID ? It's better not to leave that
>> in the upstream patches.
>
>Oops, I missed to remove it. Sure, I'll remove it.
>
>> 
>> > Reviewed-by: Sidraya Jayagond <sidraya@linux.ibm.com>
>> > Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
>> > 
>> > ---
>> > net/smc/smc_clc.c | 2 --
>> > 1 file changed, 2 deletions(-)
>> > 
>> > diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
>> > index 5a4db151fe95..08be56dfb3f2 100644
>> > --- a/net/smc/smc_clc.c
>> > +++ b/net/smc/smc_clc.c
>> > @@ -426,8 +426,6 @@ smc_clc_msg_decl_valid(struct smc_clc_msg_decline *dclc)
>> > {
>> > 	struct smc_clc_msg_hdr *hdr = &dclc->hdr;
>> > 
>> > -	if (hdr->typev1 != SMC_TYPE_R && hdr->typev1 != SMC_TYPE_D)
>> > -		return false;
>> 
>> Here it's checking the typev1 in smc_clc_msg_hdr, but your commit message
>> says it's validating the reserved bits:
>> 
>>    Currently SMC code is validating the reserved bits while parsing the incoming
>>    CLC decline message & when this validation fails, its treated as a protocol
>>    error.
>> 
>> Did I miss something ?
>
>If you refer to struct *smc_clc_msg_hdr* in smc_clc.h file, typev1 member
>represents bits 4 & 5 at offset 7. If we compare it with the CLC Decline
>message header, it represents one of the reserved(5-7 bits) at offset 7. You
>can refer to below link for reserved bits.
>
>https://datatracker.ietf.org/doc/html/rfc7609#page-105

Oh, I see, thanks! The patch looks good to me.


BTW, I checked the rfc7609 and SMCv2.1 spec:
https://www.ibm.com/support/pages/system/files/inline-files/IBM%20Shared%20Memory%20Communications%20Version%202.1_0.pdf

I think the name type1/type2 in smc_clc_msg_hdr is confusing, as it doesn't sync
with the spec for decline message.

Best regards,
Dust



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

* Re: [PATCH net] net/smc: Remove validation of reserved bits in CLC Decline message
  2025-09-02  4:08     ` Dust Li
@ 2025-09-02  6:05       ` Mahanta Jambigi
  2025-09-02  7:26         ` Dust Li
  0 siblings, 1 reply; 8+ messages in thread
From: Mahanta Jambigi @ 2025-09-02  6:05 UTC (permalink / raw)
  To: dust.li, andrew+netdev, davem, edumazet, kuba, pabeni, alibuda,
	sidraya, wenjia
  Cc: pasic, horms, tonylu, guwen, netdev, linux-s390, linux-rdma,
	Alexandra Winter


On 02/09/25 9:38 am, Dust Li wrote:
>>>
>>> Did I miss something ?
>>
>> If you refer to struct *smc_clc_msg_hdr* in smc_clc.h file, typev1 member
>> represents bits 4 & 5 at offset 7. If we compare it with the CLC Decline
>> message header, it represents one of the reserved(5-7 bits) at offset 7. You
>> can refer to below link for reserved bits.
>>
>> https://datatracker.ietf.org/doc/html/rfc7609#page-105
> 
> Oh, I see, thanks! The patch looks good to me.
> 
> 
> BTW, I checked the rfc7609 and SMCv2.1 spec:
> https://www.ibm.com/support/pages/system/files/inline-files/IBM%20Shared%20Memory%20Communications%20Version%202.1_0.pdf
> 
> I think the name type1/type2 in smc_clc_msg_hdr is confusing, as it doesn't sync
> with the spec for decline message.

I agree with you. We can address them in future. Since they are part of
reserved bits, we can ignore parsing them for now. May I add your R-b
for this patch?

> 
> Best regards,
> Dust
> 
> 


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

* Re: [PATCH net] net/smc: Remove validation of reserved bits in CLC Decline message
  2025-08-29 10:26 [PATCH net] net/smc: Remove validation of reserved bits in CLC Decline message Mahanta Jambigi
  2025-08-29 14:58 ` Dust Li
@ 2025-09-02  7:08 ` Simon Horman
  2025-09-02  8:13   ` Mahanta Jambigi
  1 sibling, 1 reply; 8+ messages in thread
From: Simon Horman @ 2025-09-02  7:08 UTC (permalink / raw)
  To: Mahanta Jambigi
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, alibuda, dust.li,
	sidraya, wenjia, pasic, tonylu, guwen, netdev, linux-s390,
	linux-rdma, Alexandra Winter

On Fri, Aug 29, 2025 at 12:26:26PM +0200, Mahanta Jambigi wrote:
> Currently SMC code is validating the reserved bits while parsing the incoming
> CLC decline message & when this validation fails, its treated as a protocol
> error. As a result, the SMC connection is terminated instead of falling back to
> TCP. As per RFC7609[1] specs we shouldn't be validating the reserved bits that
> is part of CLC message. This patch fixes this issue.
> 
> CLC Decline message format can viewed here[2].
> 
> [1] https://datatracker.ietf.org/doc/html/rfc7609#page-92
> [2] https://datatracker.ietf.org/doc/html/rfc7609#page-105
> 
> Fixes: 8ade200(net/smc: add v2 format of CLC decline message)
> 

Hi Mahanta,

Sorry to nit-pick, but there should not be a blank line here.
And the correct format for the Fixes tag, whith at least
12 characters of hash, is:

Fixes: 8ade200c269f ("net/smc: add v2 format of CLC decline message")

> Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
> Reference-ID: LTC214332

Please drop this non-standard tag.
And please only include references (by any means) to public information.

> Reviewed-by: Sidraya Jayagond <sidraya@linux.ibm.com>
> Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>

...

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

* Re: [PATCH net] net/smc: Remove validation of reserved bits in CLC Decline message
  2025-09-02  6:05       ` Mahanta Jambigi
@ 2025-09-02  7:26         ` Dust Li
  0 siblings, 0 replies; 8+ messages in thread
From: Dust Li @ 2025-09-02  7:26 UTC (permalink / raw)
  To: Mahanta Jambigi, andrew+netdev, davem, edumazet, kuba, pabeni,
	alibuda, sidraya, wenjia
  Cc: pasic, horms, tonylu, guwen, netdev, linux-s390, linux-rdma,
	Alexandra Winter

On 2025-09-02 11:35:34, Mahanta Jambigi wrote:
>
>On 02/09/25 9:38 am, Dust Li wrote:
>>>>
>>>> Did I miss something ?
>>>
>>> If you refer to struct *smc_clc_msg_hdr* in smc_clc.h file, typev1 member
>>> represents bits 4 & 5 at offset 7. If we compare it with the CLC Decline
>>> message header, it represents one of the reserved(5-7 bits) at offset 7. You
>>> can refer to below link for reserved bits.
>>>
>>> https://datatracker.ietf.org/doc/html/rfc7609#page-105
>> 
>> Oh, I see, thanks! The patch looks good to me.
>> 
>> 
>> BTW, I checked the rfc7609 and SMCv2.1 spec:
>> https://www.ibm.com/support/pages/system/files/inline-files/IBM%20Shared%20Memory%20Communications%20Version%202.1_0.pdf
>> 
>> I think the name type1/type2 in smc_clc_msg_hdr is confusing, as it doesn't sync
>> with the spec for decline message.
>
>I agree with you. We can address them in future. Since they are part of
>reserved bits, we can ignore parsing them for now. May I add your R-b
>for this patch?

Yes. Once the issues in the commit log are addressed, you can add my
Reviewed-by: Dust Li <dust.li@linux.alibaba.com>

Best regards,
Dust



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

* Re: [PATCH net] net/smc: Remove validation of reserved bits in CLC Decline message
  2025-09-02  7:08 ` Simon Horman
@ 2025-09-02  8:13   ` Mahanta Jambigi
  0 siblings, 0 replies; 8+ messages in thread
From: Mahanta Jambigi @ 2025-09-02  8:13 UTC (permalink / raw)
  To: Simon Horman
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, alibuda, dust.li,
	sidraya, wenjia, pasic, tonylu, guwen, netdev, linux-s390,
	linux-rdma, Alexandra Winter



On 02/09/25 12:38 pm, Simon Horman wrote:
> 
> Hi Mahanta,
> 
> Sorry to nit-pick, but there should not be a blank line here.
> And the correct format for the Fixes tag, whith at least
> 12 characters of hash, is:
> 
> Fixes: 8ade200c269f ("net/smc: add v2 format of CLC decline message")

Sure, will fix this in v2.>> Signed-off-by: Mahanta Jambigi
<mjambigi@linux.ibm.com>
>> Reference-ID: LTC214332
> 
> Please drop this non-standard tag.
> And please only include references (by any means) to public information.

Yeah, will fix this in v2. Dust Li also mentioned the same.

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

end of thread, other threads:[~2025-09-02  8:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 10:26 [PATCH net] net/smc: Remove validation of reserved bits in CLC Decline message Mahanta Jambigi
2025-08-29 14:58 ` Dust Li
2025-09-01  6:12   ` Mahanta Jambigi
2025-09-02  4:08     ` Dust Li
2025-09-02  6:05       ` Mahanta Jambigi
2025-09-02  7:26         ` Dust Li
2025-09-02  7:08 ` Simon Horman
2025-09-02  8:13   ` Mahanta Jambigi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).