1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Don't deref uninitialized log_lv upon failed mirror addition.

* mirror.c (add_mirror_images): Ensure that log_lv is initialized.
This commit is contained in:
Jim Meyering 2008-06-13 12:15:55 +00:00
parent b1f8aa24ca
commit ac27ef2593
2 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.39 - Version 2.02.39 -
================================ ================================
Fix add_mirror_images not to dereference uninitialized log_lv upon failure.
Don't call openlog for every debug line output by clvmd. Don't call openlog for every debug line output by clvmd.
Add --force to lvextend and lvresize. Add --force to lvextend and lvresize.
Fix vgchange to not activate mirror leg and log volumes directly. Fix vgchange to not activate mirror leg and log volumes directly.

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved. * Copyright (C) 2003-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
* *
* This file is part of LVM2. * This file is part of LVM2.
* *
@ -1344,7 +1344,8 @@ int add_mirror_images(struct cmd_context *cmd, struct logical_volume *lv,
struct alloc_handle *ah; struct alloc_handle *ah;
const struct segment_type *segtype; const struct segment_type *segtype;
struct list *parallel_areas; struct list *parallel_areas;
struct logical_volume **img_lvs, *log_lv; struct logical_volume **img_lvs;
struct logical_volume *log_lv = NULL;
if (stripes > 1) { if (stripes > 1) {
log_error("stripes > 1 is not supported"); log_error("stripes > 1 is not supported");
@ -1416,8 +1417,8 @@ int add_mirror_images(struct cmd_context *cmd, struct logical_volume *lv,
return 1; return 1;
out_remove_log: out_remove_log:
if (!lv_remove(log_lv) || !vg_write(log_lv->vg) || if (log_lv && (!lv_remove(log_lv) || !vg_write(log_lv->vg) ||
(backup(log_lv->vg), !vg_commit(log_lv->vg))) (backup(log_lv->vg), !vg_commit(log_lv->vg))))
log_error("Manual intervention may be required to remove " log_error("Manual intervention may be required to remove "
"abandoned log LV before retrying."); "abandoned log LV before retrying.");