]> git.ipfire.org Git - thirdparty/grub.git/commit
net/netbuff: Block overly large netbuff allocs
authorDaniel Axtens <dja@axtens.net>
Tue, 8 Mar 2022 12:47:46 +0000 (23:47 +1100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 7 Jun 2022 14:39:33 +0000 (16:39 +0200)
commitf407e34f3871a4c402bbd516e7c28ea193cef1b7
tree16c8498b8a9733089019cc01b65fa3e1935a9d75
parent3e4817538de828319ba6d59ced2fbb9b5ca13287
net/netbuff: Block overly large netbuff allocs

A netbuff shouldn't be too huge. It's bounded by MTU and TCP segment
reassembly. If we are asked to create one that is unreasonably big, refuse.

This is a hardening measure: if we hit this code, there's a bug somewhere
else that we should catch and fix.

This commit:
  - stops the bug propagating any further.
  - provides a spot to instrument in e.g. fuzzing to try to catch these bugs.

I have put instrumentation (e.g. __builtin_trap() to force a crash) here and
have not been able to find any more crashes.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/net/netbuff.c