X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-ust-comm.c;h=0a3de32263c068fbffa7c2968218df8dcc14c8a9;hb=4fb0740e68171e050c744b50a5607a25e6b3f472;hp=e1426139d064984decf8066c6d096e121b556d7c;hpb=3ad4bc8722d657273c31c357c73a2a03c4964132;p=lttng-ust.git diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index e1426139..0a3de322 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -576,13 +576,13 @@ int handle_message(struct sock_info *sock_info, if (ust_lock()) { ret = -LTTNG_UST_ERR_EXITING; - goto end; + goto error; } ops = objd_ops(lum->handle); if (!ops) { ret = -ENOENT; - goto end; + goto error; } switch (lum->cmd) { @@ -643,12 +643,12 @@ int handle_message(struct sock_info *sock_info, } ret = len; free(bytecode); - goto end; + goto error; } else { DBG("incorrect filter data message size: %zd", len); ret = -EINVAL; free(bytecode); - goto end; + goto error; } } bytecode->bc.len = lum->u.filter.data_size; @@ -708,12 +708,12 @@ int handle_message(struct sock_info *sock_info, } ret = len; free(node); - goto end; + goto error; } else { DBG("Incorrect exclusion data message size: %zd", len); ret = -EINVAL; free(node); - goto end; + goto error; } } if (ops->cmd) { @@ -754,11 +754,11 @@ int handle_message(struct sock_info *sock_info, goto error; } ret = len; - goto end; + goto error; } else { DBG("incorrect channel data message size: %zd", len); ret = -EINVAL; - goto end; + goto error; } } args.channel.chan_data = chan_data; @@ -779,7 +779,7 @@ int handle_message(struct sock_info *sock_info, &args.stream.shm_fd, &args.stream.wakeup_fd); if (ret) { - goto end; + goto error; } if (ops->cmd) ret = ops->cmd(lum->handle, lum->cmd, @@ -799,7 +799,6 @@ int handle_message(struct sock_info *sock_info, break; } -end: lur.handle = lum->handle; lur.cmd = lum->cmd; lur.ret_val = ret; @@ -1400,7 +1399,13 @@ restart: print_cmd(lum.cmd, lum.handle); ret = handle_message(sock_info, sock, &lum); if (ret) { - ERR("Error handling message for %s socket", sock_info->name); + ERR("Error handling message for %s socket", + sock_info->name); + /* + * Close socket if protocol error is + * detected. + */ + goto end; } continue; default: