All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/ncsi: fix checksum validation in response packet
@ 2017-04-14  8:56 Cédric Le Goater
  2017-04-17 17:36 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Cédric Le Goater @ 2017-04-14  8:56 UTC (permalink / raw)
  To: David S. Miller
  Cc: Gavin Shan, Joel Stanley, netdev, linux-kernel, Cédric Le Goater

htonl was used instead of ntohl. Surely a typo.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 net/ncsi/ncsi-rsp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c
index 087db775b3dc..d375286b79f2 100644
--- a/net/ncsi/ncsi-rsp.c
+++ b/net/ncsi/ncsi-rsp.c
@@ -52,7 +52,7 @@ static int ncsi_validate_rsp_pkt(struct ncsi_request *nr,
 
 	checksum = ncsi_calculate_checksum((unsigned char *)h,
 					   sizeof(*h) + payload - 4);
-	if (*pchecksum != htonl(checksum))
+	if (*pchecksum != ntohl(checksum))
 		return -EINVAL;
 
 	return 0;
-- 
2.7.4

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

* Re: [PATCH] net/ncsi: fix checksum validation in response packet
  2017-04-14  8:56 [PATCH] net/ncsi: fix checksum validation in response packet Cédric Le Goater
@ 2017-04-17 17:36 ` David Miller
  2017-04-18  0:06   ` Gavin Shan
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2017-04-17 17:36 UTC (permalink / raw)
  To: clg; +Cc: gwshan, joel, netdev, linux-kernel

From: Cédric Le Goater <clg@kaod.org>
Date: Fri, 14 Apr 2017 10:56:37 +0200

> htonl was used instead of ntohl. Surely a typo.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

I don't think so, "checksum" is of type "u32" thus is in host byte
order.  Therefore "htonl()" is correct.

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

* Re: [PATCH] net/ncsi: fix checksum validation in response packet
  2017-04-17 17:36 ` David Miller
@ 2017-04-18  0:06   ` Gavin Shan
  2017-04-18  6:16     ` Cédric Le Goater
  0 siblings, 1 reply; 4+ messages in thread
From: Gavin Shan @ 2017-04-18  0:06 UTC (permalink / raw)
  To: David Miller; +Cc: clg, gwshan, joel, netdev, linux-kernel

On Mon, Apr 17, 2017 at 01:36:19PM -0400, David Miller wrote:
>From: Cédric Le Goater <clg@kaod.org>
>Date: Fri, 14 Apr 2017 10:56:37 +0200
>
>> htonl was used instead of ntohl. Surely a typo.
>> 
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>
>I don't think so, "checksum" is of type "u32" thus is in host byte
>order.  Therefore "htonl()" is correct.
>

Yeah, "htonl()" is correct here. "*pchecksum" is in big-endian.
I want to know how Cédric thinks it's a problem. I guess he might
encounter the issue on the emulated NCSI channel by QEMU. On BCM5718
or BCM5719, the checksum in AEN and response packet are zero'd, meaning
the software shouldn't validate it at all.

Thanks,
Gavin

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

* Re: [PATCH] net/ncsi: fix checksum validation in response packet
  2017-04-18  0:06   ` Gavin Shan
@ 2017-04-18  6:16     ` Cédric Le Goater
  0 siblings, 0 replies; 4+ messages in thread
From: Cédric Le Goater @ 2017-04-18  6:16 UTC (permalink / raw)
  To: Gavin Shan, David Miller; +Cc: joel, netdev, linux-kernel

On 04/18/2017 02:06 AM, Gavin Shan wrote:
> On Mon, Apr 17, 2017 at 01:36:19PM -0400, David Miller wrote:
>> From: Cédric Le Goater <clg@kaod.org>
>> Date: Fri, 14 Apr 2017 10:56:37 +0200
>>
>>> htonl was used instead of ntohl. Surely a typo.
>>>
>>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>>
>> I don't think so, "checksum" is of type "u32" thus is in host byte
>> order.  Therefore "htonl()" is correct.
>>
> 
> Yeah, "htonl()" is correct here. "*pchecksum" is in big-endian.
> I want to know how Cédric thinks it's a problem. I guess he might
> encounter the issue on the emulated NCSI channel by QEMU. 

yes exactly. my bad. After a second look this is correct. Sorry for
the noise. 

> On BCM5718 or BCM5719, the checksum in AEN and response packet 
> are zero'd, meaning the software shouldn't validate it at all.

Interesting.

Thanks,

C.

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

end of thread, other threads:[~2017-04-18  9:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14  8:56 [PATCH] net/ncsi: fix checksum validation in response packet Cédric Le Goater
2017-04-17 17:36 ` David Miller
2017-04-18  0:06   ` Gavin Shan
2017-04-18  6:16     ` Cédric Le Goater

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.