Skip to content
Commit b87a1229 authored by Lukas Schauer's avatar Lukas Schauer Committed by Greg Kroah-Hartman
Browse files

pipe: wakeup wr_wait after setting max_usage

[ Upstream commit e95aada4 ]

Commit c73be61c ("pipe: Add general notification queue support") a
regression was introduced that would lock up resized pipes under certain
conditions. See the reproducer in [1].

The commit resizing the pipe ring size was moved to a different
function, doing that moved the wakeup for pipe->wr_wait before actually
raising pipe->max_usage. If a pipe was full before the resize occured it
would result in the wakeup never actually triggering pipe_write.

Set @max_usage and @nr_accounted before waking writers if this isn't a
watch queue.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=212295 [1]
Link: https://lore.kernel.org/r/20231201-orchideen-modewelt-e009de4562c6@brauner
Fixes: c73be61c

 ("pipe: Add general notification queue support")
Reviewed-by: default avatarDavid Howells <dhowells@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarLukas Schauer <lukas@schauer.dev>
[Christian Brauner <brauner@kernel.org>: rewrite to account for watch queues]
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6f5c4aad
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment