linux/fs/lockd
David Jeffery 1c327d962f lockd: protect nlm_blocked access in nlmsvc_retry_blocked
In nlmsvc_retry_blocked, the check that the list is non-empty and acquiring
the pointer of the first entry is unprotected by any lock.  This allows a rare
race condition when there is only one entry on the list.  A function such as
nlmsvc_grant_callback() can be called, which will temporarily remove the entry
from the list.  Between the list_empty() and list_entry(),the list may become
empty, causing an invalid pointer to be used as an nlm_block, leading to a
possible crash.

This patch adds the nlm_block_lock around these calls to prevent concurrent
use of the nlm_blocked list.

This was a regression introduced by
f904be9cc7  "lockd: Mostly remove BKL from
the server".

Cc: Bryan Schumaker <bjschuma@netapp.com>
Cc: stable@vger.kernel.org
Signed-off-by: David Jeffery <djeffery@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
2013-07-11 17:24:07 -04:00
..
clnt4xdr.c lockd: Remove unnecessary BUG_ON()s in the xdr client code 2012-11-04 14:43:39 -05:00
clntlock.c LOCKD: Ensure that nlmclnt_block resets block->b_status after a server reboot 2013-04-21 18:08:42 -04:00
clntproc.c LOCKD: Ensure that nlmclnt_block resets block->b_status after a server reboot 2013-04-21 18:08:42 -04:00
clntxdr.c lockd: Remove unnecessary BUG_ON()s in the xdr client code 2012-11-04 14:43:39 -05:00
grace.c LockD: pass actual network namespace to grace period management functions 2012-07-27 16:49:22 -04:00
host.c Merge branch 'for-3.9' of git://linux-nfs.org/~bfields/linux 2013-02-28 18:02:55 -08:00
Makefile lockd: Introduce new-style XDR functions for NLMv4 2010-12-16 12:37:23 -05:00
mon.c sunrpc: move address copy/cmp/convert routines and prototypes from clnt.h to addr.h 2013-02-05 09:41:14 -05:00
netns.h lockd: per-net NSM client creation and destruction helpers introduced 2012-10-01 15:27:34 -07:00
svc4proc.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2012-08-01 10:26:23 -07:00
svc.c Merge branch 'for-3.7' of git://linux-nfs.org/~bfields/linux 2012-10-13 10:53:54 +09:00
svclock.c lockd: protect nlm_blocked access in nlmsvc_retry_blocked 2013-07-11 17:24:07 -04:00
svcproc.c NLM: nlm_lookup_file() may return NLMv4-specific error codes 2012-10-17 10:14:14 -04:00
svcshare.c lockd: fix sparse warning in svcshare.c 2008-04-23 16:13:39 -04:00
svcsubs.c Merge branch 'for-3.9' of git://linux-nfs.org/~bfields/linux 2013-02-28 18:02:55 -08:00
xdr4.c lockd: Introduce new-style XDR functions for NLMv4 2010-12-16 12:37:23 -05:00
xdr.c lockd: Move nlmdbg_cookie2a() to svclock.c 2010-12-16 12:37:24 -05:00