From 243283c7e9fd0ac22a8aec6fb9eee318a4c4662c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Apr 2013 17:40:07 -0700 Subject: [PATCH] Fix bug #9794 - opening/editing or copying MS files causes a core dump with invalid lock order. open_file_fchmod() uses INTERNAL_OPEN_ONLY which doesn't conflict with oplocks or deny modes, so it doesn't need to allocate any global state either. We detect this as all INTERNAL_OPEN_ONLY calls have no associated struct smb_request * pointer (file_new() already has code to cope with this). Additional from Volker - ensure create_file_unixpath() propagates the 'req' pointer. Signed-off-by: Jeremy Allison --- source3/smbd/files.c | 6 +++++- source3/smbd/open.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source3/smbd/files.c b/source3/smbd/files.c index d94ee11..37493f2 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -93,7 +93,11 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn, GetTimeOfDay(&fsp->open_time); - if (sconn->conn) { + if (sconn->conn && req != NULL) { + /* + * We only do this on non-internal opens + * which have a valid req struct. + */ struct smbXsrv_open *op = NULL; NTTIME now = timeval_to_nttime(&fsp->open_time); diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 0d9698a..c9075ad 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3755,7 +3755,7 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, } /* Open the base file. */ - status = create_file_unixpath(conn, NULL, smb_fname_base, 0, + status = create_file_unixpath(conn, req, smb_fname_base, 0, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, -- 1.7.10.4