* [PATCH] isdn: hisax: isac: fix a possible concurrency use-after-free bug in ISAC_l1hw()
@ 2019-05-29 8:48 Young Xiao
2019-05-30 19:38 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Young Xiao @ 2019-05-29 8:48 UTC (permalink / raw)
To: isdn, netdev, linux-kernel; +Cc: Young Xiao
In drivers/isdn/hisax/isac.c, the function isac_interrupt() and
ISAC_l1hw() may be concurrently executed.
ISAC_l1hw()
line 499: if (!cs->tx_skb)
isac_interrupt()
line 250: dev_kfree_skb_irq(cs->tx_skb);
Thus, a possible concurrency use-after-free bug may occur in ISAC_l1hw().
To fix these bugs, the calls to spin_lock_irqsave() and
spin_unlock_irqrestore() are added in HFCPCI_l1hw(), to protect the
access to cs->tx_skb.
See commit 7418e6520f22 ("isdn: hisax: hfc_pci: Fix a possible concurrency
use-after-free bug in HFCPCI_l1hw()") for details.
Signed-off-by: Young Xiao <92siuyang@gmail.com>
---
drivers/isdn/hisax/isac.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/isdn/hisax/isac.c b/drivers/isdn/hisax/isac.c
index bd40e06..60dd805 100644
--- a/drivers/isdn/hisax/isac.c
+++ b/drivers/isdn/hisax/isac.c
@@ -496,11 +496,13 @@ ISAC_l1hw(struct PStack *st, int pr, void *arg)
if (cs->debug & L1_DEB_LAPD)
debugl1(cs, "-> PH_REQUEST_PULL");
#endif
+ spin_lock_irqsave(&cs->lock, flags);
if (!cs->tx_skb) {
test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
} else
test_and_set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
+ spin_unlock_irqrestore(&cs->lock, flags);
break;
case (HW_RESET | REQUEST):
spin_lock_irqsave(&cs->lock, flags);
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] isdn: hisax: isac: fix a possible concurrency use-after-free bug in ISAC_l1hw()
2019-05-29 8:48 [PATCH] isdn: hisax: isac: fix a possible concurrency use-after-free bug in ISAC_l1hw() Young Xiao
@ 2019-05-30 19:38 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-05-30 19:38 UTC (permalink / raw)
To: 92siuyang; +Cc: isdn, netdev, linux-kernel
From: Young Xiao <92siuyang@gmail.com>
Date: Wed, 29 May 2019 16:48:59 +0800
> In drivers/isdn/hisax/isac.c, the function isac_interrupt() and
> ISAC_l1hw() may be concurrently executed.
>
> ISAC_l1hw()
> line 499: if (!cs->tx_skb)
>
> isac_interrupt()
> line 250: dev_kfree_skb_irq(cs->tx_skb);
>
> Thus, a possible concurrency use-after-free bug may occur in ISAC_l1hw().
...
> + spin_lock_irqsave(&cs->lock, flags);
> if (!cs->tx_skb) {
> test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
> st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
> } else
> test_and_set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
> + spin_unlock_irqrestore(&cs->lock, flags);
Nothing in this code accesses the cs->tx_skb object. It is just a logic test
upon whether it is NULL or not.
I'm not applying stuff like this, sorry.
You have to show how something can actually go wrong when fixing a bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-30 19:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 8:48 [PATCH] isdn: hisax: isac: fix a possible concurrency use-after-free bug in ISAC_l1hw() Young Xiao
2019-05-30 19:38 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®