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]
Message-ID: <20171214062020.wj6iglgcfpu2b7kh@gauss3.secunet.de>
Date:   Thu, 14 Dec 2017 07:20:20 +0100
From:   Steffen Klassert <steffen.klassert@...unet.com>
To:     Shannon Nelson <shannon.nelson@...cle.com>
CC:     <netdev@...r.kernel.org>
Subject: Re: [PATCH ipsec-next] xfrm: check for xdo_dev_state_free

On Mon, Dec 11, 2017 at 12:57:22PM -0800, Shannon Nelson wrote:
> The current XFRM code assumes that we've implemented the
> xdo_dev_state_free() callback, even if it is meaningless to the driver.
> This patch adds a check for it before calling, as done in other APIs,
> and is done for the xdo_state_offload_ok() callback.
> 
> Also, we add a check for the required add and delete functions up front
> at registration time to be sure both are defined, and complain if not.
> 
> Signed-off-by: Shannon Nelson <shannon.nelson@...cle.com>
> ---
>  include/net/xfrm.h     |  3 ++-
>  net/xfrm/xfrm_device.c | 18 ++++++++++++++----
>  2 files changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/include/net/xfrm.h b/include/net/xfrm.h
> index e015e16..dfabd04 100644
> --- a/include/net/xfrm.h
> +++ b/include/net/xfrm.h
> @@ -1891,7 +1891,8 @@ static inline void xfrm_dev_state_free(struct xfrm_state *x)
>  	 struct net_device *dev = xso->dev;
>  
>  	if (dev && dev->xfrmdev_ops) {
> -		dev->xfrmdev_ops->xdo_dev_state_free(x);
> +		if (dev->xfrmdev_ops->xdo_dev_state_free)
> +			dev->xfrmdev_ops->xdo_dev_state_free(x);
>  		xso->dev = NULL;
>  		dev_put(dev);
>  	}
> diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
> index 30e5746..0df1cc2 100644
> --- a/net/xfrm/xfrm_device.c
> +++ b/net/xfrm/xfrm_device.c
> @@ -144,11 +144,21 @@ EXPORT_SYMBOL_GPL(xfrm_dev_offload_ok);
>  
>  static int xfrm_dev_register(struct net_device *dev)
>  {
> -	if ((dev->features & NETIF_F_HW_ESP) && !dev->xfrmdev_ops)
> -		return NOTIFY_BAD;
> -	if ((dev->features & NETIF_F_HW_ESP_TX_CSUM) &&
> -	    !(dev->features & NETIF_F_HW_ESP))
> +	if (!(dev->features & NETIF_F_HW_ESP)) {
> +		if (dev->features & NETIF_F_HW_ESP_TX_CSUM) {
> +			netdev_err(dev, "NETIF_F_HW_ESP_TX_CSUM without NETIF_F_HW_ESP\n");
> +			return NOTIFY_BAD;
> +		} else {
> +			return NOTIFY_DONE;
> +		}
> +	}
> +
> +	if (!(dev->xfrmdev_ops &&
> +	      dev->xfrmdev_ops->xdo_dev_state_add &&
> +	      dev->xfrmdev_ops->xdo_dev_state_delete)) {
> +		netdev_err(dev, "add or delete function missing from xfrmdev_ops\n");

Please remove these error printings, this is not relevant for normal
users.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ