[cifs:for-next 9/10] fs/cifs/smb2misc.c:636 smb2_is_valid_lease_break() warn: inconsistent returns 'cifs_tcp_ses_lock'.
Dan Carpenter
dan.carpenter at oracle.com
Tue Jul 7 13:49:54 UTC 2020
tree: git://git.samba.org/sfrench/cifs-2.6.git for-next
head: 211c3acc991c97873768d28b6bfef339e8ba0a49
commit: 001d62cb0d3f18e93acc340510c69745a2586907 [9/10] cifs: Fix leak when handling lease break for cached root fid
config: i386-randconfig-m021-20200703 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
smatch warnings:
fs/cifs/smb2misc.c:636 smb2_is_valid_lease_break() warn: inconsistent returns 'cifs_tcp_ses_lock'.
git remote add cifs git://git.samba.org/sfrench/cifs-2.6.git
git remote update cifs
git checkout 001d62cb0d3f18e93acc340510c69745a2586907
vim +/cifs_tcp_ses_lock +636 fs/cifs/smb2misc.c
933d4b36576c95 Pavel Shilovsky 2013-09-05 592 static bool
933d4b36576c95 Pavel Shilovsky 2013-09-05 593 smb2_is_valid_lease_break(char *buffer)
933d4b36576c95 Pavel Shilovsky 2013-09-05 594 {
933d4b36576c95 Pavel Shilovsky 2013-09-05 595 struct smb2_lease_break *rsp = (struct smb2_lease_break *)buffer;
933d4b36576c95 Pavel Shilovsky 2013-09-05 596 struct list_head *tmp, *tmp1, *tmp2;
933d4b36576c95 Pavel Shilovsky 2013-09-05 597 struct TCP_Server_Info *server;
933d4b36576c95 Pavel Shilovsky 2013-09-05 598 struct cifs_ses *ses;
933d4b36576c95 Pavel Shilovsky 2013-09-05 599 struct cifs_tcon *tcon;
933d4b36576c95 Pavel Shilovsky 2013-09-05 600
933d4b36576c95 Pavel Shilovsky 2013-09-05 601 cifs_dbg(FYI, "Checking for lease break\n");
933d4b36576c95 Pavel Shilovsky 2013-09-05 602
933d4b36576c95 Pavel Shilovsky 2013-09-05 603 /* look up tcon based on tid & uid */
933d4b36576c95 Pavel Shilovsky 2013-09-05 604 spin_lock(&cifs_tcp_ses_lock);
933d4b36576c95 Pavel Shilovsky 2013-09-05 605 list_for_each(tmp, &cifs_tcp_ses_list) {
933d4b36576c95 Pavel Shilovsky 2013-09-05 606 server = list_entry(tmp, struct TCP_Server_Info, tcp_ses_list);
933d4b36576c95 Pavel Shilovsky 2013-09-05 607
933d4b36576c95 Pavel Shilovsky 2013-09-05 608 list_for_each(tmp1, &server->smb_ses_list) {
933d4b36576c95 Pavel Shilovsky 2013-09-05 609 ses = list_entry(tmp1, struct cifs_ses, smb_ses_list);
933d4b36576c95 Pavel Shilovsky 2013-09-05 610
933d4b36576c95 Pavel Shilovsky 2013-09-05 611 list_for_each(tmp2, &ses->tcon_list) {
933d4b36576c95 Pavel Shilovsky 2013-09-05 612 tcon = list_entry(tmp2, struct cifs_tcon,
933d4b36576c95 Pavel Shilovsky 2013-09-05 613 tcon_list);
933d4b36576c95 Pavel Shilovsky 2013-09-05 614 cifs_stats_inc(
933d4b36576c95 Pavel Shilovsky 2013-09-05 615 &tcon->stats.cifs_stats.num_oplock_brks);
001d62cb0d3f18 Paul Aurich 2020-07-02 616 if (smb2_tcon_has_lease(tcon, rsp)) {
233839b1df65a2 Pavel Shilovsky 2012-09-19 617 return true;
^^^^^^^^^^^
Holding the lock?
233839b1df65a2 Pavel Shilovsky 2012-09-19 618 }
a93864d93977b9 Ronnie Sahlberg 2018-06-14 619
a93864d93977b9 Ronnie Sahlberg 2018-06-14 620 if (tcon->crfid.is_valid &&
a93864d93977b9 Ronnie Sahlberg 2018-06-14 621 !memcmp(rsp->LeaseKey,
a93864d93977b9 Ronnie Sahlberg 2018-06-14 622 tcon->crfid.fid->lease_key,
a93864d93977b9 Ronnie Sahlberg 2018-06-14 623 SMB2_LEASE_KEY_SIZE)) {
a93864d93977b9 Ronnie Sahlberg 2018-06-14 624 INIT_WORK(&tcon->crfid.lease_break,
a93864d93977b9 Ronnie Sahlberg 2018-06-14 625 smb2_cached_lease_break);
a93864d93977b9 Ronnie Sahlberg 2018-06-14 626 queue_work(cifsiod_wq,
a93864d93977b9 Ronnie Sahlberg 2018-06-14 627 &tcon->crfid.lease_break);
a93864d93977b9 Ronnie Sahlberg 2018-06-14 628 spin_unlock(&cifs_tcp_ses_lock);
a93864d93977b9 Ronnie Sahlberg 2018-06-14 629 return true;
a93864d93977b9 Ronnie Sahlberg 2018-06-14 630 }
0822f51426b51b Pavel Shilovsky 2012-09-19 631 }
0822f51426b51b Pavel Shilovsky 2012-09-19 632 }
933d4b36576c95 Pavel Shilovsky 2013-09-05 633 }
0822f51426b51b Pavel Shilovsky 2012-09-19 634 spin_unlock(&cifs_tcp_ses_lock);
f96637be081141 Joe Perches 2013-05-04 635 cifs_dbg(FYI, "Can not process lease break - no lease matched\n");
0822f51426b51b Pavel Shilovsky 2012-09-19 @636 return false;
0822f51426b51b Pavel Shilovsky 2012-09-19 637 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 34783 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20200707/f7f2a3c5/config.gz>
More information about the samba-technical
mailing list