Bug 15038 - SMB2_CLOSE_FLAGS_FULL_INFORMATION fails to return information on renamed file handle.
Summary: SMB2_CLOSE_FLAGS_FULL_INFORMATION fails to return information on renamed file...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.16.0
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on: 15022
Blocks: 15035
  Show dependency treegraph
 
Reported: 2022-03-28 22:43 UTC by Jeremy Allison
Modified: 2022-05-02 09:48 UTC (History)
2 users (show)

See Also:


Attachments
git-am fix for master. (12.69 KB, patch)
2022-03-29 01:44 UTC, Jeremy Allison
no flags Details
git-am fix for 4.16.next, 4.15.next. (14.21 KB, patch)
2022-03-30 16:34 UTC, Jeremy Allison
slow: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2022-03-28 22:43:08 UTC
Found by the Apple client team. When we rename a file that is open multiple times in the client (i.e. more than one handle), we only preserve the stat info on the handle that is being renamed, not any of the other handles. If the client closes the handles without stat info using SMB2_CLOSE_FLAGS_FULL_INFORMATION then the openat_pathref_fsp() call to get the full information on close fails as in 4.16.x and 4.15.x openat_pathref_fsp() requires VALID_STAT(fsp->fsp_name->st) before opening the file.

I have a regression test that demonstrates this problem.

This doesn't fail on master as master has been changed to not require VALID_STAT(fsp->fsp_name->st) inside openat_pathref_fsp(), and successfully fstat's the handle before returning to setup_close_full_information().

The same fix (preserve stat info across handle renames) needs applying to the MSG_SMB_FILE_RENAME handler msg_file_was_renamed().
Comment 1 Jeremy Allison 2022-03-29 01:44:51 UTC
Created attachment 17253 [details]
git-am fix for master.

So I don't lose the original fix..
Comment 2 Ralph Böhme 2022-03-29 04:43:22 UTC
Oh, good catch! :)
Comment 3 Jeremy Allison 2022-03-29 05:13:26 UTC
Passes ci. MR for master is:

https://gitlab.com/samba-team/samba/-/merge_requests/2466
Comment 4 Samba QA Contact 2022-03-30 15:08:11 UTC
This bug was referenced in samba master:

e01c5992b061d8ed54645fff52a73418013340ab
e862a2d9ec4e7bec1dd58490e9dee47d543b9154
4725ef5c96395dc2f48fab1160a3312d95e21416
1301e6461393601a4d43cfc465a05114e6ae4662
5e1aa469ae61af0442f432e0a2e3bf8c8709616a
06bfac2125da5e4d37a596d1213912f0c698e69e
Comment 5 Jeremy Allison 2022-03-30 16:34:26 UTC
Created attachment 17257 [details]
git-am fix for 4.16.next, 4.15.next.

Note, the patch for bug: https://bugzilla.samba.org/show_bug.cgi?id=15022

must be applied first in order for this to apply cleanly to 4.15.next, 4.16.next.
Comment 6 Ralph Böhme 2022-04-05 17:42:44 UTC
Reassigning to Jule for inclusion in 4.15 and 4.16.
Comment 7 Jule Anger 2022-04-11 07:44:50 UTC
Pushed to autobuild-v4-{16,15}-test.
Comment 8 Samba QA Contact 2022-04-11 08:51:20 UTC
This bug was referenced in samba v4-16-test:

552e0867848486629cc18bf52f7922768f41e1d5
60386712349f2a9f48f38fdc7c8dca8d4f635640
140670f6c05846f004ed70a3642780b3fa199bac
96a8922639d5ad9dc5005c5a1b1d747686a0d44f
a68c572869dbf31104404dfef0949dabea77c4d3
414d890b65ef742acb736484525dd54039e09c18
Comment 9 Samba QA Contact 2022-04-11 09:22:20 UTC
This bug was referenced in samba v4-15-test:

23e3863b0705ca2bd277410e657b751c58fefca1
5e42298e69ac37172bd9d42c0d8943d0491ebd66
1b90b7b1aa3ceab546201868aed0ae7c419b2047
057babba5c2797e0e526b28b88f2f8b9fa5fb779
60802b1df92c1825460e04441ddd671516042e99
cc08531b0e524630eae6225cf1070e6ab6c66bad
Comment 10 Jule Anger 2022-04-11 11:20:14 UTC
Closing out bug report.

Thanks!
Comment 11 Samba QA Contact 2022-04-26 14:44:22 UTC
This bug was referenced in samba v4-15-stable (Release samba-4.15.7):

23e3863b0705ca2bd277410e657b751c58fefca1
5e42298e69ac37172bd9d42c0d8943d0491ebd66
1b90b7b1aa3ceab546201868aed0ae7c419b2047
057babba5c2797e0e526b28b88f2f8b9fa5fb779
60802b1df92c1825460e04441ddd671516042e99
cc08531b0e524630eae6225cf1070e6ab6c66bad
Comment 12 Samba QA Contact 2022-05-02 09:48:23 UTC
This bug was referenced in samba v4-16-stable (Release samba-4.16.1):

552e0867848486629cc18bf52f7922768f41e1d5
60386712349f2a9f48f38fdc7c8dca8d4f635640
140670f6c05846f004ed70a3642780b3fa199bac
96a8922639d5ad9dc5005c5a1b1d747686a0d44f
a68c572869dbf31104404dfef0949dabea77c4d3
414d890b65ef742acb736484525dd54039e09c18