public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm: check era->md is non-NULL before closing it
@ 2014-05-20  3:53 naota
  2014-05-20  7:41 ` Joe Thornber
  0 siblings, 1 reply; 2+ messages in thread
From: naota @ 2014-05-20  3:53 UTC (permalink / raw)
  To: Joe Thornber, dm-devel; +Cc: Alasdair Kergon, Mike Snitzer, linux-kernel

In era_ctr(), era->md remain NULL until it's set after metadata_open().
On the other hand, era_destroy() assume era->md is non-NULL and it is
called by era_ctr() before initializing the value.

This patch just checks if era->md is non-NULL.

Signed-off-by: Naohiro Aota <naota@elisp.net>
---
 drivers/md/dm-era-target.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-era-target.c b/drivers/md/dm-era-target.c
index 414dad4..ad913cd 100644
--- a/drivers/md/dm-era-target.c
+++ b/drivers/md/dm-era-target.c
@@ -1391,7 +1391,8 @@ static int era_is_congested(struct dm_target_callbacks *cb, int bdi_bits)
 
 static void era_destroy(struct era *era)
 {
-	metadata_close(era->md);
+	if (era->md)
+		metadata_close(era->md);
 
 	if (era->wq)
 		destroy_workqueue(era->wq);
-- 
1.9.2



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

end of thread, other threads:[~2014-05-20  7:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-20  3:53 [PATCH] dm: check era->md is non-NULL before closing it naota
2014-05-20  7:41 ` Joe Thornber

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