MFC r274791:

Add missing error checking for kernel_port_{add,remove}().  Both can fail
for reasons yet unknown; don't make it increment cumulated_error as a kind
of temporary workaround.

MFC r275399:

Fix null pointer dereference.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
trasz 2015-01-26 13:21:30 +00:00
parent 9aa94c3abb
commit 13678d19f2

View File

@ -1680,7 +1680,16 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
cumulated_error++;
}
}
kernel_port_remove(oldtarg);
error = kernel_port_remove(oldtarg);
if (error != 0) {
log_warnx("failed to remove target %s",
oldtarg->t_name);
/*
* XXX: Uncomment after fixing the root cause.
*
* cumulated_error++;
*/
}
continue;
}
@ -1814,8 +1823,18 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
cumulated_error++;
}
}
if (oldtarg == NULL)
kernel_port_add(newtarg);
if (oldtarg == NULL) {
error = kernel_port_add(newtarg);
if (error != 0) {
log_warnx("failed to add target %s",
newtarg->t_name);
/*
* XXX: Uncomment after fixing the root cause.
*
* cumulated_error++;
*/
}
}
}
/*