[SRU][Xenial][PATCH 0/1] s390/qeth: use vzalloc for QUERY OAT buffer

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[SRU][Xenial][PATCH 0/1] s390/qeth: use vzalloc for QUERY OAT buffer

Joseph Salisbury-3
BugLink: https://bugs.launchpad.net/bugs/1793086

== SRU Justification ==
IBM reports the qethqoat tool fails.  qeth_query_oat_command() currently
allocates the kernel buffer for the SIOC_QETH_QUERY_OAT ioctl with kzalloc.

This commit will cause the use of vzalloc() instead of kzalloc(), backing
the allocation with non-contiguous memory.

Bionic and Cosmic also need this commit, but they are clean cherry picks
so have been SRU'd separatly.

== Fix ==
aec45e857c55 ("s390/qeth: use vzalloc for QUERY OAT buffer")

== Regression Potential ==
Low, limited to s390.

== Test Case ==
IBM verified testing of this commit up-front.

Wenjia Zhang (1):
  s390/qeth: use vzalloc for QUERY OAT buffer

 drivers/s390/net/qeth_core_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[SRU][Xenial][PATCH 1/1] s390/qeth: use vzalloc for QUERY OAT buffer

Joseph Salisbury-3
From: Wenjia Zhang <[hidden email]>

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 <[hidden email]>
Reviewed-by: Julian Wiedmann <[hidden email]>
Signed-off-by: Julian Wiedmann <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(backported from commit aec45e857c5538664edb76a60dd452e3265f37d1)
Signed-off-by: Joseph Salisbury <[hidden email]>
---
 drivers/s390/net/qeth_core_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 40284b4..f0a34a2 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -19,6 +19,8 @@
 #include <linux/mii.h>
 #include <linux/kthread.h>
 #include <linux/slab.h>
+#include <linux/vmalloc.h>
+
 #include <net/iucv/af_iucv.h>
 #include <net/dsfield.h>
 
@@ -4705,7 +4707,7 @@ 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;
@@ -4746,7 +4748,7 @@ 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;
 }
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [SRU][Xenial][PATCH 1/1] s390/qeth: use vzalloc for QUERY OAT buffer

Stefan Bader-2
On 20.09.2018 11:42, Joseph Salisbury wrote:

> From: Wenjia Zhang <[hidden email]>
>
> 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 <[hidden email]>
> Reviewed-by: Julian Wiedmann <[hidden email]>
> Signed-off-by: Julian Wiedmann <[hidden email]>
> Signed-off-by: David S. Miller <[hidden email]>
> (backported from commit aec45e857c5538664edb76a60dd452e3265f37d1)
> Signed-off-by: Joseph Salisbury <[hidden email]>
Acked-by: Stefan Bader <[hidden email]>

> ---
>  drivers/s390/net/qeth_core_main.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
> index 40284b4..f0a34a2 100644
> --- a/drivers/s390/net/qeth_core_main.c
> +++ b/drivers/s390/net/qeth_core_main.c
> @@ -19,6 +19,8 @@
>  #include <linux/mii.h>
>  #include <linux/kthread.h>
>  #include <linux/slab.h>
> +#include <linux/vmalloc.h>
> +
>  #include <net/iucv/af_iucv.h>
>  #include <net/dsfield.h>
>  
> @@ -4705,7 +4707,7 @@ 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;
> @@ -4746,7 +4748,7 @@ 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;
>  }
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

ACK: [SRU][Xenial][PATCH 1/1] s390/qeth: use vzalloc for QUERY OAT buffer

Kleber Souza
In reply to this post by Joseph Salisbury-3
On 09/20/18 11:42, Joseph Salisbury wrote:

> From: Wenjia Zhang <[hidden email]>
>
> 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 <[hidden email]>
> Reviewed-by: Julian Wiedmann <[hidden email]>
> Signed-off-by: Julian Wiedmann <[hidden email]>
> Signed-off-by: David S. Miller <[hidden email]>
> (backported from commit aec45e857c5538664edb76a60dd452e3265f37d1)
> Signed-off-by: Joseph Salisbury <[hidden email]>

Acked-by: Kleber Sacilotto de Souza <[hidden email]>

> ---
>  drivers/s390/net/qeth_core_main.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
> index 40284b4..f0a34a2 100644
> --- a/drivers/s390/net/qeth_core_main.c
> +++ b/drivers/s390/net/qeth_core_main.c
> @@ -19,6 +19,8 @@
>  #include <linux/mii.h>
>  #include <linux/kthread.h>
>  #include <linux/slab.h>
> +#include <linux/vmalloc.h>
> +
>  #include <net/iucv/af_iucv.h>
>  #include <net/dsfield.h>
>  
> @@ -4705,7 +4707,7 @@ 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;
> @@ -4746,7 +4748,7 @@ 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;
>  }
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED: [SRU][Xenial][PATCH 0/1] s390/qeth: use vzalloc for QUERY OAT buffer

Kleber Souza
In reply to this post by Joseph Salisbury-3
On 09/20/18 11:42, Joseph Salisbury wrote:

> BugLink: https://bugs.launchpad.net/bugs/1793086
>
> == SRU Justification ==
> IBM reports the qethqoat tool fails.  qeth_query_oat_command() currently
> allocates the kernel buffer for the SIOC_QETH_QUERY_OAT ioctl with kzalloc.
>
> This commit will cause the use of vzalloc() instead of kzalloc(), backing
> the allocation with non-contiguous memory.
>
> Bionic and Cosmic also need this commit, but they are clean cherry picks
> so have been SRU'd separatly.
>
> == Fix ==
> aec45e857c55 ("s390/qeth: use vzalloc for QUERY OAT buffer")
>
> == Regression Potential ==
> Low, limited to s390.
>
> == Test Case ==
> IBM verified testing of this commit up-front.
>
> Wenjia Zhang (1):
>   s390/qeth: use vzalloc for QUERY OAT buffer
>
>  drivers/s390/net/qeth_core_main.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>

Applied to xenial/master-next branch.

Thanks,
Kleber

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team