From: Jukka Rissanen Date: Wed, 18 Jun 2014 13:37:10 +0000 (+0300) Subject: Bluetooth: 6LoWPAN: Count module usage X-Git-Tag: v3.17-rc1~106^2~73^2~87^2~180 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=18d93c176641cf7a3c0c452a6f03f46b5373d370;p=~emulex%2Finfiniband.git Bluetooth: 6LoWPAN: Count module usage Count how many 6LoWPAN connections there exists so that we do not unload the module if there are still connections alive. Signed-off-by: Jukka Rissanen Signed-off-by: Marcel Holtmann --- diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index ceffe20fcba..ba6c6416368 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -100,6 +100,8 @@ static inline bool peer_del(struct lowpan_dev *dev, struct lowpan_peer *peer) { list_del(&peer->list); + module_put(THIS_MODULE); + if (atomic_dec_and_test(&dev->peer_count)) { BT_DBG("last peer"); return true; @@ -752,6 +754,9 @@ static inline void chan_ready_cb(struct l2cap_chan *chan) } } + if (!try_module_get(THIS_MODULE)) + return; + add_peer_chan(chan, dev); ifup(dev->netdev); }