Patch "openvswitch: Use kmalloc_size_roundup() to match ksize() usage" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    openvswitch: Use kmalloc_size_roundup() to match ksize() usage

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     openvswitch-use-kmalloc_size_roundup-to-match-ksize-.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3b5e05eb09dfd73b7f425fbd3b2a3df3680310ce
Author: Kees Cook <keescook@xxxxxxxxxxxx>
Date:   Tue Oct 18 02:06:33 2022 -0700

    openvswitch: Use kmalloc_size_roundup() to match ksize() usage
    
    [ 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 <pshelar@xxxxxxx>
    Cc: dev@xxxxxxxxxxxxxxx
    Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221018090628.never.537-kees@xxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 4a07ab094a84..ead5418c126e 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -2309,7 +2309,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);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux