mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
caif: fix memory leak in cfctrl_linkup_request()
[ Upstream commit fe69230f05897b3de758427b574fc98025dfc907 ] When linktype is unknown or kzalloc failed in cfctrl_linkup_request(), pkt is not released. Add release process to error path. Fixes:b482cd2053("net-caif: add CAIF core protocol stack") Fixes:8d545c8f95("caif: Disconnect without waiting for response") Signed-off-by: Zhengchao Shao <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
3cb1ee82e4
commit
33df9c5d5e
1 changed files with 5 additions and 1 deletions
|
|
@ -269,11 +269,15 @@ int cfctrl_linkup_request(struct cflayer *layer,
|
|||
default:
|
||||
pr_warn("Request setup of bad link type = %d\n",
|
||||
param->linktype);
|
||||
cfpkt_destroy(pkt);
|
||||
return -EINVAL;
|
||||
}
|
||||
req = kzalloc(sizeof(*req), GFP_KERNEL);
|
||||
if (!req)
|
||||
if (!req) {
|
||||
cfpkt_destroy(pkt);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
req->client_layer = user_layer;
|
||||
req->cmd = CFCTRL_CMD_LINK_SETUP;
|
||||
req->param = *param;
|
||||
|
|
|
|||
Loading…
Reference in a new issue