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-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.22.394.2208271630440.6645@hadrien>
Date:   Sat, 27 Aug 2022 16:31:50 +0200 (CEST)
From:   Julia Lawall <julia.lawall@...ia.fr>
To:     Dmitry Safonov <dima@...sta.com>,
        Eric Dumazet <edumazet@...gle.com>,
        "David S. Miller" <davem@...emloft.net>,
        linux-kernel@...r.kernel.org, kbuild-all@...ts.01.org
Subject: Re: [PATCH 10/31] net/tcp: Calculate TCP-AO traffic keys (fwd)

Please check the kfree on lie 332.

julia

---------- Forwarded message ----------
Date: Sat, 27 Aug 2022 11:58:33 +0800
From: kernel test robot <lkp@...el.com>
To: kbuild@...ts.01.org
Cc: lkp@...el.com, Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 10/31] net/tcp: Calculate TCP-AO traffic keys

BCC: lkp@...el.com
CC: kbuild-all@...ts.01.org
In-Reply-To: <20220818170005.747015-11-dima@...sta.com>
References: <20220818170005.747015-11-dima@...sta.com>
TO: Dmitry Safonov <dima@...sta.com>
TO: Eric Dumazet <edumazet@...gle.com>
TO: "David S. Miller" <davem@...emloft.net>
CC: netdev@...r.kernel.org
TO: linux-kernel@...r.kernel.org
CC: Dmitry Safonov <dima@...sta.com>
CC: Andy Lutomirski <luto@...capital.net>
CC: Ard Biesheuvel <ardb@...nel.org>
CC: Bob Gilligan <gilligan@...sta.com>
CC: David Ahern <dsahern@...nel.org>
CC: Eric Biggers <ebiggers@...nel.org>
CC: Francesco Ruggeri <fruggeri@...sta.com>
CC: Herbert Xu <herbert@...dor.apana.org.au>
CC: Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>
CC: Ivan Delalande <colona@...sta.com>
CC: Jakub Kicinski <kuba@...nel.org>
CC: Leonard Crestez <cdleonard@...il.com>
CC: Paolo Abeni <pabeni@...hat.com>
CC: Salam Noureddine <noureddine@...sta.com>
CC: Shuah Khan <skhan@...uxfoundation.org>
CC: linux-crypto@...r.kernel.org

Hi Dmitry,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on e34cfee65ec891a319ce79797dda18083af33a76]

url:    https://github.com/intel-lab-lkp/linux/commits/Dmitry-Safonov/net-tcp-Add-TCP-AO-support/20220819-010628
base:   e34cfee65ec891a319ce79797dda18083af33a76
:::::: branch date: 8 days ago
:::::: commit date: 8 days ago
config: x86_64-randconfig-c002 (https://download.01.org/0day-ci/archive/20220827/202208271151.00tHdiGE-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Julia Lawall <julia.lawall@...6.fr>

cocci warnings: (new ones prefixed by >>)
>> net/ipv4/tcp_ao.c:333:21-32: ERROR: reference preceded by free on line 332

vim +333 net/ipv4/tcp_ao.c

a58f130caaa0601 Dmitry Safonov 2022-08-18  280
a58f130caaa0601 Dmitry Safonov 2022-08-18  281  void tcp_ao_connect_init(struct sock *sk)
a58f130caaa0601 Dmitry Safonov 2022-08-18  282  {
a58f130caaa0601 Dmitry Safonov 2022-08-18  283  	struct tcp_ao_info *ao_info;
a58f130caaa0601 Dmitry Safonov 2022-08-18  284  	struct tcp_ao_key *key;
a58f130caaa0601 Dmitry Safonov 2022-08-18  285  	struct tcp_sock *tp = tcp_sk(sk);
a58f130caaa0601 Dmitry Safonov 2022-08-18  286  	union tcp_ao_addr *addr;
a58f130caaa0601 Dmitry Safonov 2022-08-18  287  	int family;
a58f130caaa0601 Dmitry Safonov 2022-08-18  288
a58f130caaa0601 Dmitry Safonov 2022-08-18  289  	ao_info = rcu_dereference_protected(tp->ao_info,
a58f130caaa0601 Dmitry Safonov 2022-08-18  290  					    lockdep_sock_is_held(sk));
a58f130caaa0601 Dmitry Safonov 2022-08-18  291  	if (!ao_info)
a58f130caaa0601 Dmitry Safonov 2022-08-18  292  		return;
a58f130caaa0601 Dmitry Safonov 2022-08-18  293
a58f130caaa0601 Dmitry Safonov 2022-08-18  294  	/* Remove all keys that don't match the peer */
a58f130caaa0601 Dmitry Safonov 2022-08-18  295  	family = sk->sk_family;
a58f130caaa0601 Dmitry Safonov 2022-08-18  296  	if (family == AF_INET)
a58f130caaa0601 Dmitry Safonov 2022-08-18  297  		addr = (union tcp_ao_addr *)&sk->sk_daddr;
a58f130caaa0601 Dmitry Safonov 2022-08-18  298  	else
a58f130caaa0601 Dmitry Safonov 2022-08-18  299  		addr = (union tcp_ao_addr *)&sk->sk_v6_daddr;
a58f130caaa0601 Dmitry Safonov 2022-08-18  300
a58f130caaa0601 Dmitry Safonov 2022-08-18  301  	hlist_for_each_entry_rcu(key, &ao_info->head, node) {
a58f130caaa0601 Dmitry Safonov 2022-08-18  302  		if (tcp_ao_key_cmp(key, addr, key->prefixlen, family,
a58f130caaa0601 Dmitry Safonov 2022-08-18  303  		    -1, -1, sk->sk_dport) == 0)
a58f130caaa0601 Dmitry Safonov 2022-08-18  304  			continue;
a58f130caaa0601 Dmitry Safonov 2022-08-18  305
a58f130caaa0601 Dmitry Safonov 2022-08-18  306  		if (key == ao_info->current_key)
a58f130caaa0601 Dmitry Safonov 2022-08-18  307  			ao_info->current_key = NULL;
a58f130caaa0601 Dmitry Safonov 2022-08-18  308  		if (key == ao_info->rnext_key)
a58f130caaa0601 Dmitry Safonov 2022-08-18  309  			ao_info->rnext_key = NULL;
a58f130caaa0601 Dmitry Safonov 2022-08-18  310  		hlist_del_rcu(&key->node);
a58f130caaa0601 Dmitry Safonov 2022-08-18  311  		crypto_pool_release(key->crypto_pool_id);
a58f130caaa0601 Dmitry Safonov 2022-08-18  312  		atomic_sub(tcp_ao_sizeof_key(key), &sk->sk_omem_alloc);
a58f130caaa0601 Dmitry Safonov 2022-08-18  313  		kfree_rcu(key, rcu);
a58f130caaa0601 Dmitry Safonov 2022-08-18  314  	}
a58f130caaa0601 Dmitry Safonov 2022-08-18  315
a58f130caaa0601 Dmitry Safonov 2022-08-18  316  	key = tp->af_specific->ao_lookup(sk, sk, -1, -1);
a58f130caaa0601 Dmitry Safonov 2022-08-18  317  	if (key) {
a58f130caaa0601 Dmitry Safonov 2022-08-18  318  		/* if current_key or rnext_key were not provided,
a58f130caaa0601 Dmitry Safonov 2022-08-18  319  		 * use the first key matching the peer
a58f130caaa0601 Dmitry Safonov 2022-08-18  320  		 */
a58f130caaa0601 Dmitry Safonov 2022-08-18  321  		if (!ao_info->current_key)
a58f130caaa0601 Dmitry Safonov 2022-08-18  322  			ao_info->current_key = key;
a58f130caaa0601 Dmitry Safonov 2022-08-18  323  		if (!ao_info->rnext_key)
a58f130caaa0601 Dmitry Safonov 2022-08-18  324  			ao_info->rnext_key = key;
a58f130caaa0601 Dmitry Safonov 2022-08-18  325  		tp->tcp_header_len += tcp_ao_len(key);
a58f130caaa0601 Dmitry Safonov 2022-08-18  326
a58f130caaa0601 Dmitry Safonov 2022-08-18  327  		ao_info->lisn = htonl(tp->write_seq);
a58f130caaa0601 Dmitry Safonov 2022-08-18  328  		ao_info->snd_sne = 0;
a58f130caaa0601 Dmitry Safonov 2022-08-18  329  		ao_info->snd_sne_seq = tp->write_seq;
a58f130caaa0601 Dmitry Safonov 2022-08-18  330  	} else {
a58f130caaa0601 Dmitry Safonov 2022-08-18  331  		WARN_ON_ONCE(1);
a58f130caaa0601 Dmitry Safonov 2022-08-18 @332  		kfree(tp->ao_info);
a58f130caaa0601 Dmitry Safonov 2022-08-18 @333  		rcu_assign_pointer(tp->ao_info, NULL);
a58f130caaa0601 Dmitry Safonov 2022-08-18  334  	}
a58f130caaa0601 Dmitry Safonov 2022-08-18  335  }
a58f130caaa0601 Dmitry Safonov 2022-08-18  336

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ