ACK: [SRU][Bionic][Cosmic][PATCH 1/1] s390/qeth: use vzalloc for QUERY OAT buffer
Stefan Bader
stefan.bader at canonical.com
Thu Sep 27 16:45:33 UTC 2018
On 20.09.2018 11:31, Joseph Salisbury wrote:
> From: Wenjia Zhang <wenjia at linux.ibm.com>
>
> BugLink: https://bugs.launchpad.net/bugs/1793086
>
> 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 <wenjia at linux.ibm.com>
> Reviewed-by: Julian Wiedmann <jwi at linux.ibm.com>
> Signed-off-by: Julian Wiedmann <jwi at linux.ibm.com>
> Signed-off-by: David S. Miller <davem at davemloft.net>
> (cherry picked from commit aec45e857c5538664edb76a60dd452e3265f37d1)
> Signed-off-by: Joseph Salisbury <joseph.salisbury at canonical.com>
Acked-by: Stefan Bader <stefan.bader at canonical.com>
> ---
> 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 d01ac29..02b7352 100644
> --- a/drivers/s390/net/qeth_core_main.c
> +++ b/drivers/s390/net/qeth_core_main.c
> @@ -25,6 +25,7 @@
> #include <linux/netdevice.h>
> #include <linux/netdev_features.h>
> #include <linux/skbuff.h>
> +#include <linux/vmalloc.h>
>
> #include <net/iucv/af_iucv.h>
> #include <net/dsfield.h>
> @@ -4737,7 +4738,7 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata)
>
> priv.buffer_len = oat_data.buffer_len;
> priv.response_len = 0;
> - priv.buffer = kzalloc(oat_data.buffer_len, GFP_KERNEL);
> + priv.buffer = vzalloc(oat_data.buffer_len);
> if (!priv.buffer) {
> rc = -ENOMEM;
> goto out;
> @@ -4778,7 +4779,7 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata)
> rc = -EFAULT;
>
> out_free:
> - kfree(priv.buffer);
> + vfree(priv.buffer);
> out:
> return rc;
> }
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20180927/ea643570/attachment.sig>
More information about the kernel-team
mailing list