[PATCH 1/2] smbd: Fix an ancient oplock bug

Volker Lendecke Volker.Lendecke at SerNet.DE
Wed Sep 4 16:19:25 CEST 2013


Hi, Jeremy!

Please review & push!

Thanks,

Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de

*****************************************************************
visit us on it-sa:IT security exhibitions in Nürnberg, Germany
October 8th - 10th 2013, hall 12, booth 333
free tickets available via code 270691 on: www.it-sa.de/gutschein
******************************************************************
-------------- next part --------------
From f6469a2e978697070729d98d310d34755a71453b Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 4 Sep 2013 13:57:00 +0200
Subject: [PATCH 1/2] smbd: Fix an ancient oplock bug

If we get an oplock break response, we forgot to remove the oplock break
timeout.

Found by stopping raw.oplock.exclusive5 after the 2nd open and watching a debug
level 10 log. This amends 08a9de89 from 2007.

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/smbd/oplock.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 21792bd..7b0a979 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -150,6 +150,8 @@ static void downgrade_file_oplock(files_struct *fsp)
 	sconn->oplocks.exclusive_open--;
 	sconn->oplocks.level_II_open++;
 	fsp->sent_oplock_break = NO_BREAK_SENT;
+
+	TALLOC_FREE(fsp->oplock_timeout);
 }
 
 /****************************************************************************
-- 
1.7.9.5


From e774a7cb1ae730b1bcaf756d314b461c8f0c4190 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 4 Sep 2013 14:20:00 +0200
Subject: [PATCH 2/2] smbd: Add a paranoia check to oplock_timeout_handler

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/smbd/oplock.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 7b0a979..434bafa 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -323,6 +323,8 @@ static void oplock_timeout_handler(struct tevent_context *ctx,
 {
 	files_struct *fsp = (files_struct *)private_data;
 
+	SMB_ASSERT(fsp->sent_oplock_break != NO_BREAK_SENT);
+
 	/* Remove the timed event handler. */
 	TALLOC_FREE(fsp->oplock_timeout);
 	DEBUG(0, ("Oplock break failed for file %s -- replying anyway\n",
-- 
1.7.9.5



More information about the samba-technical mailing list