Commit 16a03958 authored by Zhengchao Shao's avatar Zhengchao Shao Committed by Kalle Valo

wifi: libertas: fix memory leak in lbs_init_adapter()

When kfifo_alloc() failed in lbs_init_adapter(), cmd buffer is not
released. Add free memory to processing error path.

Fixes: 7919b89c ("libertas: convert libertas driver to use an event/cmdresp queue")
Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20221208121448.2845986-1-shaozhengchao@huawei.com
parent 0c152867
...@@ -869,6 +869,7 @@ static int lbs_init_adapter(struct lbs_private *priv) ...@@ -869,6 +869,7 @@ static int lbs_init_adapter(struct lbs_private *priv)
ret = kfifo_alloc(&priv->event_fifo, sizeof(u32) * 16, GFP_KERNEL); ret = kfifo_alloc(&priv->event_fifo, sizeof(u32) * 16, GFP_KERNEL);
if (ret) { if (ret) {
pr_err("Out of memory allocating event FIFO buffer\n"); pr_err("Out of memory allocating event FIFO buffer\n");
lbs_free_cmd_buffer(priv);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment