* [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
@ 2026-02-08 6:25 Duoming Zhou
2026-02-08 6:38 ` Greg KH
0 siblings, 1 reply; 14+ messages in thread
From: Duoming Zhou @ 2026-02-08 6:25 UTC (permalink / raw)
To: linux-serial
Cc: linux-kernel, jikos, dsterba, gregkh, jirislaby, kuba,
alexander.deucher, akpm, pkshih, tglx, mingo, Duoming Zhou
When IPWireless PCMCIA card is being detached, the ipw_hardware is
deallocated in ipwireless_hardware_free(). However, the hw->tasklet may
still be running or pending, leading to use-after-free bugs when the
already freed ipw_hardware is accessed again in ipwireless_do_tasklet().
One race condition scenario is as follows:
CPU 0 (cleanup) | CPU 1 (interrupt)
ipwireless_hardware_free() | ipwireless_interrupt()
ipwireless_stop_interrupts()| ipwireless_handle_v1_interrupt()
do_close_hardware() | tasklet_schedule()
synchronize_irq() |
kfree(hw) //FREE | ipwireless_do_tasklet() //handler
| hw = from_tasklet() //USE
| hw-> //USE
Fix this by ensuring hw->tasklet is properly canceled before ipw_hardware
is released. Add tasklet_kill() in ipwireless_stop_interrupts() to
synchronize with any pending or running tasklet. Since do_close_hardware()
could prevent further interrupts, place tasklet_kill() after it to avoid
the tasklet being rescheduled by ipwireless_interrupt().
Fixes: 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
---
drivers/tty/ipwireless/hardware.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/tty/ipwireless/hardware.c b/drivers/tty/ipwireless/hardware.c
index e18848267be..c736cba751f 100644
--- a/drivers/tty/ipwireless/hardware.c
+++ b/drivers/tty/ipwireless/hardware.c
@@ -1725,6 +1725,7 @@ void ipwireless_stop_interrupts(struct ipw_hardware *hw)
/* Prevent the hardware from sending any more interrupts */
do_close_hardware(hw);
+ tasklet_kill(&hw->tasklet);
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
2026-02-08 6:25 [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal Duoming Zhou
@ 2026-02-08 6:38 ` Greg KH
2026-02-08 10:28 ` duoming
0 siblings, 1 reply; 14+ messages in thread
From: Greg KH @ 2026-02-08 6:38 UTC (permalink / raw)
To: Duoming Zhou
Cc: linux-serial, linux-kernel, jikos, dsterba, jirislaby, kuba,
alexander.deucher, akpm, pkshih, tglx, mingo
On Sun, Feb 08, 2026 at 02:25:38PM +0800, Duoming Zhou wrote:
> When IPWireless PCMCIA card is being detached, the ipw_hardware is
> deallocated in ipwireless_hardware_free(). However, the hw->tasklet may
> still be running or pending, leading to use-after-free bugs when the
> already freed ipw_hardware is accessed again in ipwireless_do_tasklet().
Nice, do you have this hardware to test this with?
>
> One race condition scenario is as follows:
>
> CPU 0 (cleanup) | CPU 1 (interrupt)
> ipwireless_hardware_free() | ipwireless_interrupt()
> ipwireless_stop_interrupts()| ipwireless_handle_v1_interrupt()
> do_close_hardware() | tasklet_schedule()
> synchronize_irq() |
> kfree(hw) //FREE | ipwireless_do_tasklet() //handler
> | hw = from_tasklet() //USE
> | hw-> //USE
>
> Fix this by ensuring hw->tasklet is properly canceled before ipw_hardware
> is released. Add tasklet_kill() in ipwireless_stop_interrupts() to
> synchronize with any pending or running tasklet. Since do_close_hardware()
> could prevent further interrupts, place tasklet_kill() after it to avoid
> the tasklet being rescheduled by ipwireless_interrupt().
How was this issue found and tested?
> Fixes: 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")
> Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
No CC: stable? Why not?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
2026-02-08 6:38 ` Greg KH
@ 2026-02-08 10:28 ` duoming
2026-02-08 11:00 ` Greg KH
0 siblings, 1 reply; 14+ messages in thread
From: duoming @ 2026-02-08 10:28 UTC (permalink / raw)
To: Greg KH
Cc: linux-serial, linux-kernel, jikos, dsterba, jirislaby, kuba,
alexander.deucher, akpm, pkshih, tglx, mingo
On Sun, 8 Feb 2026 07:38:00 +0100 Greg KH wrote:
> > When IPWireless PCMCIA card is being detached, the ipw_hardware is
> > deallocated in ipwireless_hardware_free(). However, the hw->tasklet may
> > still be running or pending, leading to use-after-free bugs when the
> > already freed ipw_hardware is accessed again in ipwireless_do_tasklet().
>
> Nice, do you have this hardware to test this with?
I don't have the real hardware. In order to reproduce the bug, I simulate
the IPWireless PCMCIA card in the qemu by allocating and configuring the
necessary resources(I/O ports, memory regions, interrupts and so on) to
correspond with the hardware expected by the driver in the initialization
code of the virtual device.
> >
> > One race condition scenario is as follows:
> >
> > CPU 0 (cleanup) | CPU 1 (interrupt)
> > ipwireless_hardware_free() | ipwireless_interrupt()
> > ipwireless_stop_interrupts()| ipwireless_handle_v1_interrupt()
> > do_close_hardware() | tasklet_schedule()
> > synchronize_irq() |
> > kfree(hw) //FREE | ipwireless_do_tasklet() //handler
> > | hw = from_tasklet() //USE
> > | hw-> //USE
> >
> > Fix this by ensuring hw->tasklet is properly canceled before ipw_hardware
> > is released. Add tasklet_kill() in ipwireless_stop_interrupts() to
> > synchronize with any pending or running tasklet. Since do_close_hardware()
> > could prevent further interrupts, place tasklet_kill() after it to avoid
> > the tasklet being rescheduled by ipwireless_interrupt().
>
> How was this issue found and tested?
The issue was found by static analysis. I test it through the following steps:
1. Simulating the IPWireless PCMCIA device in the qemu and enable it to trigger interrupts.
2. Controlling the removal and attachment of device via sysfs.
3. Triggering interrupts by writing data to device registers via /dev/mem memory mapping
in userspace.
4. In order to ensure that there are unfinished tasklet during the removal process, I
manually inject delays such as mdelay() into tasklet handler.
> > Fixes: 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")
> > Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
>
> No CC: stable? Why not?
Thanks for checking, You are right, it should go to the stable.
Best regards,
Duoming Zhou
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
2026-02-08 10:28 ` duoming
@ 2026-02-08 11:00 ` Greg KH
2026-02-08 13:57 ` duoming
2026-02-08 17:25 ` Jiri Kosina
0 siblings, 2 replies; 14+ messages in thread
From: Greg KH @ 2026-02-08 11:00 UTC (permalink / raw)
To: duoming
Cc: linux-serial, linux-kernel, jikos, dsterba, jirislaby, kuba,
alexander.deucher, akpm, pkshih, tglx, mingo
On Sun, Feb 08, 2026 at 06:28:19PM +0800, duoming@zju.edu.cn wrote:
> On Sun, 8 Feb 2026 07:38:00 +0100 Greg KH wrote:
> > > When IPWireless PCMCIA card is being detached, the ipw_hardware is
> > > deallocated in ipwireless_hardware_free(). However, the hw->tasklet may
> > > still be running or pending, leading to use-after-free bugs when the
> > > already freed ipw_hardware is accessed again in ipwireless_do_tasklet().
> >
> > Nice, do you have this hardware to test this with?
>
> I don't have the real hardware. In order to reproduce the bug, I simulate
> the IPWireless PCMCIA card in the qemu by allocating and configuring the
> necessary resources(I/O ports, memory regions, interrupts and so on) to
> correspond with the hardware expected by the driver in the initialization
> code of the virtual device.
I wonder if this device even is still around, given that pcmcia is all
but dead for a very long time.
> > > One race condition scenario is as follows:
> > >
> > > CPU 0 (cleanup) | CPU 1 (interrupt)
> > > ipwireless_hardware_free() | ipwireless_interrupt()
> > > ipwireless_stop_interrupts()| ipwireless_handle_v1_interrupt()
> > > do_close_hardware() | tasklet_schedule()
> > > synchronize_irq() |
> > > kfree(hw) //FREE | ipwireless_do_tasklet() //handler
> > > | hw = from_tasklet() //USE
> > > | hw-> //USE
> > >
> > > Fix this by ensuring hw->tasklet is properly canceled before ipw_hardware
> > > is released. Add tasklet_kill() in ipwireless_stop_interrupts() to
> > > synchronize with any pending or running tasklet. Since do_close_hardware()
> > > could prevent further interrupts, place tasklet_kill() after it to avoid
> > > the tasklet being rescheduled by ipwireless_interrupt().
> >
> > How was this issue found and tested?
>
> The issue was found by static analysis. I test it through the following steps:
> 1. Simulating the IPWireless PCMCIA device in the qemu and enable it to trigger interrupts.
> 2. Controlling the removal and attachment of device via sysfs.
So this is with the bind/unbind logic, or some other way? If you are
unloading the driver, that is something that only root can do, and this
is a debugging facility, not a "real" way to control drivers and devices
(yes, the virt drivers abuse this to no end, every time I see this I
laugh...)
> 3. Triggering interrupts by writing data to device registers via /dev/mem memory mapping
> in userspace.
Interrupts would not happen if the device is removed. Or is this only
if the driver is unbound?
> 4. In order to ensure that there are unfinished tasklet during the removal process, I
> manually inject delays such as mdelay() into tasklet handler.
That's a lot of work for a piece of obsolete hardware, but hey, thanks
for doing this!
> > > Fixes: 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")
> > > Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
> >
> > No CC: stable? Why not?
>
> Thanks for checking, You are right, it should go to the stable.
Let's see what the maintainers of this driver say.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
2026-02-08 11:00 ` Greg KH
@ 2026-02-08 13:57 ` duoming
2026-02-08 14:34 ` Greg KH
2026-02-08 17:25 ` Jiri Kosina
1 sibling, 1 reply; 14+ messages in thread
From: duoming @ 2026-02-08 13:57 UTC (permalink / raw)
To: Greg KH
Cc: linux-serial, linux-kernel, jikos, dsterba, jirislaby, kuba,
alexander.deucher, akpm, pkshih, tglx, mingo
On Date: Sun, 8 Feb 2026 12:00:08 +0100 Greg KH wrote:
> > > > When IPWireless PCMCIA card is being detached, the ipw_hardware is
> > > > deallocated in ipwireless_hardware_free(). However, the hw->tasklet may
> > > > still be running or pending, leading to use-after-free bugs when the
> > > > already freed ipw_hardware is accessed again in ipwireless_do_tasklet().
> > >
> > > Nice, do you have this hardware to test this with?
> >
> > I don't have the real hardware. In order to reproduce the bug, I simulate
> > the IPWireless PCMCIA card in the qemu by allocating and configuring the
> > necessary resources(I/O ports, memory regions, interrupts and so on) to
> > correspond with the hardware expected by the driver in the initialization
> > code of the virtual device.
>
> I wonder if this device even is still around, given that pcmcia is all
> but dead for a very long time.
>
> > > > One race condition scenario is as follows:
> > > >
> > > > CPU 0 (cleanup) | CPU 1 (interrupt)
> > > > ipwireless_hardware_free() | ipwireless_interrupt()
> > > > ipwireless_stop_interrupts()| ipwireless_handle_v1_interrupt()
> > > > do_close_hardware() | tasklet_schedule()
> > > > synchronize_irq() |
> > > > kfree(hw) //FREE | ipwireless_do_tasklet() //handler
> > > > | hw = from_tasklet() //USE
> > > > | hw-> //USE
> > > >
> > > > Fix this by ensuring hw->tasklet is properly canceled before ipw_hardware
> > > > is released. Add tasklet_kill() in ipwireless_stop_interrupts() to
> > > > synchronize with any pending or running tasklet. Since do_close_hardware()
> > > > could prevent further interrupts, place tasklet_kill() after it to avoid
> > > > the tasklet being rescheduled by ipwireless_interrupt().
> > >
> > > How was this issue found and tested?
> >
> > The issue was found by static analysis. I test it through the following steps:
> > 1. Simulating the IPWireless PCMCIA device in the qemu and enable it to trigger interrupts.
> > 2. Controlling the removal and attachment of device via sysfs.
>
> So this is with the bind/unbind logic, or some other way? If you are
> unloading the driver, that is something that only root can do, and this
> is a debugging facility, not a "real" way to control drivers and devices
> (yes, the virt drivers abuse this to no end, every time I see this I
> laugh...)
When the PCMCIA device is attached, we can operate the file
/sys/bus/pcmcia/devices/.../remove to detach the device.
> > 3. Triggering interrupts by writing data to device registers via /dev/mem memory mapping
> > in userspace.
>
> Interrupts would not happen if the device is removed. Or is this only
> if the driver is unbound?
The interrupts should be triggered before the deivce is removed.
Best regards,
Duoming Zhou
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
2026-02-08 13:57 ` duoming
@ 2026-02-08 14:34 ` Greg KH
2026-02-08 14:53 ` duoming
0 siblings, 1 reply; 14+ messages in thread
From: Greg KH @ 2026-02-08 14:34 UTC (permalink / raw)
To: duoming
Cc: linux-serial, linux-kernel, jikos, dsterba, jirislaby, kuba,
alexander.deucher, akpm, pkshih, tglx, mingo
On Sun, Feb 08, 2026 at 09:57:32PM +0800, duoming@zju.edu.cn wrote:
> On Date: Sun, 8 Feb 2026 12:00:08 +0100 Greg KH wrote:
> > > > > When IPWireless PCMCIA card is being detached, the ipw_hardware is
> > > > > deallocated in ipwireless_hardware_free(). However, the hw->tasklet may
> > > > > still be running or pending, leading to use-after-free bugs when the
> > > > > already freed ipw_hardware is accessed again in ipwireless_do_tasklet().
> > > >
> > > > Nice, do you have this hardware to test this with?
> > >
> > > I don't have the real hardware. In order to reproduce the bug, I simulate
> > > the IPWireless PCMCIA card in the qemu by allocating and configuring the
> > > necessary resources(I/O ports, memory regions, interrupts and so on) to
> > > correspond with the hardware expected by the driver in the initialization
> > > code of the virtual device.
> >
> > I wonder if this device even is still around, given that pcmcia is all
> > but dead for a very long time.
> >
> > > > > One race condition scenario is as follows:
> > > > >
> > > > > CPU 0 (cleanup) | CPU 1 (interrupt)
> > > > > ipwireless_hardware_free() | ipwireless_interrupt()
> > > > > ipwireless_stop_interrupts()| ipwireless_handle_v1_interrupt()
> > > > > do_close_hardware() | tasklet_schedule()
> > > > > synchronize_irq() |
> > > > > kfree(hw) //FREE | ipwireless_do_tasklet() //handler
> > > > > | hw = from_tasklet() //USE
> > > > > | hw-> //USE
> > > > >
> > > > > Fix this by ensuring hw->tasklet is properly canceled before ipw_hardware
> > > > > is released. Add tasklet_kill() in ipwireless_stop_interrupts() to
> > > > > synchronize with any pending or running tasklet. Since do_close_hardware()
> > > > > could prevent further interrupts, place tasklet_kill() after it to avoid
> > > > > the tasklet being rescheduled by ipwireless_interrupt().
> > > >
> > > > How was this issue found and tested?
> > >
> > > The issue was found by static analysis. I test it through the following steps:
> > > 1. Simulating the IPWireless PCMCIA device in the qemu and enable it to trigger interrupts.
> > > 2. Controlling the removal and attachment of device via sysfs.
> >
> > So this is with the bind/unbind logic, or some other way? If you are
> > unloading the driver, that is something that only root can do, and this
> > is a debugging facility, not a "real" way to control drivers and devices
> > (yes, the virt drivers abuse this to no end, every time I see this I
> > laugh...)
>
> When the PCMCIA device is attached, we can operate the file
> /sys/bus/pcmcia/devices/.../remove to detach the device.
'remove' should be removing the driver from the device, something that
is only allowed by root and is not a normal operation at all. race
conditions there are "at your own risk" for all drivers as it's pretty
much the same as unloading the module, it is there for developer ease
only.
> > > 3. Triggering interrupts by writing data to device registers via /dev/mem memory mapping
> > > in userspace.
> >
> > Interrupts would not happen if the device is removed. Or is this only
> > if the driver is unbound?
>
> The interrupts should be triggered before the deivce is removed.
But when the device is physically removed from the system, no more
interrupts will happen.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
2026-02-08 14:34 ` Greg KH
@ 2026-02-08 14:53 ` duoming
2026-02-08 14:58 ` Greg KH
0 siblings, 1 reply; 14+ messages in thread
From: duoming @ 2026-02-08 14:53 UTC (permalink / raw)
To: Greg KH
Cc: linux-serial, linux-kernel, jikos, dsterba, jirislaby, kuba,
alexander.deucher, akpm, pkshih, tglx, mingo
On Sun, 8 Feb 2026 15:34:49 +0100 Greg KH wrote:
> > > > > > When IPWireless PCMCIA card is being detached, the ipw_hardware is
> > > > > > deallocated in ipwireless_hardware_free(). However, the hw->tasklet may
> > > > > > still be running or pending, leading to use-after-free bugs when the
> > > > > > already freed ipw_hardware is accessed again in ipwireless_do_tasklet().
> > > > >
> > > > > Nice, do you have this hardware to test this with?
> > > >
> > > > I don't have the real hardware. In order to reproduce the bug, I simulate
> > > > the IPWireless PCMCIA card in the qemu by allocating and configuring the
> > > > necessary resources(I/O ports, memory regions, interrupts and so on) to
> > > > correspond with the hardware expected by the driver in the initialization
> > > > code of the virtual device.
> > >
> > > I wonder if this device even is still around, given that pcmcia is all
> > > but dead for a very long time.
> > >
> > > > > > One race condition scenario is as follows:
> > > > > >
> > > > > > CPU 0 (cleanup) | CPU 1 (interrupt)
> > > > > > ipwireless_hardware_free() | ipwireless_interrupt()
> > > > > > ipwireless_stop_interrupts()| ipwireless_handle_v1_interrupt()
> > > > > > do_close_hardware() | tasklet_schedule()
> > > > > > synchronize_irq() |
> > > > > > kfree(hw) //FREE | ipwireless_do_tasklet() //handler
> > > > > > | hw = from_tasklet() //USE
> > > > > > | hw-> //USE
> > > > > >
> > > > > > Fix this by ensuring hw->tasklet is properly canceled before ipw_hardware
> > > > > > is released. Add tasklet_kill() in ipwireless_stop_interrupts() to
> > > > > > synchronize with any pending or running tasklet. Since do_close_hardware()
> > > > > > could prevent further interrupts, place tasklet_kill() after it to avoid
> > > > > > the tasklet being rescheduled by ipwireless_interrupt().
> > > > >
> > > > > How was this issue found and tested?
> > > >
> > > > The issue was found by static analysis. I test it through the following steps:
> > > > 1. Simulating the IPWireless PCMCIA device in the qemu and enable it to trigger interrupts.
> > > > 2. Controlling the removal and attachment of device via sysfs.
> > >
> > > So this is with the bind/unbind logic, or some other way? If you are
> > > unloading the driver, that is something that only root can do, and this
> > > is a debugging facility, not a "real" way to control drivers and devices
> > > (yes, the virt drivers abuse this to no end, every time I see this I
> > > laugh...)
> >
> > When the PCMCIA device is attached, we can operate the file
> > /sys/bus/pcmcia/devices/.../remove to detach the device.
>
> 'remove' should be removing the driver from the device, something that
> is only allowed by root and is not a normal operation at all. race
> conditions there are "at your own risk" for all drivers as it's pretty
> much the same as unloading the module, it is there for developer ease
> only.
I did this only to verify the existence of the bug. In real word scenarios,
the device removal code can be triggered by removing the real pcmcia hardware.
> > > > 3. Triggering interrupts by writing data to device registers via /dev/mem memory mapping
> > > > in userspace.
> > >
> > > Interrupts would not happen if the device is removed. Or is this only
> > > if the driver is unbound?
> >
> > The interrupts should be triggered before the deivce is removed.
>
> But when the device is physically removed from the system, no more
> interrupts will happen.
I think the tasklet is a deferred mechanism. Although interrupts cannot
happen after device is removed, the tasklet handler may still be executing
or pending. This is why tasklet_kill() needs to be added.
Best regards,
Duoming Zhou
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
2026-02-08 14:53 ` duoming
@ 2026-02-08 14:58 ` Greg KH
0 siblings, 0 replies; 14+ messages in thread
From: Greg KH @ 2026-02-08 14:58 UTC (permalink / raw)
To: duoming
Cc: linux-serial, linux-kernel, jikos, dsterba, jirislaby, kuba,
alexander.deucher, akpm, pkshih, tglx, mingo
On Sun, Feb 08, 2026 at 10:53:26PM +0800, duoming@zju.edu.cn wrote:
> On Sun, 8 Feb 2026 15:34:49 +0100 Greg KH wrote:
> > > > > > > When IPWireless PCMCIA card is being detached, the ipw_hardware is
> > > > > > > deallocated in ipwireless_hardware_free(). However, the hw->tasklet may
> > > > > > > still be running or pending, leading to use-after-free bugs when the
> > > > > > > already freed ipw_hardware is accessed again in ipwireless_do_tasklet().
> > > > > >
> > > > > > Nice, do you have this hardware to test this with?
> > > > >
> > > > > I don't have the real hardware. In order to reproduce the bug, I simulate
> > > > > the IPWireless PCMCIA card in the qemu by allocating and configuring the
> > > > > necessary resources(I/O ports, memory regions, interrupts and so on) to
> > > > > correspond with the hardware expected by the driver in the initialization
> > > > > code of the virtual device.
> > > >
> > > > I wonder if this device even is still around, given that pcmcia is all
> > > > but dead for a very long time.
> > > >
> > > > > > > One race condition scenario is as follows:
> > > > > > >
> > > > > > > CPU 0 (cleanup) | CPU 1 (interrupt)
> > > > > > > ipwireless_hardware_free() | ipwireless_interrupt()
> > > > > > > ipwireless_stop_interrupts()| ipwireless_handle_v1_interrupt()
> > > > > > > do_close_hardware() | tasklet_schedule()
> > > > > > > synchronize_irq() |
> > > > > > > kfree(hw) //FREE | ipwireless_do_tasklet() //handler
> > > > > > > | hw = from_tasklet() //USE
> > > > > > > | hw-> //USE
> > > > > > >
> > > > > > > Fix this by ensuring hw->tasklet is properly canceled before ipw_hardware
> > > > > > > is released. Add tasklet_kill() in ipwireless_stop_interrupts() to
> > > > > > > synchronize with any pending or running tasklet. Since do_close_hardware()
> > > > > > > could prevent further interrupts, place tasklet_kill() after it to avoid
> > > > > > > the tasklet being rescheduled by ipwireless_interrupt().
> > > > > >
> > > > > > How was this issue found and tested?
> > > > >
> > > > > The issue was found by static analysis. I test it through the following steps:
> > > > > 1. Simulating the IPWireless PCMCIA device in the qemu and enable it to trigger interrupts.
> > > > > 2. Controlling the removal and attachment of device via sysfs.
> > > >
> > > > So this is with the bind/unbind logic, or some other way? If you are
> > > > unloading the driver, that is something that only root can do, and this
> > > > is a debugging facility, not a "real" way to control drivers and devices
> > > > (yes, the virt drivers abuse this to no end, every time I see this I
> > > > laugh...)
> > >
> > > When the PCMCIA device is attached, we can operate the file
> > > /sys/bus/pcmcia/devices/.../remove to detach the device.
> >
> > 'remove' should be removing the driver from the device, something that
> > is only allowed by root and is not a normal operation at all. race
> > conditions there are "at your own risk" for all drivers as it's pretty
> > much the same as unloading the module, it is there for developer ease
> > only.
>
> I did this only to verify the existence of the bug. In real word scenarios,
> the device removal code can be triggered by removing the real pcmcia hardware.
How? Doesn't the interrupt not happen, and the device get cleaned up by
the bus when it is noticed and then removed? ipwireless_hardware_free()
should not be called if ipwireless_interrupt() is ever happening in that
case just by virtue of the fact that the interrupt will not be there.
> > > > > 3. Triggering interrupts by writing data to device registers via /dev/mem memory mapping
> > > > > in userspace.
> > > >
> > > > Interrupts would not happen if the device is removed. Or is this only
> > > > if the driver is unbound?
> > >
> > > The interrupts should be triggered before the deivce is removed.
> >
> > But when the device is physically removed from the system, no more
> > interrupts will happen.
>
> I think the tasklet is a deferred mechanism. Although interrupts cannot
> happen after device is removed, the tasklet handler may still be executing
> or pending. This is why tasklet_kill() needs to be added.
Ok, there might be a small race, but given that no one has ever seen
this with real hardware (and you need physical access for it), it's
pretty small. But again, I'll let the maintainers here decide if it
should be accepted or not.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
2026-02-08 11:00 ` Greg KH
2026-02-08 13:57 ` duoming
@ 2026-02-08 17:25 ` Jiri Kosina
2026-02-09 10:21 ` David Sterba
1 sibling, 1 reply; 14+ messages in thread
From: Jiri Kosina @ 2026-02-08 17:25 UTC (permalink / raw)
To: Greg KH
Cc: duoming, linux-serial, linux-kernel, dsterba, jirislaby, kuba,
alexander.deucher, akpm, pkshih, tglx, mingo
On Sun, 8 Feb 2026, Greg KH wrote:
> > I don't have the real hardware. In order to reproduce the bug, I simulate
> > the IPWireless PCMCIA card in the qemu by allocating and configuring the
> > necessary resources(I/O ports, memory regions, interrupts and so on) to
> > correspond with the hardware expected by the driver in the initialization
> > code of the virtual device.
>
> I wonder if this device even is still around, given that pcmcia is all
> but dead for a very long time.
I doubt that this device is still around anywhere where reasonably new
kernels (including LTS) would matter.
I don't think I've seen this device (which was back then donated to me by
T-Mobile CZ in order to get it supported in Linux, and I am not sure how
much global adoption it got afterwards) for, let's say, past 15 years :)
I think (let's see what David, ho took the maintainership over for me
afterwards, has to say) we'd better deprecate and drop the whole thing,
rather than trying to pretend that it's still actively being taken care
of.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
2026-02-08 17:25 ` Jiri Kosina
@ 2026-02-09 10:21 ` David Sterba
2026-02-17 8:03 ` Jiri Slaby
0 siblings, 1 reply; 14+ messages in thread
From: David Sterba @ 2026-02-09 10:21 UTC (permalink / raw)
To: Jiri Kosina
Cc: Greg KH, duoming, linux-serial, linux-kernel, dsterba, jirislaby,
kuba, alexander.deucher, akpm, pkshih, tglx, mingo
On Sun, Feb 08, 2026 at 06:25:38PM +0100, Jiri Kosina wrote:
> On Sun, 8 Feb 2026, Greg KH wrote:
>
> > > I don't have the real hardware. In order to reproduce the bug, I simulate
> > > the IPWireless PCMCIA card in the qemu by allocating and configuring the
> > > necessary resources(I/O ports, memory regions, interrupts and so on) to
> > > correspond with the hardware expected by the driver in the initialization
> > > code of the virtual device.
> >
> > I wonder if this device even is still around, given that pcmcia is all
> > but dead for a very long time.
>
> I doubt that this device is still around anywhere where reasonably new
> kernels (including LTS) would matter.
>
> I don't think I've seen this device (which was back then donated to me by
> T-Mobile CZ in order to get it supported in Linux, and I am not sure how
> much global adoption it got afterwards) for, let's say, past 15 years :)
>
> I think (let's see what David, ho took the maintainership over for me
> afterwards, has to say) we'd better deprecate and drop the whole thing,
> rather than trying to pretend that it's still actively being taken care
> of.
https://lore.kernel.org/all/20230223172403.GW10580@suse.cz/ last time
the question of keeping the driver was asked (2023). Back then I was
able to find the cards on second hand market but now I can't on a local
market and there's exactly one hit on global eBay.
Local linux related or telco support forums seem to mention the driver
until 2011 (root.cz, abclinuxu.cz, t-mobile.cz). It does not prove
nobody is using it but I think the chances are quite low to justify
keeping the driver. It is simple enough to be built as an external
module eventually, I can help with that in case somebody really needs
that.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
2026-02-09 10:21 ` David Sterba
@ 2026-02-17 8:03 ` Jiri Slaby
2026-02-18 15:23 ` David Sterba
0 siblings, 1 reply; 14+ messages in thread
From: Jiri Slaby @ 2026-02-17 8:03 UTC (permalink / raw)
To: dsterba, Jiri Kosina
Cc: Greg KH, duoming, linux-serial, linux-kernel, dsterba, kuba,
alexander.deucher, akpm, pkshih, tglx, mingo
Hi,
On 09. 02. 26, 11:21, David Sterba wrote:
> On Sun, Feb 08, 2026 at 06:25:38PM +0100, Jiri Kosina wrote:
>> On Sun, 8 Feb 2026, Greg KH wrote:
>>
>>>> I don't have the real hardware. In order to reproduce the bug, I simulate
>>>> the IPWireless PCMCIA card in the qemu by allocating and configuring the
>>>> necessary resources(I/O ports, memory regions, interrupts and so on) to
>>>> correspond with the hardware expected by the driver in the initialization
>>>> code of the virtual device.
>>>
>>> I wonder if this device even is still around, given that pcmcia is all
>>> but dead for a very long time.
>>
>> I doubt that this device is still around anywhere where reasonably new
>> kernels (including LTS) would matter.
>>
>> I don't think I've seen this device (which was back then donated to me by
>> T-Mobile CZ in order to get it supported in Linux, and I am not sure how
>> much global adoption it got afterwards) for, let's say, past 15 years :)
>>
>> I think (let's see what David, ho took the maintainership over for me
>> afterwards, has to say) we'd better deprecate and drop the whole thing,
>> rather than trying to pretend that it's still actively being taken care
>> of.
>
> https://lore.kernel.org/all/20230223172403.GW10580@suse.cz/ last time
> the question of keeping the driver was asked (2023). Back then I was
> able to find the cards on second hand market but now I can't on a local
> market and there's exactly one hit on global eBay.
>
> Local linux related or telco support forums seem to mention the driver
> until 2011 (root.cz, abclinuxu.cz, t-mobile.cz). It does not prove
> nobody is using it but I think the chances are quite low to justify
> keeping the driver. It is simple enough to be built as an external
> module eventually, I can help with that in case somebody really needs
> that.
So, would you want to submit the removal? Or anyone else, if you don't
want to lose time with this? (I can do that, if noone wants to.)
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
2026-02-17 8:03 ` Jiri Slaby
@ 2026-02-18 15:23 ` David Sterba
2026-03-09 11:18 ` Qingfang Deng
0 siblings, 1 reply; 14+ messages in thread
From: David Sterba @ 2026-02-18 15:23 UTC (permalink / raw)
To: Jiri Slaby
Cc: Jiri Kosina, Greg KH, duoming, linux-serial, linux-kernel,
dsterba, kuba, alexander.deucher, akpm, pkshih, tglx, mingo
On Tue, Feb 17, 2026 at 09:03:25AM +0100, Jiri Slaby wrote:
> Hi,
>
> On 09. 02. 26, 11:21, David Sterba wrote:
> > On Sun, Feb 08, 2026 at 06:25:38PM +0100, Jiri Kosina wrote:
> >> On Sun, 8 Feb 2026, Greg KH wrote:
> >>
> >>>> I don't have the real hardware. In order to reproduce the bug, I simulate
> >>>> the IPWireless PCMCIA card in the qemu by allocating and configuring the
> >>>> necessary resources(I/O ports, memory regions, interrupts and so on) to
> >>>> correspond with the hardware expected by the driver in the initialization
> >>>> code of the virtual device.
> >>>
> >>> I wonder if this device even is still around, given that pcmcia is all
> >>> but dead for a very long time.
> >>
> >> I doubt that this device is still around anywhere where reasonably new
> >> kernels (including LTS) would matter.
> >>
> >> I don't think I've seen this device (which was back then donated to me by
> >> T-Mobile CZ in order to get it supported in Linux, and I am not sure how
> >> much global adoption it got afterwards) for, let's say, past 15 years :)
> >>
> >> I think (let's see what David, ho took the maintainership over for me
> >> afterwards, has to say) we'd better deprecate and drop the whole thing,
> >> rather than trying to pretend that it's still actively being taken care
> >> of.
> >
> > https://lore.kernel.org/all/20230223172403.GW10580@suse.cz/ last time
> > the question of keeping the driver was asked (2023). Back then I was
> > able to find the cards on second hand market but now I can't on a local
> > market and there's exactly one hit on global eBay.
> >
> > Local linux related or telco support forums seem to mention the driver
> > until 2011 (root.cz, abclinuxu.cz, t-mobile.cz). It does not prove
> > nobody is using it but I think the chances are quite low to justify
> > keeping the driver. It is simple enough to be built as an external
> > module eventually, I can help with that in case somebody really needs
> > that.
>
> So, would you want to submit the removal? Or anyone else, if you don't
> want to lose time with this? (I can do that, if noone wants to.)
Let me do it after rc1 so I can finish the journey of this driver which
was my first nontrivial contribution to linux kernel.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
2026-02-18 15:23 ` David Sterba
@ 2026-03-09 11:18 ` Qingfang Deng
2026-03-09 11:25 ` Greg KH
0 siblings, 1 reply; 14+ messages in thread
From: Qingfang Deng @ 2026-03-09 11:18 UTC (permalink / raw)
To: David Sterba
Cc: Jiri Slaby, Jiri Kosina, Greg KH, duoming, linux-serial,
linux-kernel, dsterba, kuba, alexander.deucher, akpm, pkshih,
tglx, mingo
Hi, David
On Wed, 18 Feb 2026 16:23:30 +0100, David Sterba wrote:
> On Tue, Feb 17, 2026 at 09:03:25AM +0100, Jiri Slaby wrote:
> > Hi,
> >
> > On 09. 02. 26, 11:21, David Sterba wrote:
> > > On Sun, Feb 08, 2026 at 06:25:38PM +0100, Jiri Kosina wrote:
> > >> On Sun, 8 Feb 2026, Greg KH wrote:
> > >>
> > >>>> I don't have the real hardware. In order to reproduce the bug, I simulate
> > >>>> the IPWireless PCMCIA card in the qemu by allocating and configuring the
> > >>>> necessary resources(I/O ports, memory regions, interrupts and so on) to
> > >>>> correspond with the hardware expected by the driver in the initialization
> > >>>> code of the virtual device.
> > >>>
> > >>> I wonder if this device even is still around, given that pcmcia is all
> > >>> but dead for a very long time.
> > >>
> > >> I doubt that this device is still around anywhere where reasonably new
> > >> kernels (including LTS) would matter.
> > >>
> > >> I don't think I've seen this device (which was back then donated to me by
> > >> T-Mobile CZ in order to get it supported in Linux, and I am not sure how
> > >> much global adoption it got afterwards) for, let's say, past 15 years :)
> > >>
> > >> I think (let's see what David, ho took the maintainership over for me
> > >> afterwards, has to say) we'd better deprecate and drop the whole thing,
> > >> rather than trying to pretend that it's still actively being taken care
> > >> of.
> > >
> > > https://lore.kernel.org/all/20230223172403.GW10580@suse.cz/ last time
> > > the question of keeping the driver was asked (2023). Back then I was
> > > able to find the cards on second hand market but now I can't on a local
> > > market and there's exactly one hit on global eBay.
> > >
> > > Local linux related or telco support forums seem to mention the driver
> > > until 2011 (root.cz, abclinuxu.cz, t-mobile.cz). It does not prove
> > > nobody is using it but I think the chances are quite low to justify
> > > keeping the driver. It is simple enough to be built as an external
> > > module eventually, I can help with that in case somebody really needs
> > > that.
> >
> > So, would you want to submit the removal? Or anyone else, if you don't
> > want to lose time with this? (I can do that, if noone wants to.)
>
> Let me do it after rc1 so I can finish the journey of this driver which
> was my first nontrivial contribution to linux kernel.
I found a memory leak in the driver:
- https://lore.kernel.org/linux-serial/20260306034058.386747-1-dqfext@gmail.com/T/
The bug has been present since the first version of this driver, but it
seems no one has noticed it until now. So I believe the driver has not
been actively used.
Regards,
Qingfang
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal
2026-03-09 11:18 ` Qingfang Deng
@ 2026-03-09 11:25 ` Greg KH
0 siblings, 0 replies; 14+ messages in thread
From: Greg KH @ 2026-03-09 11:25 UTC (permalink / raw)
To: Qingfang Deng
Cc: David Sterba, Jiri Slaby, Jiri Kosina, duoming, linux-serial,
linux-kernel, dsterba, kuba, alexander.deucher, akpm, pkshih,
tglx, mingo
On Mon, Mar 09, 2026 at 07:18:18PM +0800, Qingfang Deng wrote:
> Hi, David
>
> On Wed, 18 Feb 2026 16:23:30 +0100, David Sterba wrote:
> > On Tue, Feb 17, 2026 at 09:03:25AM +0100, Jiri Slaby wrote:
> > > Hi,
> > >
> > > On 09. 02. 26, 11:21, David Sterba wrote:
> > > > On Sun, Feb 08, 2026 at 06:25:38PM +0100, Jiri Kosina wrote:
> > > >> On Sun, 8 Feb 2026, Greg KH wrote:
> > > >>
> > > >>>> I don't have the real hardware. In order to reproduce the bug, I simulate
> > > >>>> the IPWireless PCMCIA card in the qemu by allocating and configuring the
> > > >>>> necessary resources(I/O ports, memory regions, interrupts and so on) to
> > > >>>> correspond with the hardware expected by the driver in the initialization
> > > >>>> code of the virtual device.
> > > >>>
> > > >>> I wonder if this device even is still around, given that pcmcia is all
> > > >>> but dead for a very long time.
> > > >>
> > > >> I doubt that this device is still around anywhere where reasonably new
> > > >> kernels (including LTS) would matter.
> > > >>
> > > >> I don't think I've seen this device (which was back then donated to me by
> > > >> T-Mobile CZ in order to get it supported in Linux, and I am not sure how
> > > >> much global adoption it got afterwards) for, let's say, past 15 years :)
> > > >>
> > > >> I think (let's see what David, ho took the maintainership over for me
> > > >> afterwards, has to say) we'd better deprecate and drop the whole thing,
> > > >> rather than trying to pretend that it's still actively being taken care
> > > >> of.
> > > >
> > > > https://lore.kernel.org/all/20230223172403.GW10580@suse.cz/ last time
> > > > the question of keeping the driver was asked (2023). Back then I was
> > > > able to find the cards on second hand market but now I can't on a local
> > > > market and there's exactly one hit on global eBay.
> > > >
> > > > Local linux related or telco support forums seem to mention the driver
> > > > until 2011 (root.cz, abclinuxu.cz, t-mobile.cz). It does not prove
> > > > nobody is using it but I think the chances are quite low to justify
> > > > keeping the driver. It is simple enough to be built as an external
> > > > module eventually, I can help with that in case somebody really needs
> > > > that.
> > >
> > > So, would you want to submit the removal? Or anyone else, if you don't
> > > want to lose time with this? (I can do that, if noone wants to.)
> >
> > Let me do it after rc1 so I can finish the journey of this driver which
> > was my first nontrivial contribution to linux kernel.
>
> I found a memory leak in the driver:
>
> - https://lore.kernel.org/linux-serial/20260306034058.386747-1-dqfext@gmail.com/T/
>
> The bug has been present since the first version of this driver, but it
> seems no one has noticed it until now. So I believe the driver has not
> been actively used.
A small memory leak like that will probably not be noticed at all, so I
don't think that shows how many people are using the driver, sorry.
greg k-h
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-03-09 11:25 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-08 6:25 [PATCH] tty: ipwireless: Fix use-after-free in tasklet during device removal Duoming Zhou
2026-02-08 6:38 ` Greg KH
2026-02-08 10:28 ` duoming
2026-02-08 11:00 ` Greg KH
2026-02-08 13:57 ` duoming
2026-02-08 14:34 ` Greg KH
2026-02-08 14:53 ` duoming
2026-02-08 14:58 ` Greg KH
2026-02-08 17:25 ` Jiri Kosina
2026-02-09 10:21 ` David Sterba
2026-02-17 8:03 ` Jiri Slaby
2026-02-18 15:23 ` David Sterba
2026-03-09 11:18 ` Qingfang Deng
2026-03-09 11:25 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox