[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87bl61utwl.fsf@keithp.com>
Date: Fri, 13 Aug 2021 10:38:34 -0700
From: Keith Packard <keithp@...thp.com>
To: Salah Triki <salah.triki@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: misc: chaoskey: remove useless else
Salah Triki <salah.triki@...il.com> writes:
> Remove useless else in order to make the code cleaner.
> - if (!dev->present) {
> - if (dev->open == 0) {
> - mutex_unlock(&dev->lock);
> + mutex_unlock(&dev->lock);
> +
> + if (!dev->present)
> + if (dev->open == 0)
> chaoskey_free(dev);
> - } else
> - mutex_unlock(&dev->lock);
> - } else
> - mutex_unlock(&dev->lock);
This accesses dev->present outside of the lock region introducing a
potential race condition.
--
-keith
Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)
Powered by blists - more mailing lists