fbdev: smscufx: Fix use-after-free in ufx_ops_open()
authorHyunwoo Kim <imv4bel@gmail.com>
Sun, 25 Sep 2022 13:32:43 +0000 (06:32 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 11:16:56 +0000 (13:16 +0200)
commitfa008859983d9231b9241a4b9eac7aabfbb45155
treec336622c37c2c78dddf37c72158bb72be1dd167b
parent635f7adceeb9980a767c002c9bb4b5272ba1bceb
fbdev: smscufx: Fix use-after-free in ufx_ops_open()

commit 5610bcfe8693c02e2e4c8b31427f1bdbdecc839c upstream.

A race condition may occur if the user physically removes the
USB device while calling open() for this device node.

This is a race condition between the ufx_ops_open() function and
the ufx_usb_disconnect() function, which may eventually result in UAF.

So, add a mutex to the ufx_ops_open() and ufx_usb_disconnect() functions
to avoid race contidion of krefs.

Signed-off-by: Hyunwoo Kim <imv4bel@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/video/fbdev/smscufx.c