[ldv-project] [PATCH] drivers: isdn: capi: Fix data-race bug

Arnd Bergmann arnd at arndb.de
Wed Jul 22 21:41:23 MSK 2020


On Wed, Jul 22, 2020 at 7:23 PM <madhuparnabhowmik10 at gmail.com> wrote:
>
> From: Madhuparna Bhowmik <madhuparnabhowmik10 at gmail.com>
>
> In capi_init(), after register_chrdev() the file operation callbacks
> can be called. However capinc_tty_init() is called later.
> Since capiminors and capinc_tty_driver are initialized in
> capinc_tty_init(), their initialization can race with their usage
> in various callbacks like in capi_release().
>
> Therefore, call capinc_tty_init() before register_chrdev to avoid
> such race conditions.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10 at gmail.com>

I don't think there are any users of this driver, but I had a look anyway.

The patch looks reasonable at first, but I'm not sure if you just
replace one race with another, since now the tty device can be
opened before the rest of the subsystem is initialized.

It's probably fine.

         Arnd



More information about the ldv-project mailing list