All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter at oracle.com>
To: mptcp at lists.01.org
Subject: [MPTCP] [kbuild] [mptcp:export 5/10] net/mptcp/subflow.c:512 subflow_syn_recv_sock() error: uninitialized symbol 'subflow_req'.
Date: Mon, 08 Jun 2020 16:15:35 +0300	[thread overview]
Message-ID: <20200608131535.GO22511@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 11697 bytes --]

tree:   https://github.com/multipath-tcp/mptcp_net-next.git export
head:   e28f6a7575a0006d0d49de297e23dd915c59ba39
commit: 962c918a1ca2553fac7db45c2a2f9b84fa30a6d9 [5/10] mptcp: refactor token container.
config: x86_64-randconfig-m001-20200605 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>

smatch warnings:
net/mptcp/subflow.c:512 subflow_syn_recv_sock() error: uninitialized symbol 'subflow_req'.

# https://github.com/multipath-tcp/mptcp_net-next/commit/962c918a1ca2553fac7db45c2a2f9b84fa30a6d9
git remote add mptcp https://github.com/multipath-tcp/mptcp_net-next.git
git remote update mptcp
git checkout 962c918a1ca2553fac7db45c2a2f9b84fa30a6d9
vim +/subflow_req +512 net/mptcp/subflow.c

cec37a6e41aae7 Peter Krystad    2020-01-21  430  static struct sock *subflow_syn_recv_sock(const struct sock *sk,
cec37a6e41aae7 Peter Krystad    2020-01-21  431  					  struct sk_buff *skb,
cec37a6e41aae7 Peter Krystad    2020-01-21  432  					  struct request_sock *req,
cec37a6e41aae7 Peter Krystad    2020-01-21  433  					  struct dst_entry *dst,
cec37a6e41aae7 Peter Krystad    2020-01-21  434  					  struct request_sock *req_unhash,
cec37a6e41aae7 Peter Krystad    2020-01-21  435  					  bool *own_req)
cec37a6e41aae7 Peter Krystad    2020-01-21  436  {
cec37a6e41aae7 Peter Krystad    2020-01-21  437  	struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk);
cc7972ea193233 Christoph Paasch 2020-01-21  438  	struct mptcp_subflow_request_sock *subflow_req;
                                                                                           ^^^^^^^^^^^

cfde141ea3faa3 Paolo Abeni      2020-04-30  439  	struct mptcp_options_received mp_opt;
f296234c98a8fc Peter Krystad    2020-03-27  440  	bool fallback_is_fatal = false;
58b09919626bf9 Paolo Abeni      2020-03-13  441  	struct sock *new_msk = NULL;
4c8941de781cf7 Paolo Abeni      2020-04-20  442  	bool fallback = false;
cec37a6e41aae7 Peter Krystad    2020-01-21  443  	struct sock *child;
cec37a6e41aae7 Peter Krystad    2020-01-21  444  
cec37a6e41aae7 Peter Krystad    2020-01-21  445  	pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn);
cec37a6e41aae7 Peter Krystad    2020-01-21  446  
cfde141ea3faa3 Paolo Abeni      2020-04-30  447  	/* we need later a valid 'mp_capable' value even when options are not
cfde141ea3faa3 Paolo Abeni      2020-04-30  448  	 * parsed
cfde141ea3faa3 Paolo Abeni      2020-04-30  449  	 */
cfde141ea3faa3 Paolo Abeni      2020-04-30  450  	mp_opt.mp_capable = 0;
ae2dd7164943e0 Florian Westphal 2020-01-29  451  	if (tcp_rsk(req)->is_mptcp == 0)
ae2dd7164943e0 Florian Westphal 2020-01-29  452  		goto create_child;
                                                                ^^^^^^^^^^^^^^^^^

ae2dd7164943e0 Florian Westphal 2020-01-29  453  
d22f4988ffecbe Christoph Paasch 2020-01-21  454  	/* if the sk is MP_CAPABLE, we try to fetch the client key */
cc7972ea193233 Christoph Paasch 2020-01-21  455  	subflow_req = mptcp_subflow_rsk(req);
cc7972ea193233 Christoph Paasch 2020-01-21  456  	if (subflow_req->mp_capable) {
d22f4988ffecbe Christoph Paasch 2020-01-21  457  		if (TCP_SKB_CB(skb)->seq != subflow_req->ssn_offset + 1) {
d22f4988ffecbe Christoph Paasch 2020-01-21  458  			/* here we can receive and accept an in-window,
d22f4988ffecbe Christoph Paasch 2020-01-21  459  			 * out-of-order pkt, which will not carry the MP_CAPABLE
d22f4988ffecbe Christoph Paasch 2020-01-21  460  			 * opt even on mptcp enabled paths
d22f4988ffecbe Christoph Paasch 2020-01-21  461  			 */
58b09919626bf9 Paolo Abeni      2020-03-13  462  			goto create_msk;
d22f4988ffecbe Christoph Paasch 2020-01-21  463  		}
d22f4988ffecbe Christoph Paasch 2020-01-21  464  
cfde141ea3faa3 Paolo Abeni      2020-04-30  465  		mptcp_get_options(skb, &mp_opt);
cfde141ea3faa3 Paolo Abeni      2020-04-30  466  		if (!mp_opt.mp_capable) {
4c8941de781cf7 Paolo Abeni      2020-04-20  467  			fallback = true;
58b09919626bf9 Paolo Abeni      2020-03-13  468  			goto create_child;
d22f4988ffecbe Christoph Paasch 2020-01-21  469  		}
58b09919626bf9 Paolo Abeni      2020-03-13  470  
58b09919626bf9 Paolo Abeni      2020-03-13  471  create_msk:
cfde141ea3faa3 Paolo Abeni      2020-04-30  472  		new_msk = mptcp_sk_clone(listener->conn, &mp_opt, req);
58b09919626bf9 Paolo Abeni      2020-03-13  473  		if (!new_msk)
4c8941de781cf7 Paolo Abeni      2020-04-20  474  			fallback = true;
f296234c98a8fc Peter Krystad    2020-03-27  475  	} else if (subflow_req->mp_join) {
f296234c98a8fc Peter Krystad    2020-03-27  476  		fallback_is_fatal = true;
cfde141ea3faa3 Paolo Abeni      2020-04-30  477  		mptcp_get_options(skb, &mp_opt);
cfde141ea3faa3 Paolo Abeni      2020-04-30  478  		if (!mp_opt.mp_join ||
cfde141ea3faa3 Paolo Abeni      2020-04-30  479  		    !subflow_hmac_valid(req, &mp_opt)) {
fc518953bc9c8d Florian Westphal 2020-03-27  480  			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
f296234c98a8fc Peter Krystad    2020-03-27  481  			return NULL;
cc7972ea193233 Christoph Paasch 2020-01-21  482  		}
fc518953bc9c8d Florian Westphal 2020-03-27  483  	}
cec37a6e41aae7 Peter Krystad    2020-01-21  484  
d22f4988ffecbe Christoph Paasch 2020-01-21  485  create_child:
                                                 ^^^^^^^^^^^^

cec37a6e41aae7 Peter Krystad    2020-01-21  486  	child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst,
cec37a6e41aae7 Peter Krystad    2020-01-21  487  						     req_unhash, own_req);
cec37a6e41aae7 Peter Krystad    2020-01-21  488  
cec37a6e41aae7 Peter Krystad    2020-01-21  489  	if (child && *own_req) {
79c0949e9a09f6 Peter Krystad    2020-01-21  490  		struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child);
79c0949e9a09f6 Peter Krystad    2020-01-21  491  
90bf45134d55d6 Paolo Abeni      2020-05-15  492  		tcp_rsk(req)->drop_req = false;
90bf45134d55d6 Paolo Abeni      2020-05-15  493  
4c8941de781cf7 Paolo Abeni      2020-04-20  494  		/* we need to fallback on ctx allocation failure and on pre-reqs
4c8941de781cf7 Paolo Abeni      2020-04-20  495  		 * checking above. In the latter scenario we additionally need
4c8941de781cf7 Paolo Abeni      2020-04-20  496  		 * to reset the context to non MPTCP status.
79c0949e9a09f6 Peter Krystad    2020-01-21  497  		 */
4c8941de781cf7 Paolo Abeni      2020-04-20  498  		if (!ctx || fallback) {
f296234c98a8fc Peter Krystad    2020-03-27  499  			if (fallback_is_fatal)
729cd6436f359b Paolo Abeni      2020-05-15  500  				goto dispose_child;
4c8941de781cf7 Paolo Abeni      2020-04-20  501  
39884604b11692 Paolo Abeni      2020-05-29  502  			subflow_drop_ctx(child);
58b09919626bf9 Paolo Abeni      2020-03-13  503  			goto out;
f296234c98a8fc Peter Krystad    2020-03-27  504  		}
79c0949e9a09f6 Peter Krystad    2020-01-21  505  
79c0949e9a09f6 Peter Krystad    2020-01-21  506  		if (ctx->mp_capable) {
58b09919626bf9 Paolo Abeni      2020-03-13  507  			/* new mpc subflow takes ownership of the newly
58b09919626bf9 Paolo Abeni      2020-03-13  508  			 * created mptcp socket
58b09919626bf9 Paolo Abeni      2020-03-13  509  			 */
df1036da90108b Florian Westphal 2020-04-17  510  			new_msk->sk_destruct = mptcp_sock_destruct;
1b1c7a0ef7f323 Peter Krystad    2020-03-27  511  			mptcp_pm_new_connection(mptcp_sk(new_msk), 1);
962c918a1ca255 Paolo Abeni      2020-06-05 @512  			mptcp_token_accept(subflow_req, mptcp_sk(new_msk));
                                                                                           ^^^^^^^^^^^
Potential uninitialized?

58b09919626bf9 Paolo Abeni      2020-03-13  513  			ctx->conn = new_msk;
58b09919626bf9 Paolo Abeni      2020-03-13  514  			new_msk = NULL;
fca5c82c086ea3 Paolo Abeni      2020-04-20  515  
fca5c82c086ea3 Paolo Abeni      2020-04-20  516  			/* with OoO packets we can reach here without ingress
fca5c82c086ea3 Paolo Abeni      2020-04-20  517  			 * mpc option
fca5c82c086ea3 Paolo Abeni      2020-04-20  518  			 */
cfde141ea3faa3 Paolo Abeni      2020-04-30  519  			ctx->remote_key = mp_opt.sndr_key;
cfde141ea3faa3 Paolo Abeni      2020-04-30  520  			ctx->fully_established = mp_opt.mp_capable;
cfde141ea3faa3 Paolo Abeni      2020-04-30  521  			ctx->can_ack = mp_opt.mp_capable;
f296234c98a8fc Peter Krystad    2020-03-27  522  		} else if (ctx->mp_join) {
f296234c98a8fc Peter Krystad    2020-03-27  523  			struct mptcp_sock *owner;
f296234c98a8fc Peter Krystad    2020-03-27  524  
f296234c98a8fc Peter Krystad    2020-03-27  525  			owner = mptcp_token_get_sock(ctx->token);
f296234c98a8fc Peter Krystad    2020-03-27  526  			if (!owner)
729cd6436f359b Paolo Abeni      2020-05-15  527  				goto dispose_child;
f296234c98a8fc Peter Krystad    2020-03-27  528  
f296234c98a8fc Peter Krystad    2020-03-27  529  			ctx->conn = (struct sock *)owner;
f296234c98a8fc Peter Krystad    2020-03-27  530  			if (!mptcp_finish_join(child))
729cd6436f359b Paolo Abeni      2020-05-15  531  				goto dispose_child;
fc518953bc9c8d Florian Westphal 2020-03-27  532  
fc518953bc9c8d Florian Westphal 2020-03-27  533  			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX);
90bf45134d55d6 Paolo Abeni      2020-05-15  534  			tcp_rsk(req)->drop_req = true;
cec37a6e41aae7 Peter Krystad    2020-01-21  535  		}
cec37a6e41aae7 Peter Krystad    2020-01-21  536  	}
cec37a6e41aae7 Peter Krystad    2020-01-21  537  
58b09919626bf9 Paolo Abeni      2020-03-13  538  out:
58b09919626bf9 Paolo Abeni      2020-03-13  539  	/* dispose of the left over mptcp master, if any */
58b09919626bf9 Paolo Abeni      2020-03-13  540  	if (unlikely(new_msk))
9f5ca6a59816b4 Florian Westphal 2020-04-17  541  		mptcp_force_close(new_msk);
4c8941de781cf7 Paolo Abeni      2020-04-20  542  
4c8941de781cf7 Paolo Abeni      2020-04-20  543  	/* check for expected invariant - should never trigger, just help
4c8941de781cf7 Paolo Abeni      2020-04-20  544  	 * catching eariler subtle bugs
4c8941de781cf7 Paolo Abeni      2020-04-20  545  	 */
ac2b47fb92c506 Paolo Abeni      2020-04-30  546  	WARN_ON_ONCE(child && *own_req && tcp_sk(child)->is_mptcp &&
4c8941de781cf7 Paolo Abeni      2020-04-20  547  		     (!mptcp_subflow_ctx(child) ||
4c8941de781cf7 Paolo Abeni      2020-04-20  548  		      !mptcp_subflow_ctx(child)->conn));
cec37a6e41aae7 Peter Krystad    2020-01-21  549  	return child;
f296234c98a8fc Peter Krystad    2020-03-27  550  
729cd6436f359b Paolo Abeni      2020-05-15  551  dispose_child:
39884604b11692 Paolo Abeni      2020-05-29  552  	subflow_drop_ctx(child);
729cd6436f359b Paolo Abeni      2020-05-15  553  	tcp_rsk(req)->drop_req = true;
f296234c98a8fc Peter Krystad    2020-03-27  554  	tcp_send_active_reset(child, GFP_ATOMIC);
729cd6436f359b Paolo Abeni      2020-05-15  555  	inet_csk_prepare_for_destroy_sock(child);
f296234c98a8fc Peter Krystad    2020-03-27  556  	tcp_done(child);
729cd6436f359b Paolo Abeni      2020-05-15  557  
729cd6436f359b Paolo Abeni      2020-05-15  558  	/* The last child reference will be released by the caller */
729cd6436f359b Paolo Abeni      2020-05-15  559  	return child;
cec37a6e41aae7 Peter Krystad    2020-01-21  560  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32022 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [mptcp:export 5/10] net/mptcp/subflow.c:512 subflow_syn_recv_sock() error: uninitialized symbol 'subflow_req'.
Date: Mon, 08 Jun 2020 16:15:35 +0300	[thread overview]
Message-ID: <20200608131535.GO22511@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 11693 bytes --]

tree:   https://github.com/multipath-tcp/mptcp_net-next.git export
head:   e28f6a7575a0006d0d49de297e23dd915c59ba39
commit: 962c918a1ca2553fac7db45c2a2f9b84fa30a6d9 [5/10] mptcp: refactor token container.
config: x86_64-randconfig-m001-20200605 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/mptcp/subflow.c:512 subflow_syn_recv_sock() error: uninitialized symbol 'subflow_req'.

# https://github.com/multipath-tcp/mptcp_net-next/commit/962c918a1ca2553fac7db45c2a2f9b84fa30a6d9
git remote add mptcp https://github.com/multipath-tcp/mptcp_net-next.git
git remote update mptcp
git checkout 962c918a1ca2553fac7db45c2a2f9b84fa30a6d9
vim +/subflow_req +512 net/mptcp/subflow.c

cec37a6e41aae7 Peter Krystad    2020-01-21  430  static struct sock *subflow_syn_recv_sock(const struct sock *sk,
cec37a6e41aae7 Peter Krystad    2020-01-21  431  					  struct sk_buff *skb,
cec37a6e41aae7 Peter Krystad    2020-01-21  432  					  struct request_sock *req,
cec37a6e41aae7 Peter Krystad    2020-01-21  433  					  struct dst_entry *dst,
cec37a6e41aae7 Peter Krystad    2020-01-21  434  					  struct request_sock *req_unhash,
cec37a6e41aae7 Peter Krystad    2020-01-21  435  					  bool *own_req)
cec37a6e41aae7 Peter Krystad    2020-01-21  436  {
cec37a6e41aae7 Peter Krystad    2020-01-21  437  	struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk);
cc7972ea193233 Christoph Paasch 2020-01-21  438  	struct mptcp_subflow_request_sock *subflow_req;
                                                                                           ^^^^^^^^^^^

cfde141ea3faa3 Paolo Abeni      2020-04-30  439  	struct mptcp_options_received mp_opt;
f296234c98a8fc Peter Krystad    2020-03-27  440  	bool fallback_is_fatal = false;
58b09919626bf9 Paolo Abeni      2020-03-13  441  	struct sock *new_msk = NULL;
4c8941de781cf7 Paolo Abeni      2020-04-20  442  	bool fallback = false;
cec37a6e41aae7 Peter Krystad    2020-01-21  443  	struct sock *child;
cec37a6e41aae7 Peter Krystad    2020-01-21  444  
cec37a6e41aae7 Peter Krystad    2020-01-21  445  	pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn);
cec37a6e41aae7 Peter Krystad    2020-01-21  446  
cfde141ea3faa3 Paolo Abeni      2020-04-30  447  	/* we need later a valid 'mp_capable' value even when options are not
cfde141ea3faa3 Paolo Abeni      2020-04-30  448  	 * parsed
cfde141ea3faa3 Paolo Abeni      2020-04-30  449  	 */
cfde141ea3faa3 Paolo Abeni      2020-04-30  450  	mp_opt.mp_capable = 0;
ae2dd7164943e0 Florian Westphal 2020-01-29  451  	if (tcp_rsk(req)->is_mptcp == 0)
ae2dd7164943e0 Florian Westphal 2020-01-29  452  		goto create_child;
                                                                ^^^^^^^^^^^^^^^^^

ae2dd7164943e0 Florian Westphal 2020-01-29  453  
d22f4988ffecbe Christoph Paasch 2020-01-21  454  	/* if the sk is MP_CAPABLE, we try to fetch the client key */
cc7972ea193233 Christoph Paasch 2020-01-21  455  	subflow_req = mptcp_subflow_rsk(req);
cc7972ea193233 Christoph Paasch 2020-01-21  456  	if (subflow_req->mp_capable) {
d22f4988ffecbe Christoph Paasch 2020-01-21  457  		if (TCP_SKB_CB(skb)->seq != subflow_req->ssn_offset + 1) {
d22f4988ffecbe Christoph Paasch 2020-01-21  458  			/* here we can receive and accept an in-window,
d22f4988ffecbe Christoph Paasch 2020-01-21  459  			 * out-of-order pkt, which will not carry the MP_CAPABLE
d22f4988ffecbe Christoph Paasch 2020-01-21  460  			 * opt even on mptcp enabled paths
d22f4988ffecbe Christoph Paasch 2020-01-21  461  			 */
58b09919626bf9 Paolo Abeni      2020-03-13  462  			goto create_msk;
d22f4988ffecbe Christoph Paasch 2020-01-21  463  		}
d22f4988ffecbe Christoph Paasch 2020-01-21  464  
cfde141ea3faa3 Paolo Abeni      2020-04-30  465  		mptcp_get_options(skb, &mp_opt);
cfde141ea3faa3 Paolo Abeni      2020-04-30  466  		if (!mp_opt.mp_capable) {
4c8941de781cf7 Paolo Abeni      2020-04-20  467  			fallback = true;
58b09919626bf9 Paolo Abeni      2020-03-13  468  			goto create_child;
d22f4988ffecbe Christoph Paasch 2020-01-21  469  		}
58b09919626bf9 Paolo Abeni      2020-03-13  470  
58b09919626bf9 Paolo Abeni      2020-03-13  471  create_msk:
cfde141ea3faa3 Paolo Abeni      2020-04-30  472  		new_msk = mptcp_sk_clone(listener->conn, &mp_opt, req);
58b09919626bf9 Paolo Abeni      2020-03-13  473  		if (!new_msk)
4c8941de781cf7 Paolo Abeni      2020-04-20  474  			fallback = true;
f296234c98a8fc Peter Krystad    2020-03-27  475  	} else if (subflow_req->mp_join) {
f296234c98a8fc Peter Krystad    2020-03-27  476  		fallback_is_fatal = true;
cfde141ea3faa3 Paolo Abeni      2020-04-30  477  		mptcp_get_options(skb, &mp_opt);
cfde141ea3faa3 Paolo Abeni      2020-04-30  478  		if (!mp_opt.mp_join ||
cfde141ea3faa3 Paolo Abeni      2020-04-30  479  		    !subflow_hmac_valid(req, &mp_opt)) {
fc518953bc9c8d Florian Westphal 2020-03-27  480  			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
f296234c98a8fc Peter Krystad    2020-03-27  481  			return NULL;
cc7972ea193233 Christoph Paasch 2020-01-21  482  		}
fc518953bc9c8d Florian Westphal 2020-03-27  483  	}
cec37a6e41aae7 Peter Krystad    2020-01-21  484  
d22f4988ffecbe Christoph Paasch 2020-01-21  485  create_child:
                                                 ^^^^^^^^^^^^

cec37a6e41aae7 Peter Krystad    2020-01-21  486  	child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst,
cec37a6e41aae7 Peter Krystad    2020-01-21  487  						     req_unhash, own_req);
cec37a6e41aae7 Peter Krystad    2020-01-21  488  
cec37a6e41aae7 Peter Krystad    2020-01-21  489  	if (child && *own_req) {
79c0949e9a09f6 Peter Krystad    2020-01-21  490  		struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child);
79c0949e9a09f6 Peter Krystad    2020-01-21  491  
90bf45134d55d6 Paolo Abeni      2020-05-15  492  		tcp_rsk(req)->drop_req = false;
90bf45134d55d6 Paolo Abeni      2020-05-15  493  
4c8941de781cf7 Paolo Abeni      2020-04-20  494  		/* we need to fallback on ctx allocation failure and on pre-reqs
4c8941de781cf7 Paolo Abeni      2020-04-20  495  		 * checking above. In the latter scenario we additionally need
4c8941de781cf7 Paolo Abeni      2020-04-20  496  		 * to reset the context to non MPTCP status.
79c0949e9a09f6 Peter Krystad    2020-01-21  497  		 */
4c8941de781cf7 Paolo Abeni      2020-04-20  498  		if (!ctx || fallback) {
f296234c98a8fc Peter Krystad    2020-03-27  499  			if (fallback_is_fatal)
729cd6436f359b Paolo Abeni      2020-05-15  500  				goto dispose_child;
4c8941de781cf7 Paolo Abeni      2020-04-20  501  
39884604b11692 Paolo Abeni      2020-05-29  502  			subflow_drop_ctx(child);
58b09919626bf9 Paolo Abeni      2020-03-13  503  			goto out;
f296234c98a8fc Peter Krystad    2020-03-27  504  		}
79c0949e9a09f6 Peter Krystad    2020-01-21  505  
79c0949e9a09f6 Peter Krystad    2020-01-21  506  		if (ctx->mp_capable) {
58b09919626bf9 Paolo Abeni      2020-03-13  507  			/* new mpc subflow takes ownership of the newly
58b09919626bf9 Paolo Abeni      2020-03-13  508  			 * created mptcp socket
58b09919626bf9 Paolo Abeni      2020-03-13  509  			 */
df1036da90108b Florian Westphal 2020-04-17  510  			new_msk->sk_destruct = mptcp_sock_destruct;
1b1c7a0ef7f323 Peter Krystad    2020-03-27  511  			mptcp_pm_new_connection(mptcp_sk(new_msk), 1);
962c918a1ca255 Paolo Abeni      2020-06-05 @512  			mptcp_token_accept(subflow_req, mptcp_sk(new_msk));
                                                                                           ^^^^^^^^^^^
Potential uninitialized?

58b09919626bf9 Paolo Abeni      2020-03-13  513  			ctx->conn = new_msk;
58b09919626bf9 Paolo Abeni      2020-03-13  514  			new_msk = NULL;
fca5c82c086ea3 Paolo Abeni      2020-04-20  515  
fca5c82c086ea3 Paolo Abeni      2020-04-20  516  			/* with OoO packets we can reach here without ingress
fca5c82c086ea3 Paolo Abeni      2020-04-20  517  			 * mpc option
fca5c82c086ea3 Paolo Abeni      2020-04-20  518  			 */
cfde141ea3faa3 Paolo Abeni      2020-04-30  519  			ctx->remote_key = mp_opt.sndr_key;
cfde141ea3faa3 Paolo Abeni      2020-04-30  520  			ctx->fully_established = mp_opt.mp_capable;
cfde141ea3faa3 Paolo Abeni      2020-04-30  521  			ctx->can_ack = mp_opt.mp_capable;
f296234c98a8fc Peter Krystad    2020-03-27  522  		} else if (ctx->mp_join) {
f296234c98a8fc Peter Krystad    2020-03-27  523  			struct mptcp_sock *owner;
f296234c98a8fc Peter Krystad    2020-03-27  524  
f296234c98a8fc Peter Krystad    2020-03-27  525  			owner = mptcp_token_get_sock(ctx->token);
f296234c98a8fc Peter Krystad    2020-03-27  526  			if (!owner)
729cd6436f359b Paolo Abeni      2020-05-15  527  				goto dispose_child;
f296234c98a8fc Peter Krystad    2020-03-27  528  
f296234c98a8fc Peter Krystad    2020-03-27  529  			ctx->conn = (struct sock *)owner;
f296234c98a8fc Peter Krystad    2020-03-27  530  			if (!mptcp_finish_join(child))
729cd6436f359b Paolo Abeni      2020-05-15  531  				goto dispose_child;
fc518953bc9c8d Florian Westphal 2020-03-27  532  
fc518953bc9c8d Florian Westphal 2020-03-27  533  			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX);
90bf45134d55d6 Paolo Abeni      2020-05-15  534  			tcp_rsk(req)->drop_req = true;
cec37a6e41aae7 Peter Krystad    2020-01-21  535  		}
cec37a6e41aae7 Peter Krystad    2020-01-21  536  	}
cec37a6e41aae7 Peter Krystad    2020-01-21  537  
58b09919626bf9 Paolo Abeni      2020-03-13  538  out:
58b09919626bf9 Paolo Abeni      2020-03-13  539  	/* dispose of the left over mptcp master, if any */
58b09919626bf9 Paolo Abeni      2020-03-13  540  	if (unlikely(new_msk))
9f5ca6a59816b4 Florian Westphal 2020-04-17  541  		mptcp_force_close(new_msk);
4c8941de781cf7 Paolo Abeni      2020-04-20  542  
4c8941de781cf7 Paolo Abeni      2020-04-20  543  	/* check for expected invariant - should never trigger, just help
4c8941de781cf7 Paolo Abeni      2020-04-20  544  	 * catching eariler subtle bugs
4c8941de781cf7 Paolo Abeni      2020-04-20  545  	 */
ac2b47fb92c506 Paolo Abeni      2020-04-30  546  	WARN_ON_ONCE(child && *own_req && tcp_sk(child)->is_mptcp &&
4c8941de781cf7 Paolo Abeni      2020-04-20  547  		     (!mptcp_subflow_ctx(child) ||
4c8941de781cf7 Paolo Abeni      2020-04-20  548  		      !mptcp_subflow_ctx(child)->conn));
cec37a6e41aae7 Peter Krystad    2020-01-21  549  	return child;
f296234c98a8fc Peter Krystad    2020-03-27  550  
729cd6436f359b Paolo Abeni      2020-05-15  551  dispose_child:
39884604b11692 Paolo Abeni      2020-05-29  552  	subflow_drop_ctx(child);
729cd6436f359b Paolo Abeni      2020-05-15  553  	tcp_rsk(req)->drop_req = true;
f296234c98a8fc Peter Krystad    2020-03-27  554  	tcp_send_active_reset(child, GFP_ATOMIC);
729cd6436f359b Paolo Abeni      2020-05-15  555  	inet_csk_prepare_for_destroy_sock(child);
f296234c98a8fc Peter Krystad    2020-03-27  556  	tcp_done(child);
729cd6436f359b Paolo Abeni      2020-05-15  557  
729cd6436f359b Paolo Abeni      2020-05-15  558  	/* The last child reference will be released by the caller */
729cd6436f359b Paolo Abeni      2020-05-15  559  	return child;
cec37a6e41aae7 Peter Krystad    2020-01-21  560  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32022 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [kbuild] [mptcp:export 5/10] net/mptcp/subflow.c:512 subflow_syn_recv_sock() error: uninitialized symbol 'subflow_req'.
Date: Mon, 08 Jun 2020 16:15:35 +0300	[thread overview]
Message-ID: <20200608131535.GO22511@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 11693 bytes --]

tree:   https://github.com/multipath-tcp/mptcp_net-next.git export
head:   e28f6a7575a0006d0d49de297e23dd915c59ba39
commit: 962c918a1ca2553fac7db45c2a2f9b84fa30a6d9 [5/10] mptcp: refactor token container.
config: x86_64-randconfig-m001-20200605 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/mptcp/subflow.c:512 subflow_syn_recv_sock() error: uninitialized symbol 'subflow_req'.

# https://github.com/multipath-tcp/mptcp_net-next/commit/962c918a1ca2553fac7db45c2a2f9b84fa30a6d9
git remote add mptcp https://github.com/multipath-tcp/mptcp_net-next.git
git remote update mptcp
git checkout 962c918a1ca2553fac7db45c2a2f9b84fa30a6d9
vim +/subflow_req +512 net/mptcp/subflow.c

cec37a6e41aae7 Peter Krystad    2020-01-21  430  static struct sock *subflow_syn_recv_sock(const struct sock *sk,
cec37a6e41aae7 Peter Krystad    2020-01-21  431  					  struct sk_buff *skb,
cec37a6e41aae7 Peter Krystad    2020-01-21  432  					  struct request_sock *req,
cec37a6e41aae7 Peter Krystad    2020-01-21  433  					  struct dst_entry *dst,
cec37a6e41aae7 Peter Krystad    2020-01-21  434  					  struct request_sock *req_unhash,
cec37a6e41aae7 Peter Krystad    2020-01-21  435  					  bool *own_req)
cec37a6e41aae7 Peter Krystad    2020-01-21  436  {
cec37a6e41aae7 Peter Krystad    2020-01-21  437  	struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk);
cc7972ea193233 Christoph Paasch 2020-01-21  438  	struct mptcp_subflow_request_sock *subflow_req;
                                                                                           ^^^^^^^^^^^

cfde141ea3faa3 Paolo Abeni      2020-04-30  439  	struct mptcp_options_received mp_opt;
f296234c98a8fc Peter Krystad    2020-03-27  440  	bool fallback_is_fatal = false;
58b09919626bf9 Paolo Abeni      2020-03-13  441  	struct sock *new_msk = NULL;
4c8941de781cf7 Paolo Abeni      2020-04-20  442  	bool fallback = false;
cec37a6e41aae7 Peter Krystad    2020-01-21  443  	struct sock *child;
cec37a6e41aae7 Peter Krystad    2020-01-21  444  
cec37a6e41aae7 Peter Krystad    2020-01-21  445  	pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn);
cec37a6e41aae7 Peter Krystad    2020-01-21  446  
cfde141ea3faa3 Paolo Abeni      2020-04-30  447  	/* we need later a valid 'mp_capable' value even when options are not
cfde141ea3faa3 Paolo Abeni      2020-04-30  448  	 * parsed
cfde141ea3faa3 Paolo Abeni      2020-04-30  449  	 */
cfde141ea3faa3 Paolo Abeni      2020-04-30  450  	mp_opt.mp_capable = 0;
ae2dd7164943e0 Florian Westphal 2020-01-29  451  	if (tcp_rsk(req)->is_mptcp == 0)
ae2dd7164943e0 Florian Westphal 2020-01-29  452  		goto create_child;
                                                                ^^^^^^^^^^^^^^^^^

ae2dd7164943e0 Florian Westphal 2020-01-29  453  
d22f4988ffecbe Christoph Paasch 2020-01-21  454  	/* if the sk is MP_CAPABLE, we try to fetch the client key */
cc7972ea193233 Christoph Paasch 2020-01-21  455  	subflow_req = mptcp_subflow_rsk(req);
cc7972ea193233 Christoph Paasch 2020-01-21  456  	if (subflow_req->mp_capable) {
d22f4988ffecbe Christoph Paasch 2020-01-21  457  		if (TCP_SKB_CB(skb)->seq != subflow_req->ssn_offset + 1) {
d22f4988ffecbe Christoph Paasch 2020-01-21  458  			/* here we can receive and accept an in-window,
d22f4988ffecbe Christoph Paasch 2020-01-21  459  			 * out-of-order pkt, which will not carry the MP_CAPABLE
d22f4988ffecbe Christoph Paasch 2020-01-21  460  			 * opt even on mptcp enabled paths
d22f4988ffecbe Christoph Paasch 2020-01-21  461  			 */
58b09919626bf9 Paolo Abeni      2020-03-13  462  			goto create_msk;
d22f4988ffecbe Christoph Paasch 2020-01-21  463  		}
d22f4988ffecbe Christoph Paasch 2020-01-21  464  
cfde141ea3faa3 Paolo Abeni      2020-04-30  465  		mptcp_get_options(skb, &mp_opt);
cfde141ea3faa3 Paolo Abeni      2020-04-30  466  		if (!mp_opt.mp_capable) {
4c8941de781cf7 Paolo Abeni      2020-04-20  467  			fallback = true;
58b09919626bf9 Paolo Abeni      2020-03-13  468  			goto create_child;
d22f4988ffecbe Christoph Paasch 2020-01-21  469  		}
58b09919626bf9 Paolo Abeni      2020-03-13  470  
58b09919626bf9 Paolo Abeni      2020-03-13  471  create_msk:
cfde141ea3faa3 Paolo Abeni      2020-04-30  472  		new_msk = mptcp_sk_clone(listener->conn, &mp_opt, req);
58b09919626bf9 Paolo Abeni      2020-03-13  473  		if (!new_msk)
4c8941de781cf7 Paolo Abeni      2020-04-20  474  			fallback = true;
f296234c98a8fc Peter Krystad    2020-03-27  475  	} else if (subflow_req->mp_join) {
f296234c98a8fc Peter Krystad    2020-03-27  476  		fallback_is_fatal = true;
cfde141ea3faa3 Paolo Abeni      2020-04-30  477  		mptcp_get_options(skb, &mp_opt);
cfde141ea3faa3 Paolo Abeni      2020-04-30  478  		if (!mp_opt.mp_join ||
cfde141ea3faa3 Paolo Abeni      2020-04-30  479  		    !subflow_hmac_valid(req, &mp_opt)) {
fc518953bc9c8d Florian Westphal 2020-03-27  480  			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
f296234c98a8fc Peter Krystad    2020-03-27  481  			return NULL;
cc7972ea193233 Christoph Paasch 2020-01-21  482  		}
fc518953bc9c8d Florian Westphal 2020-03-27  483  	}
cec37a6e41aae7 Peter Krystad    2020-01-21  484  
d22f4988ffecbe Christoph Paasch 2020-01-21  485  create_child:
                                                 ^^^^^^^^^^^^

cec37a6e41aae7 Peter Krystad    2020-01-21  486  	child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst,
cec37a6e41aae7 Peter Krystad    2020-01-21  487  						     req_unhash, own_req);
cec37a6e41aae7 Peter Krystad    2020-01-21  488  
cec37a6e41aae7 Peter Krystad    2020-01-21  489  	if (child && *own_req) {
79c0949e9a09f6 Peter Krystad    2020-01-21  490  		struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child);
79c0949e9a09f6 Peter Krystad    2020-01-21  491  
90bf45134d55d6 Paolo Abeni      2020-05-15  492  		tcp_rsk(req)->drop_req = false;
90bf45134d55d6 Paolo Abeni      2020-05-15  493  
4c8941de781cf7 Paolo Abeni      2020-04-20  494  		/* we need to fallback on ctx allocation failure and on pre-reqs
4c8941de781cf7 Paolo Abeni      2020-04-20  495  		 * checking above. In the latter scenario we additionally need
4c8941de781cf7 Paolo Abeni      2020-04-20  496  		 * to reset the context to non MPTCP status.
79c0949e9a09f6 Peter Krystad    2020-01-21  497  		 */
4c8941de781cf7 Paolo Abeni      2020-04-20  498  		if (!ctx || fallback) {
f296234c98a8fc Peter Krystad    2020-03-27  499  			if (fallback_is_fatal)
729cd6436f359b Paolo Abeni      2020-05-15  500  				goto dispose_child;
4c8941de781cf7 Paolo Abeni      2020-04-20  501  
39884604b11692 Paolo Abeni      2020-05-29  502  			subflow_drop_ctx(child);
58b09919626bf9 Paolo Abeni      2020-03-13  503  			goto out;
f296234c98a8fc Peter Krystad    2020-03-27  504  		}
79c0949e9a09f6 Peter Krystad    2020-01-21  505  
79c0949e9a09f6 Peter Krystad    2020-01-21  506  		if (ctx->mp_capable) {
58b09919626bf9 Paolo Abeni      2020-03-13  507  			/* new mpc subflow takes ownership of the newly
58b09919626bf9 Paolo Abeni      2020-03-13  508  			 * created mptcp socket
58b09919626bf9 Paolo Abeni      2020-03-13  509  			 */
df1036da90108b Florian Westphal 2020-04-17  510  			new_msk->sk_destruct = mptcp_sock_destruct;
1b1c7a0ef7f323 Peter Krystad    2020-03-27  511  			mptcp_pm_new_connection(mptcp_sk(new_msk), 1);
962c918a1ca255 Paolo Abeni      2020-06-05 @512  			mptcp_token_accept(subflow_req, mptcp_sk(new_msk));
                                                                                           ^^^^^^^^^^^
Potential uninitialized?

58b09919626bf9 Paolo Abeni      2020-03-13  513  			ctx->conn = new_msk;
58b09919626bf9 Paolo Abeni      2020-03-13  514  			new_msk = NULL;
fca5c82c086ea3 Paolo Abeni      2020-04-20  515  
fca5c82c086ea3 Paolo Abeni      2020-04-20  516  			/* with OoO packets we can reach here without ingress
fca5c82c086ea3 Paolo Abeni      2020-04-20  517  			 * mpc option
fca5c82c086ea3 Paolo Abeni      2020-04-20  518  			 */
cfde141ea3faa3 Paolo Abeni      2020-04-30  519  			ctx->remote_key = mp_opt.sndr_key;
cfde141ea3faa3 Paolo Abeni      2020-04-30  520  			ctx->fully_established = mp_opt.mp_capable;
cfde141ea3faa3 Paolo Abeni      2020-04-30  521  			ctx->can_ack = mp_opt.mp_capable;
f296234c98a8fc Peter Krystad    2020-03-27  522  		} else if (ctx->mp_join) {
f296234c98a8fc Peter Krystad    2020-03-27  523  			struct mptcp_sock *owner;
f296234c98a8fc Peter Krystad    2020-03-27  524  
f296234c98a8fc Peter Krystad    2020-03-27  525  			owner = mptcp_token_get_sock(ctx->token);
f296234c98a8fc Peter Krystad    2020-03-27  526  			if (!owner)
729cd6436f359b Paolo Abeni      2020-05-15  527  				goto dispose_child;
f296234c98a8fc Peter Krystad    2020-03-27  528  
f296234c98a8fc Peter Krystad    2020-03-27  529  			ctx->conn = (struct sock *)owner;
f296234c98a8fc Peter Krystad    2020-03-27  530  			if (!mptcp_finish_join(child))
729cd6436f359b Paolo Abeni      2020-05-15  531  				goto dispose_child;
fc518953bc9c8d Florian Westphal 2020-03-27  532  
fc518953bc9c8d Florian Westphal 2020-03-27  533  			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX);
90bf45134d55d6 Paolo Abeni      2020-05-15  534  			tcp_rsk(req)->drop_req = true;
cec37a6e41aae7 Peter Krystad    2020-01-21  535  		}
cec37a6e41aae7 Peter Krystad    2020-01-21  536  	}
cec37a6e41aae7 Peter Krystad    2020-01-21  537  
58b09919626bf9 Paolo Abeni      2020-03-13  538  out:
58b09919626bf9 Paolo Abeni      2020-03-13  539  	/* dispose of the left over mptcp master, if any */
58b09919626bf9 Paolo Abeni      2020-03-13  540  	if (unlikely(new_msk))
9f5ca6a59816b4 Florian Westphal 2020-04-17  541  		mptcp_force_close(new_msk);
4c8941de781cf7 Paolo Abeni      2020-04-20  542  
4c8941de781cf7 Paolo Abeni      2020-04-20  543  	/* check for expected invariant - should never trigger, just help
4c8941de781cf7 Paolo Abeni      2020-04-20  544  	 * catching eariler subtle bugs
4c8941de781cf7 Paolo Abeni      2020-04-20  545  	 */
ac2b47fb92c506 Paolo Abeni      2020-04-30  546  	WARN_ON_ONCE(child && *own_req && tcp_sk(child)->is_mptcp &&
4c8941de781cf7 Paolo Abeni      2020-04-20  547  		     (!mptcp_subflow_ctx(child) ||
4c8941de781cf7 Paolo Abeni      2020-04-20  548  		      !mptcp_subflow_ctx(child)->conn));
cec37a6e41aae7 Peter Krystad    2020-01-21  549  	return child;
f296234c98a8fc Peter Krystad    2020-03-27  550  
729cd6436f359b Paolo Abeni      2020-05-15  551  dispose_child:
39884604b11692 Paolo Abeni      2020-05-29  552  	subflow_drop_ctx(child);
729cd6436f359b Paolo Abeni      2020-05-15  553  	tcp_rsk(req)->drop_req = true;
f296234c98a8fc Peter Krystad    2020-03-27  554  	tcp_send_active_reset(child, GFP_ATOMIC);
729cd6436f359b Paolo Abeni      2020-05-15  555  	inet_csk_prepare_for_destroy_sock(child);
f296234c98a8fc Peter Krystad    2020-03-27  556  	tcp_done(child);
729cd6436f359b Paolo Abeni      2020-05-15  557  
729cd6436f359b Paolo Abeni      2020-05-15  558  	/* The last child reference will be released by the caller */
729cd6436f359b Paolo Abeni      2020-05-15  559  	return child;
cec37a6e41aae7 Peter Krystad    2020-01-21  560  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32022 bytes --]

             reply	other threads:[~2020-06-08 13:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 13:15 Dan Carpenter [this message]
2020-06-08 13:15 ` [kbuild] [mptcp:export 5/10] net/mptcp/subflow.c:512 subflow_syn_recv_sock() error: uninitialized symbol 'subflow_req' Dan Carpenter
2020-06-08 13:15 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2020-06-08 13:29 [MPTCP] Re: [kbuild] " Paolo Abeni
2020-06-08 13:29 ` Paolo Abeni
2020-06-08 13:29 [MPTCP] " Paolo Abeni
2020-06-08 13:29 ` Paolo Abeni
2020-06-08 13:34 [MPTCP] " Dan Carpenter
2020-06-08 13:34 ` Dan Carpenter
2020-06-08 13:34 ` Dan Carpenter

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=20200608131535.GO22511@kadam \
    --to=unknown@example.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.