mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers/md: fix potential memleak
@ 2021-11-15  3:18 Bernard Zhao
  2021-11-17  7:06 ` Song Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Bernard Zhao @ 2021-11-15  3:18 UTC (permalink / raw)
  To: Song Liu, linux-raid, linux-kernel; +Cc: Bernard Zhao

In function get_bitmap_from_slot, when md_bitmap_create failed,
md_bitmap_destroy must be called to do clean up.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 drivers/md/md-bitmap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index bfd6026d7809..a227bd0b9301 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -1961,6 +1961,7 @@ struct bitmap *get_bitmap_from_slot(struct mddev *mddev, int slot)
 	bitmap = md_bitmap_create(mddev, slot);
 	if (IS_ERR(bitmap)) {
 		rv = PTR_ERR(bitmap);
+		md_bitmap_destroy(mddev)
 		return ERR_PTR(rv);
 	}
 
-- 
2.33.1


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

end of thread, other threads:[~2021-11-20  7:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15  3:18 [PATCH] drivers/md: fix potential memleak Bernard Zhao
2021-11-17  7:06 ` Song Liu
     [not found] ` <AE6ABwAlE-AV3TdOtnvxCKoI.9.1637132794891.Hmail.bernard@vivo.com.@PENBUGhzdVc2dWk9d0JyVG9Za3FFT3BMeUxZaGpITW95MG1MMFVNY1hucTBPYktMTGhvQUBtYWlsLmdtYWlsLmNvbT4=>
2021-11-17  7:57   ` 答复: " 赵军奎
2021-11-20  7:23     ` Song Liu
2021-11-17 16:44 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®