[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202007261828.HN14Tj4f%lkp@intel.com>
Date: Sun, 26 Jul 2020 18:12:16 +0800
From: kernel test robot <lkp@...el.com>
To: B K Karthik <bkkarthik@...u.pes.edu>,
Steffen Klassert <steffen.klassert@...unet.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org,
gregkh@...uxfoundation.org, skhan@...uxfoundation.org
Cc: kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
netdev@...r.kernel.org
Subject: Re: [PATCH] net: ipv6: fix slab-out-of-bounda Read in
xfrm6_tunnel_alloc_spi
Hi K,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on ipsec/master]
[also build test WARNING on ipsec-next/master sparc-next/master net-next/master net/master v5.8-rc6 next-20200724]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/B-K-Karthik/net-ipv6-fix-slab-out-of-bounda-Read-in-xfrm6_tunnel_alloc_spi/20200725-204631
base: https://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec.git master
config: x86_64-randconfig-r032-20200726 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 8bf4c1f4fb257774f66c8cda07adc6c5e8668326)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> net/ipv6/xfrm6_tunnel.c:126:13: warning: address of array 'xfrm6_tn->spi_byspi' will always evaluate to 'true' [-Wpointer-bool-conversion]
xfrm6_tn->spi_byspi)
~~~~~~~~~~^~~~~~~~~
1 warning generated.
vim +126 net/ipv6/xfrm6_tunnel.c
116
117 static u32 __xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr)
118 {
119 struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net);
120 u32 spi;
121 struct xfrm6_tunnel_spi *x6spi;
122 int index;
123
124 if ((xfrm6_tn->spi < XFRM6_TUNNEL_SPI_MIN ||
125 xfrm6_tn->spi >= XFRM6_TUNNEL_SPI_MAX) &&
> 126 xfrm6_tn->spi_byspi)
127 xfrm6_tn->spi = XFRM6_TUNNEL_SPI_MIN;
128 else
129 xfrm6_tn->spi++;
130
131 for (spi = xfrm6_tn->spi; spi <= XFRM6_TUNNEL_SPI_MAX; spi++) {
132 index = __xfrm6_tunnel_spi_check(net, spi);
133 if (index >= 0)
134 goto alloc_spi;
135
136 if (spi == XFRM6_TUNNEL_SPI_MAX)
137 break;
138 }
139 for (spi = XFRM6_TUNNEL_SPI_MIN; spi < xfrm6_tn->spi; spi++) {
140 index = __xfrm6_tunnel_spi_check(net, spi);
141 if (index >= 0)
142 goto alloc_spi;
143 }
144 spi = 0;
145 goto out;
146 alloc_spi:
147 xfrm6_tn->spi = spi;
148 x6spi = kmem_cache_alloc(xfrm6_tunnel_spi_kmem, GFP_ATOMIC);
149 if (!x6spi)
150 goto out;
151
152 memcpy(&x6spi->addr, saddr, sizeof(x6spi->addr));
153 x6spi->spi = spi;
154 refcount_set(&x6spi->refcnt, 1);
155
156 hlist_add_head_rcu(&x6spi->list_byspi, &xfrm6_tn->spi_byspi[index]);
157
158 index = xfrm6_tunnel_spi_hash_byaddr(saddr);
159 hlist_add_head_rcu(&x6spi->list_byaddr, &xfrm6_tn->spi_byaddr[index]);
160 out:
161 return spi;
162 }
163
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (33089 bytes)
Powered by blists - more mailing lists