lkml.org 
[lkml]   [2014]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] dm: check era->md is non-NULL before closing it
Date
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



\
 
 \ /
  Last update: 2014-05-20 06:41    [W:0.076 / U:1.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site