diff mbox series

[net] bonding: fix send_peer_notif data truncation

Message ID e27dd20165a14d99bc2b406061e60bcd@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net] bonding: fix send_peer_notif data truncation | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers warning 1 maintainers not CCed: vincent@bernat.ch
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit fail Errors and warnings before: 13 this patch: 17
netdev/kdoc success Errors and warnings before: 2 this patch: 2
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: From:/Signed-off-by: email name mismatch: 'From: liaichun <liaichun@huawei.com>' != 'Signed-off-by: Aichun Li <liaichun@huawei.com>'
netdev/build_allmodconfig_warn success Errors and warnings before: 13 this patch: 13
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Aichun Li Jan. 26, 2021, 11:52 a.m. UTC
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")

Signed-off-by: Aichun Li <liaichun@huawei.com>
---
 include/net/bonding.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.19.1

Comments

Jakub Kicinski Jan. 27, 2021, 2:19 a.m. UTC | #1
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

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

no new line after Fixes

> Signed-off-by: Aichun Li <liaichun@huawei.com>

Please CC these folks on v2:

BONDING DRIVER
M:	Jay Vosburgh <j.vosburgh@gmail.com>
M:	Veaceslav Falico <vfalico@gmail.com>
M:	Andy Gospodarek <andy@greyhouse.net>

> 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;
> +	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.
kernel test robot Jan. 27, 2021, 5:05 a.m. UTC | #2
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
Reported-by: kernel test robot <lkp@intel.com>

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@lists.01.org
diff mbox series

Patch

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;
+	u64	 send_peer_notif;
 	u8       igmp_retrans;
 #ifdef CONFIG_PROC_FS
 	struct   proc_dir_entry *proc_entry;