diff mbox series

aio: use kmem_cache_free() instead of kfree()

Message ID 20190404084405.47992-1-weiyongjun1@huawei.com (mailing list archive)
State New, archived
Headers show
Series aio: use kmem_cache_free() instead of kfree() | expand

Commit Message

Wei Yongjun April 4, 2019, 8:44 a.m. UTC
memory allocated by kmem_cache_alloc() should be freed using
kmem_cache_free(), not kfree().

Fixes: fa0ca2aee3be ("deal with get_reqs_available() in aio_get_req() itself")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 fs/aio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Al Viro April 5, 2019, 12:14 a.m. UTC | #1
On Thu, Apr 04, 2019 at 08:44:05AM +0000, Wei Yongjun wrote:
> memory allocated by kmem_cache_alloc() should be freed using
> kmem_cache_free(), not kfree().
> 
> Fixes: fa0ca2aee3be ("deal with get_reqs_available() in aio_get_req() itself")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied
diff mbox series

Patch

diff --git a/fs/aio.c b/fs/aio.c
index a4cc2a1cccb7..93b1252d7f3c 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1034,7 +1034,7 @@  static inline struct aio_kiocb *aio_get_req(struct kioctx *ctx)
 		return NULL;
 
 	if (unlikely(!get_reqs_available(ctx))) {
-		kfree(req);
+		kmem_cache_free(kiocb_cachep, req);
 		return NULL;
 	}