diff options
author | Christophe Jaillet <christophe.jaillet@wanadoo.fr> | 2016-10-02 09:04:16 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-10-04 03:54:10 +0200 |
commit | b9118b7221ebb12156d2b08d4d5647bc6076d6bb (patch) | |
tree | 705219e736db000213d2a1433af24ccacc4b1de2 /drivers/ptp/ptp_clock.c | |
parent | net: qcom/emac: fix return value check in emac_sgmii_config() (diff) | |
download | linux-b9118b7221ebb12156d2b08d4d5647bc6076d6bb.tar.xz linux-b9118b7221ebb12156d2b08d4d5647bc6076d6bb.zip |
ptp: Fix resource leak in case of error
A call to 'ida_simple_remove()' is missing in the error handling path.
This as been spotted with the following coccinelle script which tries to
detect missing 'ida_simple_remove()' call in error handling paths.
///////////////
@@
expression x;
identifier l;
@@
* x = ida_simple_get(...);
...
if (...) {
...
}
...
if (...) {
...
goto l;
}
...
* l: ... when != ida_simple_remove(...);
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ptp/ptp_clock.c')
-rw-r--r-- | drivers/ptp/ptp_clock.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c index 2e481b9e8ea5..86280b7e41f3 100644 --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c @@ -263,6 +263,7 @@ no_sysfs: no_device: mutex_destroy(&ptp->tsevq_mux); mutex_destroy(&ptp->pincfg_mux); + ida_simple_remove(&ptp_clocks_map, index); no_slot: kfree(ptp); no_memory: |