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

Fix potential null ptr deref in 'origin_from_cow'

return NULL rather than segfaulting if lv->snapshot is not set
This commit is contained in:
Jonathan Earl Brassow 2011-07-19 16:23:52 +00:00
parent 9796bd4db6
commit aa6599e687

View File

@ -81,7 +81,9 @@ struct lv_segment *find_cow(const struct logical_volume *lv)
/* Given a cow LV, return its origin */ /* Given a cow LV, return its origin */
struct logical_volume *origin_from_cow(const struct logical_volume *lv) struct logical_volume *origin_from_cow(const struct logical_volume *lv)
{ {
return lv->snapshot->origin; if (lv->snapshot)
return lv->snapshot->origin;
return NULL;
} }
void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin, void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin,