Fix segfault when stoping a kernel session that does not exist
authorDavid Goulet <david.goulet@polymtl.ca>
Thu, 26 May 2011 19:12:44 +0000 (15:12 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Thu, 26 May 2011 19:12:44 +0000 (15:12 -0400)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
liblttsessiondcomm/liblttsessiondcomm.c
liblttsessiondcomm/liblttsessiondcomm.h
ltt-sessiond/main.c

index d1e38898501c7ab74a60c36199a087e69c6466ee..ff14d7879af94300f271bcd4a1d5fa69f643bbc1 100644 (file)
@@ -60,6 +60,7 @@ static const char *lttcomm_readable_code[] = {
        [ LTTCOMM_ERR_INDEX(LTTCOMM_KERN_STREAM_FAIL) ] = "Kernel create stream failed",
        [ LTTCOMM_ERR_INDEX(LTTCOMM_KERN_DIR_FAIL) ] = "Kernel trace directory creation failed",
        [ LTTCOMM_ERR_INDEX(LTTCOMM_KERN_DIR_EXIST) ] = "Kernel trace directory already exist",
+       [ LTTCOMM_ERR_INDEX(LTTCOMM_KERN_NO_SESSION) ] = "No kernel session found",
        [ LTTCOMM_ERR_INDEX(KCONSUMERD_COMMAND_SOCK_READY) ] = "Kconsumerd command socket ready",
        [ LTTCOMM_ERR_INDEX(KCONSUMERD_SUCCESS_RECV_FD) ] = "Kconsumerd success on receiving fds",
        [ LTTCOMM_ERR_INDEX(KCONSUMERD_ERROR_RECV_FD) ] = "Kconsumerd error on receiving fds",
index 46469f15d6d86225b21cb43efe3acefbeab0230f..6c46ac2553908fa18fe248e0dafe38c8bc7556f0 100644 (file)
@@ -113,7 +113,8 @@ enum lttcomm_return_code {
        LTTCOMM_KERN_CONSUMER_FAIL,             /* Kernel consumer start failed */
        LTTCOMM_KERN_STREAM_FAIL,               /* Kernel create stream failed */
        LTTCOMM_KERN_DIR_FAIL,                  /* Kernel trace directory creation failed */
-       LTTCOMM_KERN_DIR_EXIST,                 /* Kernel traec directory exist */
+       LTTCOMM_KERN_DIR_EXIST,                 /* Kernel trace directory exist */
+       LTTCOMM_KERN_NO_SESSION,                /* No kernel session found */
        KCONSUMERD_COMMAND_SOCK_READY,  /* when kconsumerd command socket ready */
        KCONSUMERD_SUCCESS_RECV_FD,             /* success on receiving fds */
        KCONSUMERD_ERROR_RECV_FD,               /* error on receiving fds */
index 9fd5c1c75f2684489713d5c83131ad8a406f85cb..9df204939cd56877e4bfc96170808f52aad9d54c 100644 (file)
@@ -892,6 +892,11 @@ static int process_client_msg(struct command_ctx *cmd_ctx)
                        goto setup_error;
                }
 
+               if (cmd_ctx->session->kernel_session == NULL) {
+                       ret = LTTCOMM_KERN_NO_SESSION;
+                       goto error;
+               }
+
                DBG("Stop kernel tracing");
 
                ret = kernel_stop_session(cmd_ctx->session->kernel_session);
This page took 0.027708 seconds and 4 git commands to generate.