lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 18 Jul 2013 13:59:54 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Alexander Z Lam <azl@...gle.com>
Cc:	linux-kernel@...r.kernel.org, David Sharp <dhsharp@...gle.com>,
	Vaibhav Nagarnaik <vnagarnaik@...gle.com>,
	Alexander Z Lam <lambchop468@...il.com>
Subject: Re: [PATCH v2] tracing: Miscellaneous fixes for trace_array ref
 counting

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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ