It seems that watch_queue_set_size() calls pipe_resize_ring() with the number of notifications in play, not the number of pages required to hold those notifications, as pipe_resize_ring() expects. Change from nr_notes to nr_pages to fix this. Fixes: c73be61cede58 ("pipe: Add general notification queue support") Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> --- diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c index 5267adeaa403..10b4d311e930 100644 --- a/kernel/watch_queue.c +++ b/kernel/watch_queue.c @@ -254,6 +254,8 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes) nr_pages = (nr_notes + WATCH_QUEUE_NOTES_PER_PAGE - 1); nr_pages /= WATCH_QUEUE_NOTES_PER_PAGE; + /* Round nr_notes up to fill the pages */ + nr_notes = nr_pages * WATCH_QUEUE_NOTES_PER_PAGE; user_bufs = account_pipe_buffers(pipe->user, pipe->nr_accounted, nr_pages); if (nr_pages > pipe->max_usage && @@ -264,8 +266,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes) goto error; } - nr_notes = nr_pages * WATCH_QUEUE_NOTES_PER_PAGE; - ret = pipe_resize_ring(pipe, roundup_pow_of_two(nr_notes)); + ret = pipe_resize_ring(pipe, nr_pages); if (ret < 0) goto error;