aio: use kmem_cache_free() instead of kfree()
authorWei Yongjun <weiyongjun1@huawei.com>
Thu, 4 Apr 2019 08:44:05 +0000 (08:44 +0000)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 5 Apr 2019 00:13:59 +0000 (20:13 -0400)
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>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/aio.c

index 7ccecaab487a16ffc33d4a8331398d047f2aaa82..3490d1fa0e16f4f1f189727661e18696ab3a7a08 100644 (file)
--- 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;
        }