Re: [PATCH v11 crypto 01/12] tls: support for Inline tls record (fwd)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ctx is dereferenced on line 258 but has been freed on line 229.

julia

---------- Forwarded message ----------
Date: Sun, 18 Mar 2018 18:05:25 +0800
From: kbuild test robot <fengguang.wu@xxxxxxxxx>
To: kbuild@xxxxxx
Cc: Julia Lawall <julia.lawall@xxxxxxx>
Subject: Re: [PATCH v11 crypto 01/12] tls: support for Inline tls record

CC: kbuild-all@xxxxxx
In-Reply-To: <1521214661-28928-1-git-send-email-atul.gupta@xxxxxxxxxxx>
References: <1521214661-28928-1-git-send-email-atul.gupta@xxxxxxxxxxx>
TO: Atul Gupta <atul.gupta@xxxxxxxxxxx>
CC: davejwatson@xxxxxx, davem@xxxxxxxxxxxxx, herbert@xxxxxxxxxxxxxxxxxxx, sd@xxxxxxxxxxxxxxx, sbrivio@xxxxxxxxxx, linux-crypto@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, ganeshgr@xxxxxxxxxxx
CC: sd@xxxxxxxxxxxxxxx, sbrivio@xxxxxxxxxx, linux-crypto@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, ganeshgr@xxxxxxxxxxx

Hi Atul,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v4.16-rc4]
[cannot apply to next-20180316]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Atul-Gupta/tls-support-for-Inline-tls-record/20180318-162840
:::::: branch date: 2 hours ago
:::::: commit date: 2 hours ago

>> net/tls/tls_main.c:258:5-8: ERROR: reference preceded by free on line 229

# https://github.com/0day-ci/linux/commit/be47378786b9d9874dfc3ab57504565275c7b3ff
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout be47378786b9d9874dfc3ab57504565275c7b3ff
vim +258 net/tls/tls_main.c

3c4d75591 Dave Watson   2017-06-14  218
3c4d75591 Dave Watson   2017-06-14  219  static void tls_sk_proto_close(struct sock *sk, long timeout)
3c4d75591 Dave Watson   2017-06-14  220  {
3c4d75591 Dave Watson   2017-06-14  221  	struct tls_context *ctx = tls_get_ctx(sk);
3c4d75591 Dave Watson   2017-06-14  222  	long timeo = sock_sndtimeo(sk, 0);
3c4d75591 Dave Watson   2017-06-14  223  	void (*sk_proto_close)(struct sock *sk, long timeout);
3c4d75591 Dave Watson   2017-06-14  224
3c4d75591 Dave Watson   2017-06-14  225  	lock_sock(sk);
ff45d820a Ilya Lesokhin 2017-11-13  226  	sk_proto_close = ctx->sk_proto_close;
ff45d820a Ilya Lesokhin 2017-11-13  227
ff45d820a Ilya Lesokhin 2017-11-13  228  	if (ctx->tx_conf == TLS_BASE_TX) {
ff45d820a Ilya Lesokhin 2017-11-13 @229  		kfree(ctx);
ff45d820a Ilya Lesokhin 2017-11-13  230  		goto skip_tx_cleanup;
ff45d820a Ilya Lesokhin 2017-11-13  231  	}
3c4d75591 Dave Watson   2017-06-14  232
3c4d75591 Dave Watson   2017-06-14  233  	if (!tls_complete_pending_work(sk, ctx, 0, &timeo))
3c4d75591 Dave Watson   2017-06-14  234  		tls_handle_open_record(sk, 0);
3c4d75591 Dave Watson   2017-06-14  235
3c4d75591 Dave Watson   2017-06-14  236  	if (ctx->partially_sent_record) {
3c4d75591 Dave Watson   2017-06-14  237  		struct scatterlist *sg = ctx->partially_sent_record;
3c4d75591 Dave Watson   2017-06-14  238
3c4d75591 Dave Watson   2017-06-14  239  		while (1) {
3c4d75591 Dave Watson   2017-06-14  240  			put_page(sg_page(sg));
3c4d75591 Dave Watson   2017-06-14  241  			sk_mem_uncharge(sk, sg->length);
3c4d75591 Dave Watson   2017-06-14  242
3c4d75591 Dave Watson   2017-06-14  243  			if (sg_is_last(sg))
3c4d75591 Dave Watson   2017-06-14  244  				break;
3c4d75591 Dave Watson   2017-06-14  245  			sg++;
3c4d75591 Dave Watson   2017-06-14  246  		}
3c4d75591 Dave Watson   2017-06-14  247  	}
ff45d820a Ilya Lesokhin 2017-11-13  248
3c4d75591 Dave Watson   2017-06-14  249  	kfree(ctx->rec_seq);
3c4d75591 Dave Watson   2017-06-14  250  	kfree(ctx->iv);
3c4d75591 Dave Watson   2017-06-14  251
ff45d820a Ilya Lesokhin 2017-11-13  252  	if (ctx->tx_conf == TLS_SW_TX)
ff45d820a Ilya Lesokhin 2017-11-13  253  		tls_sw_free_tx_resources(sk);
3c4d75591 Dave Watson   2017-06-14  254
ff45d820a Ilya Lesokhin 2017-11-13  255  skip_tx_cleanup:
3c4d75591 Dave Watson   2017-06-14  256  	release_sock(sk);
3c4d75591 Dave Watson   2017-06-14  257  	sk_proto_close(sk, timeout);
be4737878 Atul Gupta    2018-03-16 @258  	if (ctx->tx_conf == TLS_HW_RECORD)
be4737878 Atul Gupta    2018-03-16  259  		kfree(ctx);
3c4d75591 Dave Watson   2017-06-14  260  }
3c4d75591 Dave Watson   2017-06-14  261

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux