diff --git a/net/core/skbuff.c b/net/core/skbuff.c index ee0274417948..98efa95ea038 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -591,6 +591,8 @@ static void *kmalloc_reserve(unsigned int *size, gfp_t flags, int node, /* The following cast might truncate high-order bits of obj_size, this * is harmless because kmalloc(obj_size >= 2^32) will fail anyway. */ + if (unlikely(obj_size > KMALLOC_MAX_SIZE)) + return NULL; *size = (unsigned int)obj_size; /*