Commit b393f021 authored by Xin Long's avatar Xin Long Committed by Zhengchao Shao
Browse files

tipc: fix a possible memleak in tipc_buf_append

stable inclusion
from stable-v4.19.314
commit 01cd1b7b685751ee422d00d050292a3d277652d6
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9US4T
CVE: CVE-2024-36954

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=01cd1b7b685751ee422d00d050292a3d277652d6



--------------------------------

[ Upstream commit 97bf6f81b29a8efaf5d0983251a7450e5794370d ]

__skb_linearize() doesn't free the skb when it fails, so move
'*buf = NULL' after __skb_linearize(), so that the skb can be
freed on the err path.

Fixes: b7df21cf ("tipc: skb_linearize the head skb when reassembling msgs")
Reported-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Reviewed-by: default avatarTung Nguyen <tung.q.nguyen@dektech.com.au>
Link: https://lore.kernel.org/r/90710748c29a1521efac4f75ea01b3b7e61414cf.1714485818.git.lucien.xin@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
parent 6908dfce
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment