Messages in this thread Patch in this message | | | From | David Howells <> | Subject | Re: [syzbot] KASAN: null-ptr-deref Read in __free_pages | Date | Mon, 21 Mar 2022 09:37:57 +0000 |
| |
Fabio M. De Francesco <fmdefrancesco@gmail.com> wrote:
> I cannot have any objection, it's up to you to decide :)
Of course you can object. That's kind of the point of a review;-)
How about the attached instead, then?
David --- --- a/kernel/watch_queue.c +++ b/kernel/watch_queue.c @@ -271,9 +271,8 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes) return 0; error_p: - for (i = 0; i < nr_pages; i++) - if (pages[i]) - __free_page(pages[i]); + while (--i >= 0) + __free_page(pages[i]); kfree(pages); error: (void) account_pipe_buffers(pipe->user, nr_pages, pipe->nr_accounted);
| |