The patch titled Subject: kernel/relay.c: limit kmalloc size to KMALLOC_MAX_SIZE has been added to the -mm tree. Its filename is kernel-relay-limit-kmalloc-size-to-kmalloc_max_size.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kernel-relay-limit-kmalloc-size-to-kmalloc_max_size.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kernel-relay-limit-kmalloc-size-to-kmalloc_max_size.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: David Rientjes <rientjes@xxxxxxxxxx> Subject: kernel/relay.c: limit kmalloc size to KMALLOC_MAX_SIZE chan->n_subbufs is set by the user and relay_create_buf() does a kmalloc() of chan->n_subbufs * sizeof(size_t *). kmalloc_slab() will generate a warning when this fails if chan->subbufs * sizeof(size_t *) > KMALLOC_MAX_SIZE. Limit chan->n_subbufs to the maximum allowed kmalloc() size. Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1802061216100.122576@xxxxxxxxxxxxxxxxxxxxxxxxx Fixes: f6302f1bcd75 ("relay: prevent integer overflow in relay_open()") Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Cc: Dave Jiang <dave.jiang@xxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/relay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN kernel/relay.c~kernel-relay-limit-kmalloc-size-to-kmalloc_max_size kernel/relay.c --- a/kernel/relay.c~kernel-relay-limit-kmalloc-size-to-kmalloc_max_size +++ a/kernel/relay.c @@ -163,7 +163,7 @@ static struct rchan_buf *relay_create_bu { struct rchan_buf *buf; - if (chan->n_subbufs > UINT_MAX / sizeof(size_t *)) + if (chan->n_subbufs > KMALLOC_MAX_SIZE / sizeof(size_t *)) return NULL; buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL); _ Patches currently in -mm which might be from rientjes@xxxxxxxxxx are kernel-relay-limit-kmalloc-size-to-kmalloc_max_size.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html