Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01668664 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ipv6: addrconf: validate new MTU before applying it"

parents df6d7dd1 f44289e9
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -4753,6 +4753,21 @@ int addrconf_sysctl_forward(ctl_table *ctl, int write,
	return ret;
}

static
int addrconf_sysctl_mtu(struct ctl_table *ctl, int write,
			void __user *buffer, size_t *lenp, loff_t *ppos)
{
	struct inet6_dev *idev = ctl->extra1;
	int min_mtu = IPV6_MIN_MTU;
	struct ctl_table lctl;

	lctl = *ctl;
	lctl.extra1 = &min_mtu;
	lctl.extra2 = idev ? &idev->dev->mtu : NULL;

	return proc_dointvec_minmax(&lctl, write, buffer, lenp, ppos);
}

static void dev_disable_change(struct inet6_dev *idev)
{
	if (!idev || !idev->dev)
@@ -4861,7 +4876,7 @@ static struct addrconf_sysctl_table
			.data		= &ipv6_devconf.mtu6,
			.maxlen		= sizeof(int),
			.mode		= 0644,
			.proc_handler	= proc_dointvec,
			.proc_handler	= addrconf_sysctl_mtu,
		},
		{
			.procname	= "accept_ra",