forked fromtorvalds/linux
- Notifications
You must be signed in to change notification settings - Fork0
Commit8a018eb
Qian Cai
Al Viro
pipe: Fix memory leaks in create_pipe_files()
Calling pipe2() with O_NOTIFICATION_PIPE could results in memoryleaks unless watch_queue_init() is successful. In case of watch_queue_init() failure in pipe2() we are leftwith inode and pipe_inode_info instances that need to be freed. Thatfailure exit has been introduced in commitc73be61 ("pipe: Addgeneral notification queue support") and its handling should've beenidentical to nearby treatment of alloc_file_pseudo() failures - itis dealing with the same situation. As it is, the mainline kernelleaks in that case. Another problem is that CONFIG_WATCH_QUEUE and !CONFIG_WATCH_QUEUEcases are treated differently (and the former leaks just pipe_inode_info,the latter - both pipe_inode_info and inode). Fixed by providing a dummy wacth_queue_init() in !CONFIG_WATCH_QUEUEcase and by having failures of wacth_queue_init() handled the same waywe handle alloc_file_pseudo() ones.Fixes:c73be61 ("pipe: Add general notification queue support")Signed-off-by: Qian Cai <cai@redhat.com>Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>1 parent933a375 commit8a018eb
2 files changed
+11
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
913 | 913 | | |
914 | 914 | | |
915 | 915 | | |
| 916 | + | |
916 | 917 | | |
917 | 918 | | |
918 | 919 | | |
919 | 920 | | |
920 | 921 | | |
921 | | - | |
922 | | - | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
923 | 925 | | |
924 | | - | |
| 926 | + | |
925 | 927 | | |
926 | | - | |
927 | | - | |
928 | | - | |
929 | 928 | | |
930 | 929 | | |
931 | 930 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
125 | 131 | | |
126 | 132 | | |
127 | 133 | | |
0 commit comments
Comments
(0)