[RHEL7,COMMIT] ib_srpt: replay the rework of buffer allocation

Submitted by Konstantin Khorenko on July 6, 2018, 10:01 a.m.

Details

Message ID 201807061001.w66A1nr8015259@finist_ce7.work
State New
Series "ib_srpt: replay the rework of buffer allocation"
Headers show

Commit Message

Konstantin Khorenko July 6, 2018, 10:01 a.m.
The commit is pushed to "branch-rh7-3.10.0-862.3.2.vz7.61.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.3.2.vz7.61.15
------>
commit 2bc433f07bf2482762587b86de0896a9aab05b03
Author: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
Date:   Fri Jul 6 13:01:49 2018 +0300

    ib_srpt: replay the rework of buffer allocation
    
    Previously, kfree was accidentally missed in srpt_alloc_ioctx_ring. Also, taking
    into the comments, kvmalloc now is used instead of vmalloc.
    
    Fixes: 479860d ("ib/srpt: use vmalloc to allocate ring pointers")
    
    https://jira.sw.ru/browse/HCI-100
    Signed-off-by: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 5bc8d57256e2..32b7fb71e62d 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -648,7 +648,7 @@  static struct srpt_ioctx **srpt_alloc_ioctx_ring(struct srpt_device *sdev,
 	WARN_ON(ioctx_size != sizeof(struct srpt_recv_ioctx)
 		&& ioctx_size != sizeof(struct srpt_send_ioctx));
 
-	ring = vmalloc(ring_size * sizeof(ring[0]));
+	ring = kvmalloc(ring_size * sizeof(ring[0]), GFP_KERNEL);
 	if (!ring)
 		goto out;
 	for (i = 0; i < ring_size; ++i) {
@@ -662,7 +662,7 @@  static struct srpt_ioctx **srpt_alloc_ioctx_ring(struct srpt_device *sdev,
 err:
 	while (--i >= 0)
 		srpt_free_ioctx(sdev, ring[i], dma_size, dir);
-	kfree(ring);
+	kvfree(ring);
 	ring = NULL;
 out:
 	return ring;
@@ -679,7 +679,7 @@  static void srpt_free_ioctx_ring(struct srpt_ioctx **ioctx_ring,
 
 	for (i = 0; i < ring_size; ++i)
 		srpt_free_ioctx(sdev, ioctx_ring[i], dma_size, dir);
-	vfree(ioctx_ring);
+	kvfree(ioctx_ring);
 }
 
 /**