]> git.baikalelectronics.ru Git - kernel.git/commit
bonding: fix send_peer_notif overflow
authorHangbin Liu <liuhangbin@gmail.com>
Tue, 9 May 2023 03:11:57 +0000 (11:11 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 May 2023 16:32:32 +0000 (17:32 +0100)
commit032267f053392cd6f9d8e735315ceb9e8f5db8f3
treebcf9d35dfd1b38b77d3111ca191dfec235fbd264
parent683428a2a0adda166471784bd09760a66666283e
bonding: fix send_peer_notif overflow

[ Upstream commit 9949e2efb54eb3001cb2f6512ff3166dddbfb75d ]

Bonding send_peer_notif was defined as u8. Since commit cbce5dcd3330
("bonding: add an option to specify a delay between peer notifications").
the bond->send_peer_notif will be num_peer_notif multiplied by
peer_notif_delay, which is u8 * u32. This would cause the send_peer_notif
overflow easily. e.g.

  ip link add bond0 type bond mode 1 miimon 100 num_grat_arp 30 peer_notify_delay 1000

To fix the overflow, let's set the send_peer_notif to u32 and limit
peer_notif_delay to 300s.

Reported-by: Liang Li <liali@redhat.com>
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2090053
Fixes: cbce5dcd3330 ("bonding: add an option to specify a delay between peer notifications")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/bonding/bond_netlink.c
drivers/net/bonding/bond_options.c
include/net/bonding.h