From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-eopbgr680139.outbound.protection.outlook.com ([40.107.68.139]:29328 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729229AbeJAHO2 (ORCPT ); Mon, 1 Oct 2018 03:14:28 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Wenjia Zhang , Julian Wiedmann , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.18 58/65] s390/qeth: use vzalloc for QUERY OAT buffer Date: Mon, 1 Oct 2018 00:38:39 +0000 Message-ID: <20181001003754.146961-58-alexander.levin@microsoft.com> References: <20181001003754.146961-1-alexander.levin@microsoft.com> In-Reply-To: <20181001003754.146961-1-alexander.levin@microsoft.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: Wenjia Zhang [ Upstream commit aec45e857c5538664edb76a60dd452e3265f37d1 ] qeth_query_oat_command() currently allocates the kernel buffer for the SIOC_QETH_QUERY_OAT ioctl with kzalloc. So on systems with fragmented memory, large allocations may fail (eg. the qethqoat tool by default uses 132KB). Solve this issue by using vzalloc, backing the allocation with non-contiguous memory. Signed-off-by: Wenjia Zhang Reviewed-by: Julian Wiedmann Signed-off-by: Julian Wiedmann Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/s390/net/qeth_core_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core= _main.c index ffdb78421a25..b0f0d4e86f67 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -25,6 +25,7 @@ #include #include #include +#include =20 #include #include @@ -4738,7 +4739,7 @@ static int qeth_query_oat_command(struct qeth_card *c= ard, char __user *udata) =20 priv.buffer_len =3D oat_data.buffer_len; priv.response_len =3D 0; - priv.buffer =3D kzalloc(oat_data.buffer_len, GFP_KERNEL); + priv.buffer =3D vzalloc(oat_data.buffer_len); if (!priv.buffer) { rc =3D -ENOMEM; goto out; @@ -4779,7 +4780,7 @@ static int qeth_query_oat_command(struct qeth_card *c= ard, char __user *udata) rc =3D -EFAULT; =20 out_free: - kfree(priv.buffer); + vfree(priv.buffer); out: return rc; } --=20 2.17.1