linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [cifs:for-next 9/9] fs/cifs/connect.c:254:14: warning: variable 'ses' is uninitialized when used here
@ 2021-06-05 20:52 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-06-05 20:52 UTC (permalink / raw)
  To: Steve French; +Cc: kbuild-all, clang-built-linux, linux-cifs, samba-technical

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

tree:   git://git.samba.org/sfrench/cifs-2.6.git for-next
head:   52834f2e3fd972647736d6cfad34fa2f1aedb51c
commit: 52834f2e3fd972647736d6cfad34fa2f1aedb51c [9/9] cifs: fix minor build problems with the previous patch
config: x86_64-randconfig-r013-20210606 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8ec9aa236e325fd4629cfeefac2919302e14d61a)
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
        git remote add cifs git://git.samba.org/sfrench/cifs-2.6.git
        git fetch --no-tags cifs for-next
        git checkout 52834f2e3fd972647736d6cfad34fa2f1aedb51c
        # 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 >>):

>> fs/cifs/connect.c:254:14: warning: variable 'ses' is uninitialized when used here [-Wuninitialized]
           mutex_lock(&ses->session_mutex);
                       ^~~
   include/linux/mutex.h:165:44: note: expanded from macro 'mutex_lock'
   #define mutex_lock(lock) mutex_lock_nested(lock, 0)
                                              ^~~~
   fs/cifs/connect.c:189:22: note: initialize the variable 'ses' to silence this warning
           struct cifs_ses *ses;
                               ^
                                = NULL
   1 warning generated.


vim +/ses +254 fs/cifs/connect.c

^1da177e4c3f41 Linus Torvalds         2005-04-16  199  
aed2a5f0a2bf7b Shyam Prasad N         2021-05-22  200  	/* If server is a channel, select the primary channel */
aed2a5f0a2bf7b Shyam Prasad N         2021-05-22  201  	pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server;
aed2a5f0a2bf7b Shyam Prasad N         2021-05-22  202  
^1da177e4c3f41 Linus Torvalds         2005-04-16  203  	spin_lock(&GlobalMid_Lock);
93d5cb517db39e Paulo Alcantara        2018-11-14  204  	server->nr_targets = 1;
93d5cb517db39e Paulo Alcantara        2018-11-14  205  #ifdef CONFIG_CIFS_DFS_UPCALL
61cabc7b0a5cf0 Ronnie Sahlberg        2019-06-14  206  	spin_unlock(&GlobalMid_Lock);
bacd704a95ad0b Paulo Alcantara (SUSE  2020-02-20  207) 	sb = cifs_get_tcp_super(server);
8354d88efdab72 Paulo Alcantara (SUSE  2019-11-22  208) 	if (IS_ERR(sb)) {
8354d88efdab72 Paulo Alcantara (SUSE  2019-11-22  209) 		rc = PTR_ERR(sb);
93d5cb517db39e Paulo Alcantara        2018-11-14  210  		cifs_dbg(FYI, "%s: will not do DFS failover: rc = %d\n",
93d5cb517db39e Paulo Alcantara        2018-11-14  211  			 __func__, rc);
8354d88efdab72 Paulo Alcantara (SUSE  2019-11-22  212) 		sb = NULL;
93d5cb517db39e Paulo Alcantara        2018-11-14  213  	} else {
8354d88efdab72 Paulo Alcantara (SUSE  2019-11-22  214) 		cifs_sb = CIFS_SB(sb);
baf3f08ef4083b Paulo Alcantara        2020-05-19  215  		rc = reconn_setup_dfs_targets(cifs_sb, &tgt_list);
a52930353eaf44 Paulo Alcantara        2020-07-21  216  		if (rc) {
a52930353eaf44 Paulo Alcantara        2020-07-21  217  			cifs_sb = NULL;
a52930353eaf44 Paulo Alcantara        2020-07-21  218  			if (rc != -EOPNOTSUPP) {
afe6f65353b644 Ronnie Sahlberg        2019-08-28  219  				cifs_server_dbg(VFS, "%s: no target servers for DFS failover\n",
93d5cb517db39e Paulo Alcantara        2018-11-14  220  						__func__);
a52930353eaf44 Paulo Alcantara        2020-07-21  221  			}
93d5cb517db39e Paulo Alcantara        2018-11-14  222  		} else {
93d5cb517db39e Paulo Alcantara        2018-11-14  223  			server->nr_targets = dfs_cache_get_nr_tgts(&tgt_list);
93d5cb517db39e Paulo Alcantara        2018-11-14  224  		}
93d5cb517db39e Paulo Alcantara        2018-11-14  225  	}
93d5cb517db39e Paulo Alcantara        2018-11-14  226  	cifs_dbg(FYI, "%s: will retry %d target(s)\n", __func__,
93d5cb517db39e Paulo Alcantara        2018-11-14  227  		 server->nr_targets);
61cabc7b0a5cf0 Ronnie Sahlberg        2019-06-14  228  	spin_lock(&GlobalMid_Lock);
93d5cb517db39e Paulo Alcantara        2018-11-14  229  #endif
469ee614aaa367 Jeff Layton            2008-10-16  230  	if (server->tcpStatus == CifsExiting) {
^1da177e4c3f41 Linus Torvalds         2005-04-16  231  		/* the demux thread will exit normally
^1da177e4c3f41 Linus Torvalds         2005-04-16  232  		next time through the loop */
^1da177e4c3f41 Linus Torvalds         2005-04-16  233  		spin_unlock(&GlobalMid_Lock);
8354d88efdab72 Paulo Alcantara (SUSE  2019-11-22  234) #ifdef CONFIG_CIFS_DFS_UPCALL
8354d88efdab72 Paulo Alcantara (SUSE  2019-11-22  235) 		dfs_cache_free_tgts(&tgt_list);
bacd704a95ad0b Paulo Alcantara (SUSE  2020-02-20  236) 		cifs_put_tcp_super(sb);
8354d88efdab72 Paulo Alcantara (SUSE  2019-11-22  237) #endif
e2e87519bd72e2 Stefan Metzmacher      2020-02-24  238  		wake_up(&server->response_q);
^1da177e4c3f41 Linus Torvalds         2005-04-16  239  		return rc;
^1da177e4c3f41 Linus Torvalds         2005-04-16  240  	} else
^1da177e4c3f41 Linus Torvalds         2005-04-16  241  		server->tcpStatus = CifsNeedReconnect;
^1da177e4c3f41 Linus Torvalds         2005-04-16  242  	spin_unlock(&GlobalMid_Lock);
^1da177e4c3f41 Linus Torvalds         2005-04-16  243  	server->maxBuf = 0;
aa24d1e9692411 Pavel Shilovsky        2011-12-27  244  	server->max_read = 0;
^1da177e4c3f41 Linus Torvalds         2005-04-16  245  
6e4d3bbe92120f Steve French           2018-09-22  246  	cifs_dbg(FYI, "Mark tcp session as need reconnect\n");
6d82c27ae5d048 Shyam Prasad N         2021-02-03  247  	trace_smb3_reconnect(server->CurrentMid, server->conn_id, server->hostname);
^1da177e4c3f41 Linus Torvalds         2005-04-16  248  
^1da177e4c3f41 Linus Torvalds         2005-04-16  249  	/* before reconnecting the tcp session, mark the smb session (uid)
^1da177e4c3f41 Linus Torvalds         2005-04-16  250  		and the tid bad so they are not used until reconnected */
f96637be081141 Joe Perches            2013-05-04  251  	cifs_dbg(FYI, "%s: marking sessions and tcons for reconnect\n",
f96637be081141 Joe Perches            2013-05-04  252  		 __func__);
c40805fedca942 Shyam Prasad N         2021-06-05  253  
c40805fedca942 Shyam Prasad N         2021-06-05 @254  	mutex_lock(&ses->session_mutex);
3f9bcca7820a67 Suresh Jayaraman       2010-10-18  255  	spin_lock(&cifs_tcp_ses_lock);
aed2a5f0a2bf7b Shyam Prasad N         2021-05-22  256  	list_for_each(tmp, &pserver->smb_ses_list) {
96daf2b09178d8 Steve French           2011-05-27  257  		ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
aed2a5f0a2bf7b Shyam Prasad N         2021-05-22  258  
aed2a5f0a2bf7b Shyam Prasad N         2021-05-22  259  		cifs_chan_set_need_reconnect(ses, server);
aed2a5f0a2bf7b Shyam Prasad N         2021-05-22  260  
aed2a5f0a2bf7b Shyam Prasad N         2021-05-22  261  		/* If all channels need reconnect, then tcon needs reconnect */
aed2a5f0a2bf7b Shyam Prasad N         2021-05-22  262  		if (!CIFS_ALL_CHANS_NEED_RECONNECT(ses))
52834f2e3fd972 Steve French           2021-06-05  263  			continue;
aed2a5f0a2bf7b Shyam Prasad N         2021-05-22  264  
f1987b44f642e9 Jeff Layton            2008-11-15  265  		list_for_each(tmp2, &ses->tcon_list) {
96daf2b09178d8 Steve French           2011-05-27  266  			tcon = list_entry(tmp2, struct cifs_tcon, tcon_list);
3b7952109361c6 Steve French           2008-11-13  267  			tcon->need_reconnect = true;
^1da177e4c3f41 Linus Torvalds         2005-04-16  268  		}
b327a717e50698 Aurelien Aptel         2018-01-24  269  		if (ses->tcon_ipc)
b327a717e50698 Aurelien Aptel         2018-01-24  270  			ses->tcon_ipc->need_reconnect = true;
^1da177e4c3f41 Linus Torvalds         2005-04-16  271  	}
3f9bcca7820a67 Suresh Jayaraman       2010-10-18  272  	spin_unlock(&cifs_tcp_ses_lock);
c40805fedca942 Shyam Prasad N         2021-06-05  273  	mutex_unlock(&ses->session_mutex);
2b84a36c5529da Jeff Layton            2011-01-11  274  
^1da177e4c3f41 Linus Torvalds         2005-04-16  275  	/* do not want to be sending data on a socket we are freeing */
f96637be081141 Joe Perches            2013-05-04  276  	cifs_dbg(FYI, "%s: tearing down socket\n", __func__);
72ca545b2d83ac Jeff Layton            2008-12-01  277  	mutex_lock(&server->srv_mutex);
1d2a4f57cebdab Long Li                2019-05-13  278  	if (server->ssocket) {
1d2a4f57cebdab Long Li                2019-05-13  279  		cifs_dbg(FYI, "State: 0x%x Flags: 0x%lx\n",
1d2a4f57cebdab Long Li                2019-05-13  280  			 server->ssocket->state, server->ssocket->flags);
1d2a4f57cebdab Long Li                2019-05-13  281  		kernel_sock_shutdown(server->ssocket, SHUT_WR);
1d2a4f57cebdab Long Li                2019-05-13  282  		cifs_dbg(FYI, "Post shutdown state: 0x%x Flags: 0x%lx\n",
1d2a4f57cebdab Long Li                2019-05-13  283  			 server->ssocket->state, server->ssocket->flags);
1d2a4f57cebdab Long Li                2019-05-13  284  		sock_release(server->ssocket);
1d2a4f57cebdab Long Li                2019-05-13  285  		server->ssocket = NULL;
1d2a4f57cebdab Long Li                2019-05-13  286  	}
1d2a4f57cebdab Long Li                2019-05-13  287  	server->sequence_number = 0;
1d2a4f57cebdab Long Li                2019-05-13  288  	server->session_estab = false;
1d2a4f57cebdab Long Li                2019-05-13  289  	kfree(server->session_key.response);
1d2a4f57cebdab Long Li                2019-05-13  290  	server->session_key.response = NULL;
1d2a4f57cebdab Long Li                2019-05-13  291  	server->session_key.len = 0;
1d2a4f57cebdab Long Li                2019-05-13  292  	server->lstrp = jiffies;
^1da177e4c3f41 Linus Torvalds         2005-04-16  293  
2b84a36c5529da Jeff Layton            2011-01-11  294  	/* mark submitted MIDs for retry and issue callback */
3c1105df699188 Jeff Layton            2011-05-22  295  	INIT_LIST_HEAD(&retry_list);
f96637be081141 Joe Perches            2013-05-04  296  	cifs_dbg(FYI, "%s: moving mids to private list\n", __func__);
^1da177e4c3f41 Linus Torvalds         2005-04-16  297  	spin_lock(&GlobalMid_Lock);
2b84a36c5529da Jeff Layton            2011-01-11  298  	list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
2b84a36c5529da Jeff Layton            2011-01-11  299  		mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
abe57073d08c13 Pavel Shilovsky        2019-10-22  300  		kref_get(&mid_entry->refcount);
7c9421e1a9ce8d Pavel Shilovsky        2012-03-23  301  		if (mid_entry->mid_state == MID_REQUEST_SUBMITTED)
7c9421e1a9ce8d Pavel Shilovsky        2012-03-23  302  			mid_entry->mid_state = MID_RETRY_NEEDED;
3c1105df699188 Jeff Layton            2011-05-22  303  		list_move(&mid_entry->qhead, &retry_list);
abe57073d08c13 Pavel Shilovsky        2019-10-22  304  		mid_entry->mid_flags |= MID_DELETED;
3c1105df699188 Jeff Layton            2011-05-22  305  	}
3c1105df699188 Jeff Layton            2011-05-22  306  	spin_unlock(&GlobalMid_Lock);
1d2a4f57cebdab Long Li                2019-05-13  307  	mutex_unlock(&server->srv_mutex);
3c1105df699188 Jeff Layton            2011-05-22  308  
f96637be081141 Joe Perches            2013-05-04  309  	cifs_dbg(FYI, "%s: issuing mid callbacks\n", __func__);
3c1105df699188 Jeff Layton            2011-05-22  310  	list_for_each_safe(tmp, tmp2, &retry_list) {
3c1105df699188 Jeff Layton            2011-05-22  311  		mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
2b84a36c5529da Jeff Layton            2011-01-11  312  		list_del_init(&mid_entry->qhead);
2b84a36c5529da Jeff Layton            2011-01-11  313  		mid_entry->callback(mid_entry);
abe57073d08c13 Pavel Shilovsky        2019-10-22  314  		cifs_mid_q_entry_release(mid_entry);
^1da177e4c3f41 Linus Torvalds         2005-04-16  315  	}
^1da177e4c3f41 Linus Torvalds         2005-04-16  316  
1d2a4f57cebdab Long Li                2019-05-13  317  	if (cifs_rdma_enabled(server)) {
1d2a4f57cebdab Long Li                2019-05-13  318  		mutex_lock(&server->srv_mutex);
214bab448476db Long Li                2019-04-05  319  		smbd_destroy(server);
214bab448476db Long Li                2019-04-05  320  		mutex_unlock(&server->srv_mutex);
1d2a4f57cebdab Long Li                2019-05-13  321  	}
214bab448476db Long Li                2019-04-05  322  
7fdbaa1b8daa10 Jeff Layton            2011-06-10  323  	do {
6c3d8909d85b2c Steve French           2006-07-31  324  		try_to_freeze();
a9f1b85e5ba805 Pavel Shilovsky        2010-12-13  325  
73e216a8a42c0e Jeff Layton            2013-09-05  326  		mutex_lock(&server->srv_mutex);
121d947d4fe15b Samuel Cabrero         2020-11-30  327  
121d947d4fe15b Samuel Cabrero         2020-11-30  328  
b7fd0fa0eac701 Aurelien Aptel         2021-04-09  329  		if (!cifs_swn_set_server_dstaddr(server)) {
aaa3aef34d3ab9 Paulo Alcantara        2020-05-19  330  #ifdef CONFIG_CIFS_DFS_UPCALL
4e456b30f78c42 Shyam Prasad N         2021-03-31  331  		if (cifs_sb && cifs_sb->origin_fullpath)
93d5cb517db39e Paulo Alcantara        2018-11-14  332  			/*
93d5cb517db39e Paulo Alcantara        2018-11-14  333  			 * Set up next DFS target server (if any) for reconnect. If DFS
93d5cb517db39e Paulo Alcantara        2018-11-14  334  			 * feature is disabled, then we will retry last server we
93d5cb517db39e Paulo Alcantara        2018-11-14  335  			 * connected to before.
93d5cb517db39e Paulo Alcantara        2018-11-14  336  			 */
7d397a034d5c45 Paulo Alcantara        2020-07-21  337  			reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it);
4e456b30f78c42 Shyam Prasad N         2021-03-31  338  		else {
4e456b30f78c42 Shyam Prasad N         2021-03-31  339  #endif
4e456b30f78c42 Shyam Prasad N         2021-03-31  340  			/*
4e456b30f78c42 Shyam Prasad N         2021-03-31  341  			 * Resolve the hostname again to make sure that IP address is up-to-date.
4e456b30f78c42 Shyam Prasad N         2021-03-31  342  			 */
4e456b30f78c42 Shyam Prasad N         2021-03-31  343  			rc = reconn_set_ipaddr_from_hostname(server);
4e456b30f78c42 Shyam Prasad N         2021-03-31  344  			if (rc) {
4e456b30f78c42 Shyam Prasad N         2021-03-31  345  				cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n",
4e456b30f78c42 Shyam Prasad N         2021-03-31  346  						__func__, rc);
4e456b30f78c42 Shyam Prasad N         2021-03-31  347  			}
4e456b30f78c42 Shyam Prasad N         2021-03-31  348  

:::::: The code at line 254 was first introduced by commit
:::::: c40805fedca942c90cd81c095828077e6b1b289e cifs: lock session_mutex before trying to lock cifs_tcp_ses_lock

:::::: TO: Shyam Prasad N <sprasad@microsoft.com>
:::::: CC: Steve French <stfrench@microsoft.com>

---
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: 40201 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-05 20:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-05 20:52 [cifs:for-next 9/9] fs/cifs/connect.c:254:14: warning: variable 'ses' is uninitialized when used here kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).