]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tipc: Use size_add() in calls to struct_size()
authorGustavo A. R. Silva <gustavoars@kernel.org>
Fri, 15 Sep 2023 19:16:26 +0000 (13:16 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:08:14 +0000 (11:08 +0100)
commit56e7424c6efc92e0fcdf5d478a069f1a55dbbdb1
treeee23b65eef9c53f7b8d5d5af1a65240ae4f513e1
parent3e51efcb29096b9d6db26455761559c1efa28ef2
tipc: Use size_add() in calls to struct_size()

[ Upstream commit 2506a91734754de690869824fb0d1ac592ec1266 ]

If, for any reason, the open-coded arithmetic causes a wraparound,
the protection that `struct_size()` adds against potential integer
overflows is defeated. Fix this by hardening call to `struct_size()`
with `size_add()`.

Fixes: e034c6d23bc4 ("tipc: Use struct_size() helper")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/tipc/link.c