RDMA/srpt: Use kmem_cache_free() instead of kfree()
authorWei Yongjun <weiyongjun1@huawei.com>
Sat, 22 Dec 2018 10:30:30 +0000 (10:30 +0000)
committerJason Gunthorpe <jgg@mellanox.com>
Sat, 22 Dec 2018 23:07:47 +0000 (16:07 -0700)
memory allocated by kmem_cache_alloc() should be freed using
kmem_cache_free(), not kfree().

Fixes: 5dabcd0456d7 ("RDMA/srpt: Add support for immediate data")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/ulp/srpt/ib_srpt.c

index b2f63a6dadb68ba3ceec84e6e9204c686be0b43e..e75c908e4bc280571d50afa5c13ab6d5ad9140c2 100644 (file)
@@ -674,7 +674,7 @@ static struct srpt_ioctx *srpt_alloc_ioctx(struct srpt_device *sdev,
        return ioctx;
 
 err_free_buf:
-       kfree(ioctx->buf);
+       kmem_cache_free(buf_cache, ioctx->buf);
 err_free_ioctx:
        kfree(ioctx);
 err: