1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-30 10:50:34 +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 8e5d1c93eb
commit e1154dd09e

View File

@ -81,7 +81,9 @@ struct lv_segment *find_cow(const struct logical_volume *lv)
/* Given a cow LV, return its origin */
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,