提交 aec45e85 编写于 作者: W Wenjia Zhang 提交者: David S. Miller

s390/qeth: use vzalloc for QUERY OAT buffer

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: NWenjia Zhang <wenjia@linux.ibm.com>
Reviewed-by: NJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 04db741d
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/netdev_features.h> #include <linux/netdev_features.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/vmalloc.h>
#include <net/iucv/af_iucv.h> #include <net/iucv/af_iucv.h>
#include <net/dsfield.h> #include <net/dsfield.h>
...@@ -4699,7 +4700,7 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata) ...@@ -4699,7 +4700,7 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata)
priv.buffer_len = oat_data.buffer_len; priv.buffer_len = oat_data.buffer_len;
priv.response_len = 0; priv.response_len = 0;
priv.buffer = kzalloc(oat_data.buffer_len, GFP_KERNEL); priv.buffer = vzalloc(oat_data.buffer_len);
if (!priv.buffer) { if (!priv.buffer) {
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
...@@ -4740,7 +4741,7 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata) ...@@ -4740,7 +4741,7 @@ static int qeth_query_oat_command(struct qeth_card *card, char __user *udata)
rc = -EFAULT; rc = -EFAULT;
out_free: out_free:
kfree(priv.buffer); vfree(priv.buffer);
out: out:
return rc; return rc;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册