Commit 989f26f5ad308f40a95f280bf9cd75e558d4f18d

Authored by Joe Thornber
Committed by Mike Snitzer
1 parent af91805a49

dm era: check for a non-NULL metadata object before closing it

era_ctr() may call era_destroy() before era->md is initialized so
era_destory() must only close the metadata object if it is not NULL.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Naohiro Aota <naota@elisp.net>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # 3.15+

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

drivers/md/dm-era-target.c
... ... @@ -1391,7 +1391,8 @@
1391 1391  
1392 1392 static void era_destroy(struct era *era)
1393 1393 {
1394   - metadata_close(era->md);
  1394 + if (era->md)
  1395 + metadata_close(era->md);
1395 1396  
1396 1397 if (era->wq)
1397 1398 destroy_workqueue(era->wq);