Skip to content

Commit d5afd6b

Browse files
Wenjia Zhanggregkh
authored andcommitted
s390/qeth: use vzalloc for QUERY OAT buffer
[ Upstream commit aec45e8 ] 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> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ad29789 commit d5afd6b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/s390/net/qeth_core_main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/netdevice.h>
2424
#include <linux/netdev_features.h>
2525
#include <linux/skbuff.h>
26+
#include <linux/vmalloc.h>
2627

2728
#include <net/iucv/af_iucv.h>
2829
#include <net/dsfield.h>
@@ -4728,7 +4729,7 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata)
47284729

47294730
priv.buffer_len = oat_data.buffer_len;
47304731
priv.response_len = 0;
4731-
priv.buffer = kzalloc(oat_data.buffer_len, GFP_KERNEL);
4732+
priv.buffer = vzalloc(oat_data.buffer_len);
47324733
if (!priv.buffer) {
47334734
rc = -ENOMEM;
47344735
goto out;
@@ -4769,7 +4770,7 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata)
47694770
rc = -EFAULT;
47704771

47714772
out_free:
4772-
kfree(priv.buffer);
4773+
vfree(priv.buffer);
47734774
out:
47744775
return rc;
47754776
}

0 commit comments

Comments
 (0)