Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1623667 > unrolled thread

[PATCH] net/ncsi: fix checksum validation in response packet

Started byCédric Le Goater <clg@kaod.org>
First post2017-04-14 15:50 +0200
Last post2017-04-18 12:00 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] net/ncsi: fix checksum validation in response packet Cédric Le Goater <clg@kaod.org> - 2017-04-14 15:50 +0200
    Re: [PATCH] net/ncsi: fix checksum validation in response packet David Miller <davem@davemloft.net> - 2017-04-17 19:40 +0200
      Re: [PATCH] net/ncsi: fix checksum validation in response packet Gavin Shan <gwshan@linux.vnet.ibm.com> - 2017-04-18 02:10 +0200
        Re: [PATCH] net/ncsi: fix checksum validation in response packet Cédric Le Goater <clg@kaod.org> - 2017-04-18 12:00 +0200

#1623667 — [PATCH] net/ncsi: fix checksum validation in response packet

FromCédric Le Goater <clg@kaod.org>
Date2017-04-14 15:50 +0200
Subject[PATCH] net/ncsi: fix checksum validation in response packet
Message-ID<tw9LP-1Gq-11@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1624772

FromDavid Miller <davem@davemloft.net>
Date2017-04-17 19:40 +0200
Message-ID<txiN3-3w9-17@gated-at.bofh.it>
In reply to#1623667
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.

[toc] | [prev] | [next] | [standalone]


#1624967

FromGavin Shan <gwshan@linux.vnet.ibm.com>
Date2017-04-18 02:10 +0200
Message-ID<txoSu-7uv-3@gated-at.bofh.it>
In reply to#1624772
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

[toc] | [prev] | [next] | [standalone]


#1625198

FromCédric Le Goater <clg@kaod.org>
Date2017-04-18 12:00 +0200
Message-ID<txy5s-4CV-7@gated-at.bofh.it>
In reply to#1624967
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web