s3: Fix a crash in reply_lockingX_error
commitb27caac5e077b49f46edf34045bb4fd8d17b4c77
authorVolker Lendecke <vl@samba.org>
Tue, 7 Aug 2012 23:49:52 +0000 (7 16:49 -0700)
committerKarolin Seeger <kseeger@samba.org>
Mon, 13 Aug 2012 05:28:38 +0000 (13 07:28 +0200)
treefa013acd259b77427fe70965d19715d3e7d558a9
parent81cf4fc831a782dc315362852b09eba67c26e685
s3: Fix a crash in reply_lockingX_error

A timed brlock with 2 locks comes in and the second one blocks,
file is closed. smbd_cancel_pending_lock_requests_by_fid sets
blr->fsp to NULL. reply_lockingX_error (called via
MSG_SMB_BLOCKING_LOCK_CANCEL) deferences blr->fsp because
blr->lock_num==1 (the second one blocked).

This patch fixes the bug by only undoing the locks if fsp!=NULL.
fsp==NULL is the close case where everything is undone anyway.

Thanks to Peter Somogyi, somogyi@hu.ibm.com for this bug report.

Fix bug #9084 - Blocking lock followed by close can crash smbd.
(cherry picked from commit d80fbbea8ec77c0bda0e3fb9eaed2f170784ea7d)
source3/smbd/blocking.c