]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
s390/qeth: use vzalloc for QUERY OAT buffer
authorWenjia Zhang <wenjia@linux.ibm.com>
Thu, 20 Sep 2018 09:31:00 +0000 (11:31 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 1 Oct 2018 15:26:55 +0000 (17:26 +0200)
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@linux.ibm.com>
Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit aec45e857c5538664edb76a60dd452e3265f37d1)
Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/s390/net/qeth_core_main.c

index 3c6843fa562818fab8adc07dd88cbcf104a154b8..d3ce71b1edf69bebbb28f02bd95191d876ca211d 100644 (file)
@@ -24,6 +24,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>
@@ -4745,7 +4746,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;
@@ -4786,7 +4787,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;
 }