mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
watch_queue: Fix the alloc bitmap size to reflect notes allocated
commit3b4c037192upstream. Currently, watch_queue_set_size() sets the number of notes available in wqueue->nr_notes according to the number of notes allocated, but sets the size of the bitmap to the unrounded number of notes originally asked for. Fix this by setting the bitmap size to the number of notes we're actually going to make available (ie. the number allocated). Fixes:c73be61ced("pipe: Add general notification queue support") Reported-by: Jann Horn <jannh@google.com> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e2b52ca498
commit
880acbb718
@@ -244,6 +244,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes)
|
|||||||
goto error;
|
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, roundup_pow_of_two(nr_notes));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@@ -269,7 +270,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes)
|
|||||||
wqueue->notes = pages;
|
wqueue->notes = pages;
|
||||||
wqueue->notes_bitmap = bitmap;
|
wqueue->notes_bitmap = bitmap;
|
||||||
wqueue->nr_pages = nr_pages;
|
wqueue->nr_pages = nr_pages;
|
||||||
wqueue->nr_notes = nr_pages * WATCH_QUEUE_NOTES_PER_PAGE;
|
wqueue->nr_notes = nr_notes;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error_p:
|
error_p:
|
||||||
|
|||||||
Reference in New Issue
Block a user