From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@01.org, Steve French <stfrench@microsoft.com>,
Aurelien Aptel <aaptel@suse.com>
Cc: kbuild-all@01.org, linux-cifs@vger.kernel.org,
samba-technical@lists.samba.org,
Pavel Shilovsky <pshilov@microsoft.com>
Subject: [cifs:for-next 31/31] fs/cifs/smb2ops.c:786 open_shroot() error: double unlock 'mutex:&tcon->crfid.fid_mutex'
Date: Fri, 13 Sep 2019 16:55:11 +0300 [thread overview]
Message-ID: <20190913135510.GS20699@kadam> (raw)
tree: git://git.samba.org/sfrench/cifs-2.6.git for-next
head: 5fc321fb644fc787710353be11129edadd313f3a
commit: 5fc321fb644fc787710353be11129edadd313f3a [31/31] smb3: fix unmount hang in open_shroot
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
fs/cifs/smb2ops.c:786 open_shroot() error: double unlock 'mutex:&tcon->crfid.fid_mutex'
git remote add cifs git://git.samba.org/sfrench/cifs-2.6.git
git remote update cifs
git checkout 5fc321fb644fc787710353be11129edadd313f3a
vim +786 fs/cifs/smb2ops.c
fs/cifs/smb2ops.c
726 /*
727 * caller expects this func to set pfid to a valid
728 * cached root, so we copy the existing one and get a
729 * reference.
730 */
731 memcpy(pfid, tcon->crfid.fid, sizeof(*pfid));
732 kref_get(&tcon->crfid.refcount);
733
734 mutex_unlock(&tcon->crfid.fid_mutex);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Unlock (recently added)
735
736 if (rc == 0) {
737 /* close extra handle outside of crit sec */
738 SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid);
739 }
740 goto oshr_free;
741 }
742
743 /* Cached root is still invalid, continue normaly */
744
745 if (rc) {
746 if (rc == -EREMCHG) {
747 tcon->need_reconnect = true;
748 printk_once(KERN_WARNING "server share %s deleted\n",
749 tcon->treeName);
750 }
751 goto oshr_exit;
752 }
753
754 o_rsp = (struct smb2_create_rsp *)rsp_iov[0].iov_base;
755 oparms.fid->persistent_fid = o_rsp->PersistentFileId;
756 oparms.fid->volatile_fid = o_rsp->VolatileFileId;
757 #ifdef CONFIG_CIFS_DEBUG2
758 oparms.fid->mid = le64_to_cpu(o_rsp->sync_hdr.MessageId);
759 #endif /* CIFS_DEBUG2 */
760
761 memcpy(tcon->crfid.fid, pfid, sizeof(struct cifs_fid));
762 tcon->crfid.tcon = tcon;
763 tcon->crfid.is_valid = true;
764 kref_init(&tcon->crfid.refcount);
765
766 /* BB TBD check to see if oplock level check can be removed below */
767 if (o_rsp->OplockLevel == SMB2_OPLOCK_LEVEL_LEASE) {
768 kref_get(&tcon->crfid.refcount);
769 smb2_parse_contexts(server, o_rsp,
770 &oparms.fid->epoch,
771 oparms.fid->lease_key, &oplock, NULL);
772 } else
773 goto oshr_exit;
774
775 qi_rsp = (struct smb2_query_info_rsp *)rsp_iov[1].iov_base;
776 if (le32_to_cpu(qi_rsp->OutputBufferLength) < sizeof(struct smb2_file_all_info))
777 goto oshr_exit;
778 if (!smb2_validate_and_copy_iov(
779 le16_to_cpu(qi_rsp->OutputBufferOffset),
780 sizeof(struct smb2_file_all_info),
781 &rsp_iov[1], sizeof(struct smb2_file_all_info),
782 (char *)&tcon->crfid.file_all_info))
783 tcon->crfid.file_all_info_is_valid = 1;
784
785 oshr_exit:
786 mutex_unlock(&tcon->crfid.fid_mutex);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Double unlock.
787 oshr_free:
788 SMB2_open_free(&rqst[0]);
789 SMB2_query_info_free(&rqst[1]);
790 free_rsp_buf(resp_buftype[0], rsp_iov[0].iov_base);
791 free_rsp_buf(resp_buftype[1], rsp_iov[1].iov_base);
792 return rc;
793 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
next reply other threads:[~2019-09-13 13:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-13 13:55 Dan Carpenter [this message]
2019-09-13 19:46 ` [cifs:for-next 31/31] fs/cifs/smb2ops.c:786 open_shroot() error: double unlock 'mutex:&tcon->crfid.fid_mutex' Steve French
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=20190913135510.GS20699@kadam \
--to=dan.carpenter@oracle.com \
--cc=aaptel@suse.com \
--cc=kbuild-all@01.org \
--cc=kbuild@01.org \
--cc=linux-cifs@vger.kernel.org \
--cc=pshilov@microsoft.com \
--cc=samba-technical@lists.samba.org \
--cc=stfrench@microsoft.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox