5.15-stable review patch.  If anyone has any objections, please let me know.

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

From: Kees Cook <keesc...@chromium.org>

[ Upstream commit ab3f7828c9793a5dfa99a54dc19ae3491c38bfa3 ]

Round up allocations with kmalloc_size_roundup() so that openvswitch's
use of ksize() is always accurate and no special handling of the memory
is needed by KASAN, UBSAN_BOUNDS, nor FORTIFY_SOURCE.

Cc: Pravin B Shelar <pshe...@ovn.org>
Cc: d...@openvswitch.org
Signed-off-by: Kees Cook <keesc...@chromium.org>
Link: https://lore.kernel.org/r/20221018090628.never.537-k...@kernel.org
Signed-off-by: Jakub Kicinski <k...@kernel.org>
Stable-dep-of: a1e64addf3ff ("net: openvswitch: remove misbehaving actions 
length check")
Signed-off-by: Sasha Levin <sas...@kernel.org>
---
 net/openvswitch/flow_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 1cf431d04a468..b8607c3fee4be 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -2281,7 +2281,7 @@ static struct sw_flow_actions *nla_alloc_flow_actions(int 
size)
 
        WARN_ON_ONCE(size > MAX_ACTIONS_BUFSIZE);
 
-       sfa = kmalloc(sizeof(*sfa) + size, GFP_KERNEL);
+       sfa = kmalloc(kmalloc_size_roundup(sizeof(*sfa) + size), GFP_KERNEL);
        if (!sfa)
                return ERR_PTR(-ENOMEM);
 
-- 
2.39.5



_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to