Skip to contentSkip to conversation

master - polldaemon: proper error check in _poll_vg fn

PATCH okozina 1 participant 1 message Mar 31, 2015

lore
Share & tools
lore

okozina

author
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=663254d7a5d84ef5803875806c461513f581f4e2
Commit:        663254d7a5d84ef5803875806c461513f581f4e2
Parent:        b9e6e66de15ca638ca504a07d6476e571a6197d3
Author:        Ondrej Kozina <[email protected]>
AuthorDate:    Tue Mar 31 11:26:53 2015 +0200
Committer:     Ondrej Kozina <[email protected]>
CommitterDate: Tue Mar 31 11:26:53 2015 +0200

polldaemon: proper error check in _poll_vg fn

could theoretically cause NULL pointer dereference

---
 tools/polldaemon.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/polldaemon.c +2 -2
index 5383812..20a18fa 100644
@@ -191,7 +191,7 @@ static int _wait_for_single_lv(struct cmd_context *cmd, const char *name, const
 static int _poll_vg(struct cmd_context *cmd, const char *vgname,
 		    struct volume_group *vg, struct processing_handle *handle)
 {
-	struct daemon_parms *parms = (struct daemon_parms *) handle->custom_handle;
+	struct daemon_parms *parms;
 	struct lv_list *lvl;
 	struct dm_list *sls;
 	struct dm_str_list *sl;
@@ -199,7 +199,7 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
 	const char *name;
 	int finished;
 
-	if (!parms) {
+	if (!handle || !(parms = (struct daemon_parms *) handle->custom_handle)) {
 		log_error(INTERNAL_ERROR "Handle is undefined.");
 		return ECMD_FAILED;
 	}