netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] openvswitch: small potential memory leak in ovs_vport_alloc()
@ 2011-12-06  6:27 Dan Carpenter
       [not found] ` <20111206062707.GA8433-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2011-12-06  6:27 UTC (permalink / raw)
  To: Jesse Gross
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA, David S. Miller

We're unlikely to hit this leak, but the static checkers complain if we
don't take care of it.

Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 6cd7601..7f0ef37 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -127,8 +127,10 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
 	vport->ops = ops;
 
 	vport->percpu_stats = alloc_percpu(struct vport_percpu_stats);
-	if (!vport->percpu_stats)
+	if (!vport->percpu_stats) {
+		kfree(vport);
 		return ERR_PTR(-ENOMEM);
+	}
 
 	spin_lock_init(&vport->stats_lock);
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] openvswitch: small potential memory leak in ovs_vport_alloc()
       [not found] ` <20111206062707.GA8433-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
@ 2011-12-06 17:32   ` Jesse Gross
       [not found]     ` <CAEP_g=_McLiPzKMM-9PGqddsYe7q6jYkCyAJcE1MU=Q4_Fou4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Jesse Gross @ 2011-12-06 17:32 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA, David S. Miller

On Mon, Dec 5, 2011 at 10:27 PM, Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> wrote:
> We're unlikely to hit this leak, but the static checkers complain if we
> don't take care of it.
>
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

Acked-by: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>

Thanks Dan.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] openvswitch: small potential memory leak in ovs_vport_alloc()
       [not found]     ` <CAEP_g=_McLiPzKMM-9PGqddsYe7q6jYkCyAJcE1MU=Q4_Fou4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-12-06 17:59       ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2011-12-06 17:59 UTC (permalink / raw)
  To: jesse-l0M0P4e3n4LQT0dZR+AlfA
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA

From: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
Date: Tue, 6 Dec 2011 09:32:13 -0800

> On Mon, Dec 5, 2011 at 10:27 PM, Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> wrote:
>> We're unlikely to hit this leak, but the static checkers complain if we
>> don't take care of it.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> 
> Acked-by: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-06 17:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-06  6:27 [patch] openvswitch: small potential memory leak in ovs_vport_alloc() Dan Carpenter
     [not found] ` <20111206062707.GA8433-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
2011-12-06 17:32   ` Jesse Gross
     [not found]     ` <CAEP_g=_McLiPzKMM-9PGqddsYe7q6jYkCyAJcE1MU=Q4_Fou4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-12-06 17:59       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).