1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-18 02:19:39 +00:00

rtadvd(8): Fix use-after-close in cm_handler_client

cm_send() closes 'fd' on error.  In that case, bail out early without trying to
recv from or close 'fd' again.

Reported by:	Coverity
CID:		1006078
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Conrad Meyer 2016-05-12 05:12:24 +00:00
parent 5ecc225fc5
commit a09a9cbb40
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=299515

View File

@ -92,9 +92,11 @@ cm_handler_client(int fd, int state, char *buf_orig)
case CM_STATE_MSG_DISPATCH: case CM_STATE_MSG_DISPATCH:
cm->cm_version = CM_VERSION; cm->cm_version = CM_VERSION;
error = cm_send(fd, buf); error = cm_send(fd, buf);
if (error) if (error) {
syslog(LOG_WARNING, syslog(LOG_WARNING,
"<%s> cm_send()", __func__); "<%s> cm_send()", __func__);
return (-1);
}
state = CM_STATE_ACK_WAIT; state = CM_STATE_ACK_WAIT;
break; break;
case CM_STATE_ACK_WAIT: case CM_STATE_ACK_WAIT: