dmaengine: idxd: Fix the error handling path in idxd_cdev_register()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 21 Apr 2022 06:13:38 +0000 (08:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:23:14 +0000 (10:23 +0200)
commitb3c7b5d08e9d5b2ff31c03078c00ecf11042419f
treee9e77d195ae4c180666630620373b8cee48b6c5c
parentb9c9b4584b4b65fcf2d2d4d26ebfdca884bea525
dmaengine: idxd: Fix the error handling path in idxd_cdev_register()

[ Upstream commit aab08c1aac01097815fbcf10fce7021d2396a31f ]

If a call to alloc_chrdev_region() fails, the already allocated resources
are leaking.

Add the needed error handling path to fix the leak.

Fixes: 42d279f9137a ("dmaengine: idxd: add char driver to expose submission portal to userland")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/1b5033dcc87b5f2a953c413f0306e883e6114542.1650521591.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/dma/idxd/cdev.c