s3: Fix a crash in reply_lockingX_error
commitd80fbbea8ec77c0bda0e3fb9eaed2f170784ea7d
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:26:11 +0000 (13 07:26 +0200)
tree60247c291fab9a54625097f60127f00849d5288d
parent3ce8703a0a8566be36ccbab4271d4f953d2763de
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.
source3/smbd/blocking.c