Re: [RFC] Hack to use mkdir/rmdir in debugfs

From: Steven Rostedt
Date: Tue Jan 22 2013 - 23:48:17 EST


On Tue, 2013-01-22 at 23:44 -0500, Steven Rostedt wrote:

> + ret = event_trace_add_tracer(tr->dir, tr);
> + if (ret)
> + goto out_free_tr;
> +
> + init_tracer_debugfs(tr, tr->dir);
> +
> + mutex_unlock(&trace_types_lock);
> +
> + list_add(&tr->list, &ftrace_trace_arrays);

I just noticed this bug :-)

The list_add() needs to be inside the mutex protection. This code use to
be within the trace_new_instance_write(), and I just moved it into its
own function. Must have been where I screwed up.

-- Steve

> +
> + return 0;
> +
> + out_free_tr:
> + if (tr->buffer)
> + ring_buffer_free(tr->buffer);
> + kfree(tr->name);
> + kfree(tr);
> +
> + out_unlock:
> + mutex_unlock(&trace_types_lock);
> +
> + return ret;
> +
> +}
> +

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/