All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/atm/atmtcp.c: add missing atm_dev_put
@ 2010-12-29 14:01 ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2010-12-29 14:01 UTC (permalink / raw)
  To: Chas Williams, linux-atm-general, netdev, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

The earlier call to atm_dev_lookup increases the reference count of dev,
so decrease it on the way out.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x, E;
constant C;
@@

x = atm_dev_lookup(...);
... when != false x != NULL
    when != true x == NULL
    when != \(E = x\|x = E\)
    when != atm_dev_put(dev);
*return -C;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/atm/atmtcp.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index 2b464b6..0b06250 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -392,7 +392,10 @@ static int atmtcp_attach(struct atm_vcc *vcc,int itf)
 			atm_dev_put(dev);
 			return -EMEDIUMTYPE;
 		}
-		if (PRIV(dev)->vcc) return -EBUSY;
+		if (PRIV(dev)->vcc) {
+			atm_dev_put(dev);
+			return -EBUSY;
+		}
 	}
 	else {
 		int error;

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

* [PATCH] drivers/atm/atmtcp.c: add missing atm_dev_put
@ 2010-12-29 14:01 ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2010-12-29 14:01 UTC (permalink / raw)
  To: Chas Williams, linux-atm-general, netdev, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

The earlier call to atm_dev_lookup increases the reference count of dev,
so decrease it on the way out.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x, E;
constant C;
@@

x = atm_dev_lookup(...);
... when != false x != NULL
    when != true x = NULL
    when != \(E = x\|x = E\)
    when != atm_dev_put(dev);
*return -C;
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/atm/atmtcp.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index 2b464b6..0b06250 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -392,7 +392,10 @@ static int atmtcp_attach(struct atm_vcc *vcc,int itf)
 			atm_dev_put(dev);
 			return -EMEDIUMTYPE;
 		}
-		if (PRIV(dev)->vcc) return -EBUSY;
+		if (PRIV(dev)->vcc) {
+			atm_dev_put(dev);
+			return -EBUSY;
+		}
 	}
 	else {
 		int error;

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

* Re: [PATCH] drivers/atm/atmtcp.c: add missing atm_dev_put
  2010-12-29 14:01 ` Julia Lawall
@ 2010-12-31 20:52   ` David Miller
  -1 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-12-31 20:52 UTC (permalink / raw)
  To: julia; +Cc: chas, linux-atm-general, netdev, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>
Date: Wed, 29 Dec 2010 15:01:03 +0100 (CET)

> From: Julia Lawall <julia@diku.dk>
> 
> The earlier call to atm_dev_lookup increases the reference count of dev,
> so decrease it on the way out.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
 ...
> Signed-off-by: Julia Lawall <julia@diku.dk>

Applied, thank you.

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

* Re: [PATCH] drivers/atm/atmtcp.c: add missing atm_dev_put
@ 2010-12-31 20:52   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-12-31 20:52 UTC (permalink / raw)
  To: julia; +Cc: chas, linux-atm-general, netdev, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>
Date: Wed, 29 Dec 2010 15:01:03 +0100 (CET)

> From: Julia Lawall <julia@diku.dk>
> 
> The earlier call to atm_dev_lookup increases the reference count of dev,
> so decrease it on the way out.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
 ...
> Signed-off-by: Julia Lawall <julia@diku.dk>

Applied, thank you.

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

end of thread, other threads:[~2010-12-31 20:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-29 14:01 [PATCH] drivers/atm/atmtcp.c: add missing atm_dev_put Julia Lawall
2010-12-29 14:01 ` Julia Lawall
2010-12-31 20:52 ` David Miller
2010-12-31 20:52   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.