linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] aio: use kmem_cache_free() instead of kfree()
@ 2019-04-04  8:44 Wei Yongjun
  2019-04-05  0:14 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2019-04-04  8:44 UTC (permalink / raw)
  To: Benjamin LaHaise, Alexander Viro
  Cc: Wei Yongjun, linux-aio, linux-fsdevel, kernel-janitors

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(-)

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;
 	}




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] aio: use kmem_cache_free() instead of kfree()
  2019-04-04  8:44 [PATCH] aio: use kmem_cache_free() instead of kfree() Wei Yongjun
@ 2019-04-05  0:14 ` Al Viro
  0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2019-04-05  0:14 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Benjamin LaHaise, linux-aio, linux-fsdevel, kernel-janitors

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-05  0:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-04  8:44 [PATCH] aio: use kmem_cache_free() instead of kfree() Wei Yongjun
2019-04-05  0:14 ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).