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-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 19 Jul 2023 16:44:37 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: oe-kbuild@...ts.linux.dev, Patrick Rohr <prohr@...gle.com>,
	"David S . Miller" <davem@...emloft.net>
Cc: lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
	Linux Network Development Mailing List <netdev@...r.kernel.org>,
	Patrick Rohr <prohr@...gle.com>,
	Maciej Żenczykowski <maze@...gle.com>,
	Lorenzo Colitti <lorenzo@...gle.com>
Subject: Re: [net-next] net: add sysctl accept_ra_min_rtr_lft

Hi Patrick,

kernel test robot noticed the following build warnings:

url:    https://github.com/intel-lab-lkp/linux/commits/Patrick-Rohr/net-add-sysctl-accept_ra_min_rtr_lft/20230719-053943
base:   net-next/main
patch link:    https://lore.kernel.org/r/20230718213709.688186-1-prohr%40google.com
patch subject: [net-next] net: add sysctl accept_ra_min_rtr_lft
config: x86_64-randconfig-m001-20230717 (https://download.01.org/0day-ci/archive/20230719/202307192116.N4bDjayg-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230719/202307192116.N4bDjayg-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
| Closes: https://lore.kernel.org/r/202307192116.N4bDjayg-lkp@intel.com/

smatch warnings:
net/ipv6/ndisc.c:1501 ndisc_router_discovery() error: uninitialized symbol 'lifetime'.

vim +/lifetime +1501 net/ipv6/ndisc.c

  1279  
  1280          if (!ndisc_parse_options(skb->dev, opt, optlen, &ndopts))
  1281                  return SKB_DROP_REASON_IPV6_NDISC_BAD_OPTIONS;
  1282  
  1283          if (!ipv6_accept_ra(in6_dev)) {
  1284                  ND_PRINTK(2, info,
  1285                            "RA: %s, did not accept ra for dev: %s\n",
  1286                            __func__, skb->dev->name);
  1287                  goto skip_linkparms;
                        ^^^^^^^^^^^^^^^^^^^^
This goto happens before lifetime is set

  1288          }
  1289  
  1290          lifetime = ntohs(ra_msg->icmph.icmp6_rt_lifetime);

Set here

  1291          if (lifetime != 0 && lifetime < in6_dev->cnf.accept_ra_min_rtr_lft) {
  1292                  ND_PRINTK(2, info,
  1293                            "RA: router lifetime (%ds) is too short: %s\n",
  1294                            lifetime, skb->dev->name);
  1295                  goto skip_linkparms;
  1296          }
  1297  
  1298  #ifdef CONFIG_IPV6_NDISC_NODETYPE

[ SNIP ]

  1464  
  1465  skip_linkparms:
  1466  
  1467          /*
  1468           *      Process options.
  1469           */
  1470  
  1471          if (!neigh)
  1472                  neigh = __neigh_lookup(&nd_tbl, &ipv6_hdr(skb)->saddr,
  1473                                         skb->dev, 1);
  1474          if (neigh) {
  1475                  u8 *lladdr = NULL;
  1476                  if (ndopts.nd_opts_src_lladdr) {
  1477                          lladdr = ndisc_opt_addr_data(ndopts.nd_opts_src_lladdr,
  1478                                                       skb->dev);
  1479                          if (!lladdr) {
  1480                                  ND_PRINTK(2, warn,
  1481                                            "RA: invalid link-layer address length\n");
  1482                                  goto out;
  1483                          }
  1484                  }
  1485                  ndisc_update(skb->dev, neigh, lladdr, NUD_STALE,
  1486                               NEIGH_UPDATE_F_WEAK_OVERRIDE|
  1487                               NEIGH_UPDATE_F_OVERRIDE|
  1488                               NEIGH_UPDATE_F_OVERRIDE_ISROUTER|
  1489                               NEIGH_UPDATE_F_ISROUTER,
  1490                               NDISC_ROUTER_ADVERTISEMENT, &ndopts);
  1491                  reason = SKB_CONSUMED;
  1492          }
  1493  
  1494          if (!ipv6_accept_ra(in6_dev)) {
  1495                  ND_PRINTK(2, info,
  1496                            "RA: %s, accept_ra is false for dev: %s\n",
  1497                            __func__, skb->dev->name);
  1498                  goto out;
  1499          }
  1500  
  1501          if (lifetime != 0 && lifetime < in6_dev->cnf.accept_ra_min_rtr_lft) {
                    ^^^^^^^^
Uninitialized

  1502                  ND_PRINTK(2, info,
  1503                            "RA: router lifetime (%ds) is too short: %s\n",
  1504                            lifetime, skb->dev->name);
  1505                  goto out;
  1506          }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ