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:   Fri, 04 Dec 2020 14:56:22 -0700
From:   subashab@...eaurora.org
To:     Loic Poulain <loic.poulain@...aro.org>
Cc:     stranche@...eaurora.org, netdev@...r.kernel.org, kuba@...nel.org
Subject: Re: [PATCH] net: rmnet: Adjust virtual device MTU on real device
 capability

On 2020-12-03 10:40, Loic Poulain wrote:
> A submitted qmap/rmnet packet size can not be larger than the linked
> interface (real_dev) MTU. This patch ensures that the rmnet virtual
> iface MTU is configured according real device capability.
> 
> Signed-off-by: Loic Poulain <loic.poulain@...aro.org>
> ---
>  drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> index d58b51d..d1d7328 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> @@ -60,9 +60,14 @@ static netdev_tx_t rmnet_vnd_start_xmit(struct 
> sk_buff
> *skb,
> 
>  static int rmnet_vnd_change_mtu(struct net_device *rmnet_dev, int
> new_mtu)
>  {
> +	struct rmnet_priv *priv = netdev_priv(rmnet_dev);
> +
>  	if (new_mtu < 0 || new_mtu > RMNET_MAX_PACKET_SIZE)
>  		return -EINVAL;
> 
> +	if (priv->real_dev && (new_mtu + RMNET_NEEDED_HEADROOM) >
> priv->real_dev->mtu)
> +		return -EINVAL;
> +
>  	rmnet_dev->mtu = new_mtu;
>  	return 0;
>  }
> @@ -242,6 +247,9 @@ int rmnet_vnd_newlink(u8 id, struct net_device
> *rmnet_dev,
> 
>  	priv->real_dev = real_dev;
> 
> +	/* Align default MTU with real_dev MTU */
> +	rmnet_vnd_change_mtu(rmnet_dev, real_dev->mtu -
> RMNET_NEEDED_HEADROOM);
> +
>  	rc = register_netdevice(rmnet_dev);
>  	if (!rc) {
>  		ep->egress_dev = rmnet_dev;

This would need similar checks in the NETDEV_PRECHANGEMTU
netdev notifier.

Powered by blists - more mailing lists