lkml.org 
[lkml]   [2022]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] watch_queue: free the notes array
Date
__put_watch_queue() frees the individual notifications but doesn't free
the notes array itself causing a memory leak.

Reported by syzbot at:
https://syzkaller.appspot.com/bug?extid=25ea042ae28f3888727a

Fix by adding a kfree().

Fixes: c73be61cede5 ("pipe: Add general notification queue support")
Reported-by: syzbot+25ea042ae28f3888727a@syzkaller.appspotmail.com
Tested-by: syzbot+25ea042ae28f3888727a@syzkaller.appspotmail.com
Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
---
kernel/watch_queue.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
index 3990e4df3d7b..230038d4f908 100644
--- a/kernel/watch_queue.c
+++ b/kernel/watch_queue.c
@@ -370,6 +370,7 @@ static void __put_watch_queue(struct kref *kref)

for (i = 0; i < wqueue->nr_pages; i++)
__free_page(wqueue->notes[i]);
+ kfree(wqueue->notes);
bitmap_free(wqueue->notes_bitmap);

wfilter = rcu_access_pointer(wqueue->filter);
--
2.35.1
\
 
 \ /
  Last update: 2022-03-27 17:50    [W:0.073 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site