From: kernel test robot <lkp@intel.com>
To: B K Karthik <bkkarthik@pesu.pes.edu>,
Steffen Klassert <steffen.klassert@secunet.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
Jakub Kicinski <kuba@kernel.org>,
linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
skhan@linuxfoundation.org
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
netdev@vger.kernel.org
Subject: Re: [PATCH] net: ipv6: fix slab-out-of-bounda Read in xfrm6_tunnel_alloc_spi
Date: Sun, 26 Jul 2020 18:12:16 +0800 [thread overview]
Message-ID: <202007261828.HN14Tj4f%lkp@intel.com> (raw)
In-Reply-To: <20200725124553.zunta65rf3j23cth@pesu.pes.edu>
[-- Attachment #1: Type: text/plain, Size: 3291 bytes --]
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@intel.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
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33089 bytes --]
next prev parent reply other threads:[~2020-07-26 10:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-25 12:45 B K Karthik
2020-07-26 10:12 ` kernel test robot [this message]
2020-07-29 0:29 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202007261828.HN14Tj4f%lkp@intel.com \
--to=lkp@intel.com \
--cc=bkkarthik@pesu.pes.edu \
--cc=clang-built-linux@googlegroups.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=kbuild-all@lists.01.org \
--cc=kuba@kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=steffen.klassert@secunet.com \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®