Skip to contentSkip to conversation

bonding: fix send_peer_notif data truncation

PATCH Superseded liaichun 3 participants 3 messages Jan 26, 2021 – Jan 27, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

liaichun

author
#0 lore raw

PATCH 1/1 bonding: fix send_peer_notif data truncation

send_peer_notif is u8, the value of this parameter is obtained from u8*int, the data may 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")
---
 include/net/bonding.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/bonding.h +1 -1
@@ -215,7 +215,7 @@ struct bonding {
 	 */
 	spinlock_t mode_lock;
 	spinlock_t stats_lock;
-	u8	 send_peer_notif;
+	u64	 send_peer_notif;
 	u8       igmp_retrans;
 #ifdef CONFIG_PROC_FS
 	struct   proc_dir_entry *proc_entry;

--
2.19.1

maintainer
#1 lore raw
Quoted 2 lines · On Tue, 26 Jan 2021 11:52:01 +0000 liaichun wrote:

send_peer_notif is u8, the value of this parameter is obtained from u8*int, the data may be truncated.
And in practice, more than u8(256) characters are used.

New line before Fixes

Quoted 2 lines
Fixes 07a4ddec3ce9 ("bonding: add an option to specify a delay between peer notifications")

no new line after Fixes

Quoted 1 line

Please CC these folks on v2:

BONDING DRIVER
M: Jay Vosburgh <[email protected]>
M: Veaceslav Falico <[email protected]>
M: Andy Gospodarek <[email protected]>

include/net/bonding.h struct bonding { · line 221

Quoted 12 lines
include/net/bonding.h +1 -1
@@ -215,7 +215,7 @@ struct bonding {
 	 */
 	spinlock_t mode_lock;
 	spinlock_t stats_lock;
-	u8	 send_peer_notif;
+	u64	 send_peer_notif;
 	u8       igmp_retrans;
 #ifdef CONFIG_PROC_FS
 	struct   proc_dir_entry *proc_entry;

This breaks 32bit builds, as the value is used in divisions.

Please fix and resend.

#2 lore raw
In reply to liaichun
Thank you for the patch! Yet something to improve:

Hi liaichun,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net/master]

url:    https://github.com/0day-ci/linux/commits/liaichun/bonding-fix-send_peer_notif-data-truncation/20210127-081947
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 07d46d93c9acdfe0614071d73c415dd5f745cc6e
config: parisc-defconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/2cc126f82ce8efc1217f123cfeac750b3a7fba2c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review liaichun/bonding-fix-send_peer_notif-data-truncation/20210127-081947 git checkout 2cc126f82ce8efc1217f123cfeac750b3a7fba2c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "__umoddi3" [drivers/net/bonding/bonding.ko] undefined!

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org