* [PATCH -next] gfs2: use kmem_cache_free() instead of kfree()
@ 2021-04-09 8:29 ` Wei Yongjun
0 siblings, 0 replies; 4+ messages in thread
From: Wei Yongjun @ 2021-04-09 8:29 UTC (permalink / raw)
To: weiyongjun1, Bob Peterson, Andreas Gruenbacher
Cc: cluster-devel, linux-kernel, kernel-janitors, Hulk Robot
memory allocated by kmem_cache_alloc() should be freed using
kmem_cache_free(), not kfree().
Fixes: 7d6eec37a105 ("gfs2: Allocate bufdata object before taking log lock")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
fs/gfs2/trans.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index c50de22d7cbf..1b47d08ac4fb 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -206,7 +206,7 @@ void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh)
}
gfs2_log_lock(sdp);
if (bh->b_private) {
- kfree(bd);
+ kmem_cache_free(gfs2_bufdata_cachep, bd);
bd = bh->b_private;
} else {
bh->b_private = bd;
@@ -246,12 +246,12 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
}
gfs2_log_lock(sdp);
if (bh->b_private) {
- kfree(bd);
+ kmem_cache_free(gfs2_bufdata_cachep, bd);
bd = bh->b_private;
} else {
lock_page(bh->b_page);
if (bh->b_private) {
- kfree(bd);
+ kmem_cache_free(gfs2_bufdata_cachep, bd);
bd = bh->b_private;
} else {
bh->b_private = bd;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH -next] gfs2: use kmem_cache_free() instead of kfree()
@ 2021-04-09 8:29 ` Wei Yongjun
0 siblings, 0 replies; 4+ messages in thread
From: Wei Yongjun @ 2021-04-09 8:29 UTC (permalink / raw)
To: cluster-devel.redhat.com
memory allocated by kmem_cache_alloc() should be freed using
kmem_cache_free(), not kfree().
Fixes: 7d6eec37a105 ("gfs2: Allocate bufdata object before taking log lock")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
fs/gfs2/trans.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index c50de22d7cbf..1b47d08ac4fb 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -206,7 +206,7 @@ void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh)
}
gfs2_log_lock(sdp);
if (bh->b_private) {
- kfree(bd);
+ kmem_cache_free(gfs2_bufdata_cachep, bd);
bd = bh->b_private;
} else {
bh->b_private = bd;
@@ -246,12 +246,12 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
}
gfs2_log_lock(sdp);
if (bh->b_private) {
- kfree(bd);
+ kmem_cache_free(gfs2_bufdata_cachep, bd);
bd = bh->b_private;
} else {
lock_page(bh->b_page);
if (bh->b_private) {
- kfree(bd);
+ kmem_cache_free(gfs2_bufdata_cachep, bd);
bd = bh->b_private;
} else {
bh->b_private = bd;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next] gfs2: use kmem_cache_free() instead of kfree()
2021-04-09 8:29 ` [Cluster-devel] " Wei Yongjun
@ 2021-04-09 8:34 ` Andreas Grünbacher
-1 siblings, 0 replies; 4+ messages in thread
From: Andreas Grünbacher @ 2021-04-09 8:34 UTC (permalink / raw)
To: Wei Yongjun
Cc: Bob Peterson, Andreas Gruenbacher, cluster-devel,
Linux Kernel Mailing List, kernel-janitors, Hulk Robot
Hi,
Am Fr., 9. Apr. 2021 um 10:20 Uhr schrieb Wei Yongjun <weiyongjun1@huawei.com>:
> memory allocated by kmem_cache_alloc() should be freed using
> kmem_cache_free(), not kfree().
thanks for the patch, that's true. This patch has turned out to have
other problems as well, so we've pulled it and Bob is currently
investigating.
Andreas
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH -next] gfs2: use kmem_cache_free() instead of kfree()
@ 2021-04-09 8:34 ` Andreas Grünbacher
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Grünbacher @ 2021-04-09 8:34 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
Am Fr., 9. Apr. 2021 um 10:20 Uhr schrieb Wei Yongjun <weiyongjun1@huawei.com>:
> memory allocated by kmem_cache_alloc() should be freed using
> kmem_cache_free(), not kfree().
thanks for the patch, that's true. This patch has turned out to have
other problems as well, so we've pulled it and Bob is currently
investigating.
Andreas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-09 8:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 8:29 [PATCH -next] gfs2: use kmem_cache_free() instead of kfree() Wei Yongjun
2021-04-09 8:29 ` [Cluster-devel] " Wei Yongjun
2021-04-09 8:34 ` Andreas Grünbacher
2021-04-09 8:34 ` [Cluster-devel] " Andreas Grünbacher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.