[PATCH] comedi: test kmemleak

From: xiaopeitux

Date: Mon Dec 15 2025 - 03:52:20 EST


From: Pei Xiao <xiaopei01@xxxxxxxxxx>

#syz test
---
drivers/comedi/comedi_fops.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/comedi/comedi_fops.c b/drivers/comedi/comedi_fops.c
index 657c98cd723e..283a64613208 100644
--- a/drivers/comedi/comedi_fops.c
+++ b/drivers/comedi/comedi_fops.c
@@ -1935,6 +1935,11 @@ static int do_cmd_ioctl(struct comedi_device *dev,
return 0;

cleanup:
+
+ if (async && async->cmd.chanlist) {
+ kfree(async->cmd.chanlist);
+ async->cmd.chanlist = NULL;
+ }
do_become_nonbusy(dev, s);

return ret;
--
2.25.1