lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <eda05faf1e994f1faddb5b07007f0b93@huawei.com>
Date:   Wed, 27 Jan 2021 03:57:22 +0000
From:   liaichun <liaichun@...wei.com>
To:     "davem@...emloft.net" <davem@...emloft.net>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "j.vosburgh@...il.com" <j.vosburgh@...il.com>,
        "vfalico@...il.com" <vfalico@...il.com>,
        "andy@...yhouse.net" <andy@...yhouse.net>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: [PATCH net v2]bonding: fix send_peer_notif data truncation

send_peer_notif is u8, the value of this parameter is obtained from
 u8*int, it's easy to be truncated. And in practice, more than u8(256)
  characters are used.

Fixes: 07a4ddec3ce9 ("bonding: add an option to specify a delay between peer notifications")
Signed-off-by: Aichun Li <liaichun@...wei.com>
---
 include/net/bonding.h | 2 +-
 drivers/net/bonding/bond_main.c | 4 ++--
 2 file changed, 3 insertion(+), 3 deletion(-)

diff --git a/include/net/bonding.h b/include/net/bonding.h index 0960d9af7b8e..65394566d556 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -215,7 +215,7 @@ struct bonding {
 	 */
 	spinlock_t mode_lock;
 	spinlock_t stats_lock;
-	u8	 send_peer_notif;
+	u32	 send_peer_notif;
 	u8       igmp_retrans;
 #ifdef CONFIG_PROC_FS
 	struct   proc_dir_entry *proc_entry;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index b7db57e6c96a..336460538135 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -880,8 +880,8 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
 
 			if (netif_running(bond->dev)) {
 				bond->send_peer_notif =
-					bond->params.num_peer_notif *
-					max(1, bond->params.peer_notif_delay);
+					(u32)(bond->params.num_peer_notif *
+					max(1, bond->params.peer_notif_delay));
 				should_notify_peers =
 					bond_should_notify_peers(bond);
 			}
--
2.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ