From: Bernard Zhao <bernard@vivo.com>
To: Song Liu <song@kernel.org>,
linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Bernard Zhao <bernard@vivo.com>
Subject: [PATCH] drivers/md: fix potential memleak
Date: Sun, 14 Nov 2021 19:18:17 -0800 [thread overview]
Message-ID: <20211115031817.4193-1-bernard@vivo.com> (raw)
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
next reply other threads:[~2021-11-15 3:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 3:18 Bernard Zhao [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211115031817.4193-1-bernard@vivo.com \
--to=bernard@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®