15ec7d3d3f4b16010363c7cc2886ff0caf32f13b
[oweals/openwrt.git] /
1 From 9a0c16060094eab93f6d928e72f7e8c1cd67a9f8 Mon Sep 17 00:00:00 2001
2 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 Date: Wed, 19 Jun 2019 19:15:29 +0200
4 Subject: Revert "staging: vc04_services: prevent integer overflow in create_pagelist()"
5
6 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7
8 This reverts commit cf07331c8827c9e9e0b4274c9b60204c18592241 which was
9 commit ca641bae6da977d638458e78cd1487b6160a2718 upstream.
10
11 Martin writes:
12         This commit breaks the kernel build because the vchiq_pagelist_info
13         struct is not defined in v4.9.182.
14
15         It was only added in v4.10, in commit
16         4807f2c0e684e907c501cb96049809d7a957dbc2.
17
18 Reported-by: Martin Weinelt <martin@linuxlounge.net>
19 Cc: Dan Carpenter <dan.carpenter@oracle.com>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 ---
22  drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c |    9 ---------
23  1 file changed, 9 deletions(-)
24
25 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
26 +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
27 @@ -381,18 +381,9 @@ create_pagelist(char __user *buf, size_t
28         int run, addridx, actual_pages;
29          unsigned long *need_release;
30  
31 -       if (count >= INT_MAX - PAGE_SIZE)
32 -               return NULL;
33 -
34         offset = (unsigned int)buf & (PAGE_SIZE - 1);
35         num_pages = (count + offset + PAGE_SIZE - 1) / PAGE_SIZE;
36  
37 -       if (num_pages > (SIZE_MAX - sizeof(PAGELIST_T) -
38 -                        sizeof(struct vchiq_pagelist_info)) /
39 -                       (sizeof(u32) + sizeof(pages[0]) +
40 -                        sizeof(struct scatterlist)))
41 -               return NULL;
42 -
43         *ppagelist = NULL;
44  
45         /* Allocate enough storage to hold the page pointers and the page