aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/geneve.c
diff options
context:
space:
mode:
authorAlexey Kodanev <alexey.kodanev@oracle.com>2018-04-19 15:42:31 +0300
committerDavid S. Miller <davem@davemloft.net>2018-04-20 11:20:05 -0400
commit321acc1c68c13ce113531a8bc3dc5d43814c4ae2 (patch)
treee26ca00159c41dd0dfcea2473a17678d808815a1 /drivers/net/geneve.c
parentgeneve: cleanup hard coded value for Ethernet header length (diff)
downloadlinux-dev-321acc1c68c13ce113531a8bc3dc5d43814c4ae2.tar.xz
linux-dev-321acc1c68c13ce113531a8bc3dc5d43814c4ae2.zip
geneve: check MTU for a minimum in geneve_change_mtu()
geneve_change_mtu() will be used not only as ndo_change_mtu() callback, but also to verify a user specified MTU on a new link creation in the next patch. Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/geneve.c')
-rw-r--r--drivers/net/geneve.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index b650f845af25..ae649f699a92 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -942,11 +942,10 @@ tx_error:
static int geneve_change_mtu(struct net_device *dev, int new_mtu)
{
- /* Only possible if called internally, ndo_change_mtu path's new_mtu
- * is guaranteed to be between dev->min_mtu and dev->max_mtu.
- */
if (new_mtu > dev->max_mtu)
new_mtu = dev->max_mtu;
+ else if (new_mtu < dev->min_mtu)
+ new_mtu = dev->min_mtu;
dev->mtu = new_mtu;
return 0;