[Devel] [PATCH VZ9] disable high-order allocations warnings in slip driver

Vasily Averin vvs at virtuozzo.com
Fri Dec 31 12:20:56 MSK 2021


slip driver can trigger high-order allocations in sl_change_mtu(),
sl_alloc_bufs() and slhc_init().

https://jira.sw.ru/browse/PSBM-125232
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
(cherry picked from vz7 commit 42c0ed59307de123abaf795d4485ca87c83716cb)
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 drivers/net/slip/slhc.c |  4 ++--
 drivers/net/slip/slip.c | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/slip/slhc.c b/drivers/net/slip/slhc.c
index ba93bab948e0..e630a362ee96 100644
--- a/drivers/net/slip/slhc.c
+++ b/drivers/net/slip/slhc.c
@@ -104,7 +104,7 @@ slhc_init(int rslots, int tslots)
 
 	if (rslots > 0) {
 		size_t rsize = rslots * sizeof(struct cstate);
-		comp->rstate = kzalloc(rsize, GFP_KERNEL);
+		comp->rstate = kzalloc(rsize, GFP_KERNEL | __GFP_ORDER_NOWARN);
 		if (! comp->rstate)
 			goto out_free;
 		comp->rslot_limit = rslots - 1;
@@ -112,7 +112,7 @@ slhc_init(int rslots, int tslots)
 
 	if (tslots > 0) {
 		size_t tsize = tslots * sizeof(struct cstate);
-		comp->tstate = kzalloc(tsize, GFP_KERNEL);
+		comp->tstate = kzalloc(tsize, GFP_KERNEL | __GFP_ORDER_NOWARN);
 		if (! comp->tstate)
 			goto out_free2;
 		comp->tslot_limit = tslots - 1;
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
index dc84cb844319..e104e4f71787 100644
--- a/drivers/net/slip/slip.c
+++ b/drivers/net/slip/slip.c
@@ -153,14 +153,14 @@ static int sl_alloc_bufs(struct slip *sl, int mtu)
 	 */
 	if (len < 576 * 2)
 		len = 576 * 2;
-	rbuff = kmalloc(len + 4, GFP_KERNEL);
+	rbuff = kmalloc(len + 4, GFP_KERNEL | __GFP_ORDER_NOWARN);
 	if (rbuff == NULL)
 		goto err_exit;
-	xbuff = kmalloc(len + 4, GFP_KERNEL);
+	xbuff = kmalloc(len + 4, GFP_KERNEL | __GFP_ORDER_NOWARN);
 	if (xbuff == NULL)
 		goto err_exit;
 #ifdef SL_INCLUDE_CSLIP
-	cbuff = kmalloc(len + 4, GFP_KERNEL);
+	cbuff = kmalloc(len + 4, GFP_KERNEL | __GFP_ORDER_NOWARN);
 	if (cbuff == NULL)
 		goto err_exit;
 	slcomp = slhc_init(16, 16);
@@ -235,10 +235,10 @@ static int sl_realloc_bufs(struct slip *sl, int mtu)
 	if (len < 576 * 2)
 		len = 576 * 2;
 
-	xbuff = kmalloc(len + 4, GFP_ATOMIC);
-	rbuff = kmalloc(len + 4, GFP_ATOMIC);
+	xbuff = kmalloc(len + 4, GFP_ATOMIC | __GFP_ORDER_NOWARN);
+	rbuff = kmalloc(len + 4, GFP_ATOMIC | __GFP_ORDER_NOWARN);
 #ifdef SL_INCLUDE_CSLIP
-	cbuff = kmalloc(len + 4, GFP_ATOMIC);
+	cbuff = kmalloc(len + 4, GFP_ATOMIC | __GFP_ORDER_NOWARN);
 #endif
 
 
-- 
2.25.1



More information about the Devel mailing list