Prevent access after free to table entry in case when

user deletes partition that not yet created (changes doesn't
committed to disk).

PR:		148687
Approved by:	mav (mentor)
MFC after:	7 days
This commit is contained in:
Andrey V. Elsukov 2010-07-23 06:30:01 +00:00
parent 2bacd082bd
commit 733a9e2783

View File

@ -830,14 +830,6 @@ g_part_ctl_delete(struct gctl_req *req, struct g_part_parms *gpp)
entry->gpe_pp = NULL;
}
if (entry->gpe_created) {
LIST_REMOVE(entry, gpe_entry);
g_free(entry);
} else {
entry->gpe_modified = 0;
entry->gpe_deleted = 1;
}
if (pp != NULL)
g_wither_provider(pp, ENXIO);
@ -850,6 +842,14 @@ g_part_ctl_delete(struct gctl_req *req, struct g_part_parms *gpp)
gctl_set_param(req, "output", sbuf_data(sb), sbuf_len(sb) + 1);
sbuf_delete(sb);
}
if (entry->gpe_created) {
LIST_REMOVE(entry, gpe_entry);
g_free(entry);
} else {
entry->gpe_modified = 0;
entry->gpe_deleted = 1;
}
return (0);
}