diff options
author | sjur.brandeland@stericsson.com <sjur.brandeland@stericsson.com> | 2011-05-12 22:44:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-15 17:45:55 -0400 |
commit | cb3cb423a0f3c627639535e5d87977ae662d779f (patch) | |
tree | 37fae151f44b5549bf1d4fd437dd070315d78cad /net/caif/cfcnfg.c | |
parent | f36214408470ecf6a052e76b72d05b2328b60fcf (diff) |
caif: Add ref-count to framing layer
Introduce Per-cpu reference for lower part of CAIF Stack.
Before freeing payload is disabled, synchronize_rcu() is called,
and then ref-count verified to be zero.
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/caif/cfcnfg.c')
-rw-r--r-- | net/caif/cfcnfg.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c index 7892cc084e27..3f4f31fca2c1 100644 --- a/net/caif/cfcnfg.c +++ b/net/caif/cfcnfg.c | |||
@@ -519,6 +519,13 @@ int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer) | |||
519 | caif_assert(phy_layer->id == phyid); | 519 | caif_assert(phy_layer->id == phyid); |
520 | caif_assert(phyinfo->frm_layer->id == phyid); | 520 | caif_assert(phyinfo->frm_layer->id == phyid); |
521 | 521 | ||
522 | /* Fail if reference count is not zero */ | ||
523 | if (cffrml_refcnt_read(phyinfo->frm_layer) != 0) { | ||
524 | pr_info("Wait for device inuse\n"); | ||
525 | mutex_unlock(&cnfg->lock); | ||
526 | return -EAGAIN; | ||
527 | } | ||
528 | |||
522 | list_del_rcu(&phyinfo->node); | 529 | list_del_rcu(&phyinfo->node); |
523 | synchronize_rcu(); | 530 | synchronize_rcu(); |
524 | 531 | ||
@@ -537,7 +544,7 @@ int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer) | |||
537 | if (phyinfo->phy_layer != frml_dn) | 544 | if (phyinfo->phy_layer != frml_dn) |
538 | kfree(frml_dn); | 545 | kfree(frml_dn); |
539 | 546 | ||
540 | kfree(frml); | 547 | cffrml_free(frml); |
541 | kfree(phyinfo); | 548 | kfree(phyinfo); |
542 | mutex_unlock(&cnfg->lock); | 549 | mutex_unlock(&cnfg->lock); |
543 | 550 | ||