IB/rxe: replace kvfree with vfree
authorZhu Yanjun <yanjun.zhu@oracle.com>
Sun, 30 Sep 2018 05:57:42 +0000 (01:57 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jan 2020 09:24:01 +0000 (10:24 +0100)
[ Upstream commit 721ad7e643f7002efa398838693f90284ea216d1 ]

The buf is allocated by vmalloc_user in the function rxe_queue_init.
So it is better to free it by vfree.

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/sw/rxe/rxe_cq.c
drivers/infiniband/sw/rxe/rxe_qp.c

index e5e6a5e7dee9c36d90ab98b0720df276ab38fa68..5ac88412f1ffedd40067b920090068732c62b2dd 100644 (file)
@@ -30,7 +30,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-
+#include <linux/vmalloc.h>
 #include "rxe.h"
 #include "rxe_loc.h"
 #include "rxe_queue.h"
@@ -89,7 +89,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe,
        err = do_mmap_info(rxe, udata, false, context, cq->queue->buf,
                           cq->queue->buf_size, &cq->queue->ip);
        if (err) {
-               kvfree(cq->queue->buf);
+               vfree(cq->queue->buf);
                kfree(cq->queue);
                return err;
        }
index 44b2108253bd988ec1f5222da999575ed37d3bed..d6672127808b7216f2745e2285c55f7150eacbca 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/skbuff.h>
 #include <linux/delay.h>
 #include <linux/sched.h>
+#include <linux/vmalloc.h>
 
 #include "rxe.h"
 #include "rxe_loc.h"
@@ -255,7 +256,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp,
                           qp->sq.queue->buf_size, &qp->sq.queue->ip);
 
        if (err) {
-               kvfree(qp->sq.queue->buf);
+               vfree(qp->sq.queue->buf);
                kfree(qp->sq.queue);
                return err;
        }
@@ -312,7 +313,7 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp,
                                   qp->rq.queue->buf_size,
                                   &qp->rq.queue->ip);
                if (err) {
-                       kvfree(qp->rq.queue->buf);
+                       vfree(qp->rq.queue->buf);
                        kfree(qp->rq.queue);
                        return err;
                }