This is a note to let you know that I've just added the patch titled ethtool: fix stack overflow in ethnl_parse_bitset() to the 5.9-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: ethtool-fix-stack-overflow-in-ethnl_parse_bitset.patch and it can be found in the queue-5.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Sat Dec 19 11:38:44 AM CET 2020 From: Michal Kubecek <mkubecek@xxxxxxx> Date: Tue, 8 Dec 2020 23:13:51 +0100 Subject: ethtool: fix stack overflow in ethnl_parse_bitset() From: Michal Kubecek <mkubecek@xxxxxxx> [ Upstream commit a770bf515613c6e12ae904c3593e26016de99448 ] Syzbot reported a stack overflow in bitmap_from_arr32() called from ethnl_parse_bitset() when bitset from netlink message is longer than target bitmap length. While ethnl_compact_sanity_checks() makes sure that trailing part is all zeros (i.e. the request does not try to touch bits kernel does not recognize), we also need to cap change_bits to nbits so that we don't try to write past the prepared bitmaps. Fixes: 88db6d1e4f62 ("ethtool: add ethnl_parse_bitset() helper") Reported-by: syzbot+9d39fa49d4df294aab93@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Michal Kubecek <mkubecek@xxxxxxx> Link: https://lore.kernel.org/r/3487ee3a98e14cd526f55b6caaa959d2dcbcad9f.1607465316.git.mkubecek@xxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/ethtool/bitset.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/ethtool/bitset.c +++ b/net/ethtool/bitset.c @@ -630,6 +630,8 @@ int ethnl_parse_bitset(unsigned long *va return ret; change_bits = nla_get_u32(tb[ETHTOOL_A_BITSET_SIZE]); + if (change_bits > nbits) + change_bits = nbits; bitmap_from_arr32(val, nla_data(tb[ETHTOOL_A_BITSET_VALUE]), change_bits); if (change_bits < nbits) Patches currently in stable-queue which might be from mkubecek@xxxxxxx are queue-5.9/ethtool-fix-stack-overflow-in-ethnl_parse_bitset.patch