projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
461cd37
)
dmaengine: idxd: Fix the error handling path in idxd_cdev_register()
author
Christophe JAILLET
<christophe.jaillet@wanadoo.fr>
Thu, 21 Apr 2022 06:13:38 +0000
(08:13 +0200)
committer
Vinod Koul
<vkoul@kernel.org>
Mon, 16 May 2022 11:28:32 +0000
(16:58 +0530)
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>
drivers/dma/idxd/cdev.c
patch
|
blob
|
history
diff --git
a/drivers/dma/idxd/cdev.c
b/drivers/dma/idxd/cdev.c
index b670b75885ad4461731ca46689db339b5d495d2e..bd44293804d1b14880137df10cf44866855cc219 100644
(file)
--- a/
drivers/dma/idxd/cdev.c
+++ b/
drivers/dma/idxd/cdev.c
@@
-369,10
+369,16
@@
int idxd_cdev_register(void)
rc = alloc_chrdev_region(&ictx[i].devt, 0, MINORMASK,
ictx[i].name);
if (rc)
-
return rc
;
+
goto err_free_chrdev_region
;
}
return 0;
+
+err_free_chrdev_region:
+ for (i--; i >= 0; i--)
+ unregister_chrdev_region(ictx[i].devt, MINORMASK);
+
+ return rc;
}
void idxd_cdev_remove(void)