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  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:   Sat, 19 Sep 2020 06:43:33 +0100
From:   Christoph Hellwig <hch@...radead.org>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Christoph Hellwig <hch@...radead.org>,
        Michal Kubecek <mkubecek@...e.cz>,
        Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
        Jens Axboe <axboe@...nel.dk>, linux-kernel@...r.kernel.org,
        netdev@...r.kernel.org
Subject: Re: [PATCH 1/2] ethtool: improve compat ioctl handling

> +	if (ethtool_translate_compat()) {
> +		struct compat_ethtool_rxnfc crxnfc = {};
> +
> +		if (copy_from_user(&crxnfc, useraddr,
> +				   min(size, sizeof(crxnfc))))
> +			return -EFAULT;
> +
> +		*rxnfc = (struct ethtool_rxnfc) {
> +			.cmd		= crxnfc.cmd,
> +			.flow_type	= crxnfc.flow_type,
> +			.data		= crxnfc.data,
> +			.fs		= {
> +				.flow_type	= crxnfc.fs.flow_type,
> +				.h_u		= crxnfc.fs.h_u,
> +				.h_ext		= crxnfc.fs.h_ext,
> +				.m_u		= crxnfc.fs.m_u,
> +				.m_ext		= crxnfc.fs.m_ext,
> +				.ring_cookie	= crxnfc.fs.ring_cookie,
> +				.location	= crxnfc.fs.location,
> +			},
> +			.rule_cnt	= crxnfc.rule_cnt,
> +		};

I'd split the compat version into a self-contained noinline helper.
Same for ethtool_rxnfc_copy_to_user.

Otherwise this looks good:

Reviewed-by: Christoph Hellwig <hch@....de>

Powered by blists - more mailing lists