提交 f4362867 编写于 作者: H H Hartley Sweeten 提交者: Greg Kroah-Hartman

staging: comedi: unionxx5: fix memory leak during subdevice init

In the subdevice init during the attach of this driver, private data
is allocated for each subdevice. The pointer to this data is then
saved in the subdevice 's->private' so it can be free'ed during the
detach.

In __unioxx5_subdev_init() an error path exists that can happen before
the allocated pointer is saved in s->private. Make sure the allocated
memory is free'ed before returning the error.
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 fb868541
......@@ -380,8 +380,10 @@ static int __unioxx5_subdev_init(struct comedi_device *dev,
return -ENOMEM;
ret = __comedi_request_region(dev, iobase, UNIOXX5_SIZE);
if (ret)
if (ret) {
kfree(usp);
return ret;
}
usp->usp_iobase = iobase;
/* defining modules types */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册