Re: [PATCH] pcmcia: synclink_cs: Fix use-after-free in mgslpc_ioctl()

From: Arnd Bergmann
Date: Thu Sep 15 2022 - 03:36:30 EST


On Thu, Sep 15, 2022, at 4:08 AM, Hyunwoo Kim wrote:
> There are 3 other pcmica drivers in the path
> "drivers/char/pcmcia/synclink_cs.c",
> the path of the "synclink_cs.c" driver I reported the UAF to.
> A similar UAF occurs in the "cm4000_cs.c" and "cm4040_cs.c" drivers.
> (this does not happen in scr24x_cs.c)
...
> In the cm4000_cs.c driver, the race condition flow is tricky because of
> the start/stop_monitor() functions.
>
> The overall flow is similar to cm4040_cs.c.
> Added one race condition to bypass the "dev->monitor_running" check.
>
>
> So, should the above two drivers be removed from the kernel like the
> synclink_cs.c driver?
>
> Or should I submit a patch that fixes the UAF?

There is a good chance that we can remove both now, along with the
synclink_cs. The scr24x driver is from 2016, but of course the
hardware is much older. The cm4040/cm4000 drivers are from 2005.
My guess is that the hardware still exists in actively used systems,
but none of them get upgraded to modern kernels any more.

Let's just ask the driver authors (Lubomir and Harald) if they
think the drivers may still be needed.

Arnd