]> git.baikalelectronics.ru Git - kernel.git/commit
autofs4: catatonic_mode vs. notify_daemon race
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 11 Jan 2012 03:24:48 +0000 (22:24 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 11 Jan 2012 05:19:58 +0000 (00:19 -0500)
commit17b4cc3d1d4bbf89f199219740ec6a8bbdb6916b
tree27a8565988791e2971d631e19c7a9a0057386668
parentbecdbe47915719695ee73eb0aa52ce0cebb2184a
autofs4: catatonic_mode vs. notify_daemon race

we need to hold ->wq_mutex while we are forming the packet to send,
lest we have autofs4_catatonic_mode() setting wq->name.name to NULL
just as autofs4_notify_daemon() decides to memcpy() from it...

We do have check for catatonic mode immediately after that (under
->wq_mutex, as it ought to be) and packet won't be actually sent,
but it'll be too late for us if we oops on that memcpy() from NULL...

Fix is obvious - just extend the area covered by ->wq_mutex over
that switch and check whether it's catatonic *before* doing anything
else.

Acked-by: Ian Kent <raven@themaw.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/autofs4/waitq.c