seq_file: disallow extremely large seq buffer allocations

There is no reasonable need for a buffer larger than this, and it avoids
int overflow pitfalls.

BUG=b/194226724
TEST=presubmit
SOURCE=UPSTREAM(8cae8cd89f05f6de223d63e6d15e31c8ba9cf53b)
RELEASE_NOTE=Fixed CVE-2021-33909

cos-patch: security-high
Fixes: 058504edd026 ("fs/seq_file: fallback to vmalloc allocation")
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Reported-by: Qualys Security Advisory <qsa@qualys.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Change-Id: Ief7d9d22ef5e05a29acc3817d4554556f05ecf8a
Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/19731
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Main-Branch-Verified: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Reviewed-by: Vaibhav Rustagi <vaibhavrustagi@google.com>
1 file changed