Message ID | 20210731072732.103631-1-zhengyongjun3@huawei.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [-next] net: ax25: Fix error path of ax25_init() | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | success | CCed 6 of 6 maintainers |
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: 0 this patch: 5 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 36 lines checked |
netdev/build_allmodconfig_warn | fail | Errors and warnings before: 0 this patch: 5 |
netdev/header_inline | success | Link |
Hi Zheng, Thank you for the patch! Yet something to improve: [auto build test ERROR on next-20210730] url: https://github.com/0day-ci/linux/commits/Zheng-Yongjun/net-ax25-Fix-error-path-of-ax25_init/20210731-153149 base: 8d4b477da1a807199ca60e0829357ce7aa6758d5 config: riscv-randconfig-r022-20210730 (attached as .config) compiler: riscv64-linux-gcc (GCC) 10.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/add0b8cab6f698386d51feb5d99180059fad64e3 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Zheng-Yongjun/net-ax25-Fix-error-path-of-ax25_init/20210731-153149 git checkout add0b8cab6f698386d51feb5d99180059fad64e3 # save the attached .config to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=riscv SHELL=/bin/bash net/ax25/ 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 >>): net/ax25/af_ax25.c: In function 'ax25_init': >> net/ax25/af_ax25.c:1986:5: error: void value not ignored as it ought to be 1986 | rc = dev_add_pack(&ax25_packet_type); | ^ vim +1986 net/ax25/af_ax25.c 1975 1976 static int __init ax25_init(void) 1977 { 1978 int rc = proto_register(&ax25_proto, 0); 1979 1980 if (rc) 1981 goto out; 1982 1983 rc = sock_register(&ax25_family_ops); 1984 if (rc) 1985 goto out_proto; > 1986 rc = dev_add_pack(&ax25_packet_type); 1987 if (rc) 1988 goto out_sock; 1989 rc = register_netdevice_notifier(&ax25_dev_notifier); 1990 if (rc) 1991 goto out_dev; 1992 1993 proc_create_seq("ax25_route", 0444, init_net.proc_net, &ax25_rt_seqops); 1994 proc_create_seq("ax25", 0444, init_net.proc_net, &ax25_info_seqops); 1995 proc_create_seq("ax25_calls", 0444, init_net.proc_net, 1996 &ax25_uid_seqops); 1997 1998 return 0; 1999 2000 out_dev: 2001 dev_remove_pack(&ax25_packet_type); 2002 out_sock: 2003 sock_unregister(PF_AX25); 2004 out_proto: 2005 proto_unregister(&ax25_proto); 2006 out: 2007 return rc; 2008 } 2009 module_init(ax25_init); 2010 2011 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 2631efc..4edc322 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1977,17 +1977,32 @@ static int __init ax25_init(void) { int rc = proto_register(&ax25_proto, 0); - if (rc != 0) + if (rc) goto out; - sock_register(&ax25_family_ops); - dev_add_pack(&ax25_packet_type); - register_netdevice_notifier(&ax25_dev_notifier); + rc = sock_register(&ax25_family_ops); + if (rc) + goto out_proto; + rc = dev_add_pack(&ax25_packet_type); + if (rc) + goto out_sock; + rc = register_netdevice_notifier(&ax25_dev_notifier); + if (rc) + goto out_dev; proc_create_seq("ax25_route", 0444, init_net.proc_net, &ax25_rt_seqops); proc_create_seq("ax25", 0444, init_net.proc_net, &ax25_info_seqops); proc_create_seq("ax25_calls", 0444, init_net.proc_net, &ax25_uid_seqops); + + return 0; + +out_dev: + dev_remove_pack(&ax25_packet_type); +out_sock: + sock_unregister(PF_AX25); +out_proto: + proto_unregister(&ax25_proto); out: return rc; }
This patch add error path for ax25_init() to avoid possible crash if some error occurs. Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com> --- net/ax25/af_ax25.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)