]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
fix up 4.9 commit
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 13:56:40 +0000 (15:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 13:56:40 +0000 (15:56 +0200)
queue-4.9/seq_file-disallow-extremely-large-seq-buffer-allocations.patch

index ef8b53893311776db19e3b0d7765a4743b62cc6d..70a8202aaf70218df21b3dad8af0771c2587cfa2 100644 (file)
@@ -18,23 +18,18 @@ Cc: stable@kernel.org
 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 ---
- fs/seq_file.c | 3 +++
+ fs/seq_file.c |    3 +++
  1 file changed, 3 insertions(+)
 
-diff --git a/fs/seq_file.c b/fs/seq_file.c
-index b117b212ef28..4a2cda04d3e2 100644
 --- a/fs/seq_file.c
 +++ b/fs/seq_file.c
-@@ -32,6 +32,9 @@ static void seq_set_overflow(struct seq_file *m)
+@@ -28,6 +28,9 @@ static void *seq_buf_alloc(unsigned long
+       void *buf;
+       gfp_t gfp = GFP_KERNEL;
  
- static void *seq_buf_alloc(unsigned long size)
- {
 +      if (unlikely(size > MAX_RW_COUNT))
 +              return NULL;
 +
-       return kvmalloc(size, GFP_KERNEL_ACCOUNT);
- }
--- 
-2.32.0
-
+       /*
+        * For high order allocations, use __GFP_NORETRY to avoid oom-killing -
+        * it's better to fall back to vmalloc() than to kill things.  For small