]> git.hungrycats.org Git - linux/commit
fsi: occ: Prevent use after free
authorEddie James <eajames@linux.ibm.com>
Fri, 13 May 2022 19:44:24 +0000 (14:44 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Oct 2022 07:58:28 +0000 (09:58 +0200)
commit1d5ad0a874ddfcee9f932f54b1d34cbe8b9ddcfe
tree6e92b751821735fc16ea1b3d2f534580b73b6fa4
parentfbcf76240a308be8c0761f8dce28304ec27df709
fsi: occ: Prevent use after free

[ Upstream commit d3e1e24604031b0d83b6c2d38f54eeea265cfcc0 ]

Use get_device and put_device in the open and close functions to
make sure the device doesn't get freed while a file descriptor is
open.
Also, lock around the freeing of the device buffer and check the
buffer before using it in the submit function.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220513194424.53468-1-eajames@linux.ibm.com
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/fsi/fsi-occ.c