Return-Path: Received: from omzsmtpe01.verizonbusiness.com ([199.249.25.210]:25082 "EHLO omzsmtpe01.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752572AbdLMB6Y (ORCPT ); Tue, 12 Dec 2017 20:58:24 -0500 From: alexander.levin@verizon.com Cc: Alexander Duyck , "David S . Miller" , alexander.levin@verizon.com To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.9 047/100] net: Do not allow negative values for busy_read and busy_poll sysctl interfaces Date: Wed, 13 Dec 2017 01:57:34 +0000 Message-ID: <20171213015722.6722-22-alexander.levin@verizon.com> References: <20171213015722.6722-1-alexander.levin@verizon.com> In-Reply-To: <20171213015722.6722-1-alexander.levin@verizon.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Alexander Duyck [ Upstream commit 95f255211396958c718aef8c45e3923b5211ea7b ] This change basically codifies what I think was already the limitations on the busy_poll and busy_read sysctl interfaces. We weren't checking the lower bounds and as such could input negative values. The behavior when that was used was dependent on the architecture. In order to prevent any issues with that I am just disabling support for values less than 0 since this way we don't have to worry about any odd behaviors. By limiting the sysctl values this way it also makes it consistent with how we handle the SO_BUSY_POLL socket option since the value appears to be reported as a signed integer value and negative values are rejected. Signed-off-by: Alexander Duyck Acked-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/core/sysctl_net_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index 0df2aa652530..a7f05f0130e8 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c @@ -369,14 +369,16 @@ static struct ctl_table net_core_table[] =3D { .data =3D &sysctl_net_busy_poll, .maxlen =3D sizeof(unsigned int), .mode =3D 0644, - .proc_handler =3D proc_dointvec + .proc_handler =3D proc_dointvec_minmax, + .extra1 =3D &zero, }, { .procname =3D "busy_read", .data =3D &sysctl_net_busy_read, .maxlen =3D sizeof(unsigned int), .mode =3D 0644, - .proc_handler =3D proc_dointvec + .proc_handler =3D proc_dointvec_minmax, + .extra1 =3D &zero, }, #endif #ifdef CONFIG_NET_SCHED --=20 2.11.0