lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 6 Aug 2018 17:45:01 +0530
From:   Rahul Lakkireddy <rahul.lakkireddy@...lsio.com>
To:     Al Viro <viro@...IV.linux.org.uk>
Cc:     ganeshgr@...lsio.com, David Miller <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [endianness bug] cxgb4: mk_act_open_req() buggers
 ->{local,peer}_ip on big-endian hosts

On Sunday, August 08/05/18, 2018 at 22:52:38 +0530, Al Viro wrote:
> 	Unlike fs.val.lport and fs.val.fport, cxgb4_process_flow_match()
> sets fs.val.{l,f}ip to net-endian values without conversion - they come
> straight from flow_dissector_key_ipv4_addrs ->dst and ->src resp.  So
> the assignment in mk_act_open_req() ought to be a straigh copy.
> 
> 	As far as I know, T4 PCIe cards do exist, so it's not as if that
> thing could only be found on little-endian systems...
> 
> Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> ---
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
> index 00fc5f1afb1d..7dddb9e748b8 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
> @@ -1038,10 +1038,8 @@ static void mk_act_open_req(struct filter_entry *f, struct sk_buff *skb,
>  	OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, qid_filterid));
>  	req->local_port = cpu_to_be16(f->fs.val.lport);
>  	req->peer_port = cpu_to_be16(f->fs.val.fport);
> -	req->local_ip = f->fs.val.lip[0] | f->fs.val.lip[1] << 8 |
> -		f->fs.val.lip[2] << 16 | f->fs.val.lip[3] << 24;
> -	req->peer_ip = f->fs.val.fip[0] | f->fs.val.fip[1] << 8 |
> -		f->fs.val.fip[2] << 16 | f->fs.val.fip[3] << 24;
> +	memcpy(&req->local_ip, f->fs.val.lip, 4);
> +	memcpy(&req->peer_ip, f->fs.val.fip, 4);
>  	req->opt0 = cpu_to_be64(NAGLE_V(f->fs.newvlan == VLAN_REMOVE ||
>  					f->fs.newvlan == VLAN_REWRITE) |
>  				DELACK_V(f->fs.hitcnts) |

Thanks for fix Al!

Acked-by: Rahul Lakkireddy <rahul.lakkireddy@...lsio.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ