Re: [PATCH v2] tracing: Miscellaneous fixes for trace_array refcounting
From: Steven Rostedt
Date: Thu Jul 18 2013 - 14:00:01 EST
On Thu, 2013-07-18 at 10:47 -0700, Alexander Z Lam wrote:
>
> static const struct file_operations tracing_iter_fops = {
> @@ -3958,7 +3965,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
> iter = kzalloc(sizeof(*iter), GFP_KERNEL);
> if (!iter) {
> ret = -ENOMEM;
> - goto out;
> + goto fail_iter;
> }
>
> /*
> @@ -3968,13 +3975,13 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
> iter->trace = kmalloc(sizeof(*iter->trace), GFP_KERNEL);
> if (!iter->trace) {
> ret = -ENOMEM;
> - goto fail;
> + goto fail_trace;
> }
> *iter->trace = *tr->current_trace;
>
> if (!alloc_cpumask_var(&iter->started, GFP_KERNEL)) {
> ret = -ENOMEM;
> - goto fail;
> + goto fail_trace;
> }
>
> /* trace pipe does not show start of buffer */
> @@ -4001,9 +4008,10 @@ out:
> mutex_unlock(&trace_types_lock);
> return ret;
>
> -fail:
> +fail_trace:
> kfree(iter->trace);
> kfree(iter);
> +fail_iter:
> __trace_array_put(tr);
> mutex_unlock(&trace_types_lock);
> return ret;
You missed my comment about not adding the extra label. The only change
to the code above should have been:
if (!iter) {
ret = -ENOMEM;
+ __trace_array_put(tr);
goto out;
}
A one liner.
-- Steve
--
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/