Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drivers/atm/atmtcp.c: add missing atm_dev_put

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>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Julia Lawall and committed by
David S. Miller
b9556f9a f4d5900a

+4 -1
+4 -1
drivers/atm/atmtcp.c
··· 392 392 atm_dev_put(dev); 393 393 return -EMEDIUMTYPE; 394 394 } 395 - if (PRIV(dev)->vcc) return -EBUSY; 395 + if (PRIV(dev)->vcc) { 396 + atm_dev_put(dev); 397 + return -EBUSY; 398 + } 396 399 } 397 400 else { 398 401 int error;