s3: Fix a crash in reply_lockingX_error
commiteae2e4df0027cb6d58bc6476f5332dfe084a47c9
authorVolker Lendecke <vl@samba.org>
Tue, 7 Aug 2012 23:49:52 +0000 (7 16:49 -0700)
committerKarolin Seeger <kseeger@samba.org>
Thu, 13 Sep 2012 09:19:44 +0000 (13 11:19 +0200)
treee4bb5fb4e6a2748a3528f10b3a75e1b6ea127a92
parent285a715761fa760d42d2c5b83805e6685f1af2d1
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