aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Keil <keil@b1-systems.de>2012-09-13 00:36:20 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-13 14:58:54 -0400
commit4b921eda53366b319602351ff4d7256fafa4bd1b (patch)
treea60091cf40391abd4eb1452dc840289bd05bfd19
parent930521695c183c8a4da8fe13ce231cf5263b8d98 (diff)
mISDN: Fix wrong usage of flush_work_sync while holding locks
It is a bad idea to hold a spinlock and call flush_work_sync. Move the workqueue cleanup outside the spinlock and use cancel_work_sync, on closing the channel this seems to be the more correct function. Remove the never used and constant return value of mISDN_freebchannel. Signed-off-by: Karsten Keil <keil@b1-systems.de> Cc: <stable@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/isdn/hardware/mISDN/avmfritz.c3
-rw-r--r--drivers/isdn/hardware/mISDN/mISDNipac.c3
-rw-r--r--drivers/isdn/hardware/mISDN/mISDNisar.c3
-rw-r--r--drivers/isdn/hardware/mISDN/netjet.c3
-rw-r--r--drivers/isdn/hardware/mISDN/w6692.c3
-rw-r--r--drivers/isdn/mISDN/hwchannel.c9
-rw-r--r--include/linux/mISDNhw.h2
7 files changed, 15 insertions, 11 deletions
diff --git a/drivers/isdn/hardware/mISDN/avmfritz.c b/drivers/isdn/hardware/mISDN/avmfritz.c
index fa6ca4733725..dceaec821b0e 100644
--- a/drivers/isdn/hardware/mISDN/avmfritz.c
+++ b/drivers/isdn/hardware/mISDN/avmfritz.c
@@ -857,8 +857,9 @@ avm_bctrl(struct mISDNchannel *ch, u32 cmd, void *arg)
857 switch (cmd) { 857 switch (cmd) {
858 case CLOSE_CHANNEL: 858 case CLOSE_CHANNEL:
859 test_and_clear_bit(FLG_OPEN, &bch->Flags); 859 test_and_clear_bit(FLG_OPEN, &bch->Flags);
860 cancel_work_sync(&bch->workq);
860 spin_lock_irqsave(&fc->lock, flags); 861 spin_lock_irqsave(&fc->lock, flags);
861 mISDN_freebchannel(bch); 862 mISDN_clear_bchannel(bch);
862 modehdlc(bch, ISDN_P_NONE); 863 modehdlc(bch, ISDN_P_NONE);
863 spin_unlock_irqrestore(&fc->lock, flags); 864 spin_unlock_irqrestore(&fc->lock, flags);
864 ch->protocol = ISDN_P_NONE; 865 ch->protocol = ISDN_P_NONE;
diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c
index 752e0825591f..ccd7d851be26 100644
--- a/drivers/isdn/hardware/mISDN/mISDNipac.c
+++ b/drivers/isdn/hardware/mISDN/mISDNipac.c
@@ -1406,8 +1406,9 @@ hscx_bctrl(struct mISDNchannel *ch, u32 cmd, void *arg)
1406 switch (cmd) { 1406 switch (cmd) {
1407 case CLOSE_CHANNEL: 1407 case CLOSE_CHANNEL:
1408 test_and_clear_bit(FLG_OPEN, &bch->Flags); 1408 test_and_clear_bit(FLG_OPEN, &bch->Flags);
1409 cancel_work_sync(&bch->workq);
1409 spin_lock_irqsave(hx->ip->hwlock, flags); 1410 spin_lock_irqsave(hx->ip->hwlock, flags);
1410 mISDN_freebchannel(bch); 1411 mISDN_clear_bchannel(bch);
1411 hscx_mode(hx, ISDN_P_NONE); 1412 hscx_mode(hx, ISDN_P_NONE);
1412 spin_unlock_irqrestore(hx->ip->hwlock, flags); 1413 spin_unlock_irqrestore(hx->ip->hwlock, flags);
1413 ch->protocol = ISDN_P_NONE; 1414 ch->protocol = ISDN_P_NONE;
diff --git a/drivers/isdn/hardware/mISDN/mISDNisar.c b/drivers/isdn/hardware/mISDN/mISDNisar.c
index be5973ded6d6..182ecf0626c2 100644
--- a/drivers/isdn/hardware/mISDN/mISDNisar.c
+++ b/drivers/isdn/hardware/mISDN/mISDNisar.c
@@ -1588,8 +1588,9 @@ isar_bctrl(struct mISDNchannel *ch, u32 cmd, void *arg)
1588 switch (cmd) { 1588 switch (cmd) {
1589 case CLOSE_CHANNEL: 1589 case CLOSE_CHANNEL:
1590 test_and_clear_bit(FLG_OPEN, &bch->Flags); 1590 test_and_clear_bit(FLG_OPEN, &bch->Flags);
1591 cancel_work_sync(&bch->workq);
1591 spin_lock_irqsave(ich->is->hwlock, flags); 1592 spin_lock_irqsave(ich->is->hwlock, flags);
1592 mISDN_freebchannel(bch); 1593 mISDN_clear_bchannel(bch);
1593 modeisar(ich, ISDN_P_NONE); 1594 modeisar(ich, ISDN_P_NONE);
1594 spin_unlock_irqrestore(ich->is->hwlock, flags); 1595 spin_unlock_irqrestore(ich->is->hwlock, flags);
1595 ch->protocol = ISDN_P_NONE; 1596 ch->protocol = ISDN_P_NONE;
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
index c3e3e7686273..9bcade59eb73 100644
--- a/drivers/isdn/hardware/mISDN/netjet.c
+++ b/drivers/isdn/hardware/mISDN/netjet.c
@@ -812,8 +812,9 @@ nj_bctrl(struct mISDNchannel *ch, u32 cmd, void *arg)
812 switch (cmd) { 812 switch (cmd) {
813 case CLOSE_CHANNEL: 813 case CLOSE_CHANNEL:
814 test_and_clear_bit(FLG_OPEN, &bch->Flags); 814 test_and_clear_bit(FLG_OPEN, &bch->Flags);
815 cancel_work_sync(&bch->workq);
815 spin_lock_irqsave(&card->lock, flags); 816 spin_lock_irqsave(&card->lock, flags);
816 mISDN_freebchannel(bch); 817 mISDN_clear_bchannel(bch);
817 mode_tiger(bc, ISDN_P_NONE); 818 mode_tiger(bc, ISDN_P_NONE);
818 spin_unlock_irqrestore(&card->lock, flags); 819 spin_unlock_irqrestore(&card->lock, flags);
819 ch->protocol = ISDN_P_NONE; 820 ch->protocol = ISDN_P_NONE;
diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c
index 26a86b846099..335fe6455002 100644
--- a/drivers/isdn/hardware/mISDN/w6692.c
+++ b/drivers/isdn/hardware/mISDN/w6692.c
@@ -1054,8 +1054,9 @@ w6692_bctrl(struct mISDNchannel *ch, u32 cmd, void *arg)
1054 switch (cmd) { 1054 switch (cmd) {
1055 case CLOSE_CHANNEL: 1055 case CLOSE_CHANNEL:
1056 test_and_clear_bit(FLG_OPEN, &bch->Flags); 1056 test_and_clear_bit(FLG_OPEN, &bch->Flags);
1057 cancel_work_sync(&bch->workq);
1057 spin_lock_irqsave(&card->lock, flags); 1058 spin_lock_irqsave(&card->lock, flags);
1058 mISDN_freebchannel(bch); 1059 mISDN_clear_bchannel(bch);
1059 w6692_mode(bc, ISDN_P_NONE); 1060 w6692_mode(bc, ISDN_P_NONE);
1060 spin_unlock_irqrestore(&card->lock, flags); 1061 spin_unlock_irqrestore(&card->lock, flags);
1061 ch->protocol = ISDN_P_NONE; 1062 ch->protocol = ISDN_P_NONE;
diff --git a/drivers/isdn/mISDN/hwchannel.c b/drivers/isdn/mISDN/hwchannel.c
index ef34fd40867c..2602be23f341 100644
--- a/drivers/isdn/mISDN/hwchannel.c
+++ b/drivers/isdn/mISDN/hwchannel.c
@@ -148,17 +148,16 @@ mISDN_clear_bchannel(struct bchannel *ch)
148 ch->next_minlen = ch->init_minlen; 148 ch->next_minlen = ch->init_minlen;
149 ch->maxlen = ch->init_maxlen; 149 ch->maxlen = ch->init_maxlen;
150 ch->next_maxlen = ch->init_maxlen; 150 ch->next_maxlen = ch->init_maxlen;
151 skb_queue_purge(&ch->rqueue);
152 ch->rcount = 0;
151} 153}
152EXPORT_SYMBOL(mISDN_clear_bchannel); 154EXPORT_SYMBOL(mISDN_clear_bchannel);
153 155
154int 156void
155mISDN_freebchannel(struct bchannel *ch) 157mISDN_freebchannel(struct bchannel *ch)
156{ 158{
159 cancel_work_sync(&ch->workq);
157 mISDN_clear_bchannel(ch); 160 mISDN_clear_bchannel(ch);
158 skb_queue_purge(&ch->rqueue);
159 ch->rcount = 0;
160 flush_work_sync(&ch->workq);
161 return 0;
162} 161}
163EXPORT_SYMBOL(mISDN_freebchannel); 162EXPORT_SYMBOL(mISDN_freebchannel);
164 163
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
index d0752eca9b44..9d96d5d4dfed 100644
--- a/include/linux/mISDNhw.h
+++ b/include/linux/mISDNhw.h
@@ -183,7 +183,7 @@ extern int mISDN_initbchannel(struct bchannel *, unsigned short,
183 unsigned short); 183 unsigned short);
184extern int mISDN_freedchannel(struct dchannel *); 184extern int mISDN_freedchannel(struct dchannel *);
185extern void mISDN_clear_bchannel(struct bchannel *); 185extern void mISDN_clear_bchannel(struct bchannel *);
186extern int mISDN_freebchannel(struct bchannel *); 186extern void mISDN_freebchannel(struct bchannel *);
187extern int mISDN_ctrl_bchannel(struct bchannel *, struct mISDN_ctrl_req *); 187extern int mISDN_ctrl_bchannel(struct bchannel *, struct mISDN_ctrl_req *);
188extern void queue_ch_frame(struct mISDNchannel *, u_int, 188extern void queue_ch_frame(struct mISDNchannel *, u_int,
189 int, struct sk_buff *); 189 int, struct sk_buff *);