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

From: Madhuparna Bhowmik
Date: Fri Jul 24 2020 - 00:48:22 EST


On Thu, Jul 23, 2020 at 03:11:58PM -0700, David Miller wrote:
> From: madhuparnabhowmik10@xxxxxxxxx
> Date: Wed, 22 Jul 2020 22:53:29 +0530
>
> > From: Madhuparna Bhowmik <madhuparnabhowmik10@xxxxxxxxx>
> >
> > 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@xxxxxxxxx>
>
> I agree with Arnd that this just exchanges one set of problems for
> another.

Thanks Arnd and David, for reviewing the patch.
Do you have any suggestions on how to fix this correctly?

Regards,
Madhuparna