RE: [PATCH] mm: Add conditions to avoid out-of-bounds

2018-06-04 Thread Nixiaoming
...@embeddedor.com; ktk...@virtuozzo.com; stumm...@codeaurora.org; linux-kernel@vger.kernel.org; linux...@kvack.org Subject: Re: [PATCH] mm: Add conditions to avoid out-of-bounds On Mon 04-06-18 18:37:35, nixiaoming wrote: > In the function memcg_init_list_lru > if call goto fail when i == 0, will cau

RE: [PATCH] mm: Add conditions to avoid out-of-bounds

2018-06-04 Thread Nixiaoming
...@embeddedor.com; ktk...@virtuozzo.com; stumm...@codeaurora.org; linux-kernel@vger.kernel.org; linux...@kvack.org Subject: Re: [PATCH] mm: Add conditions to avoid out-of-bounds On Mon 04-06-18 18:37:35, nixiaoming wrote: > In the function memcg_init_list_lru > if call goto fail when i == 0, will cau

Re: [PATCH] mm: Add conditions to avoid out-of-bounds

2018-06-04 Thread Michal Hocko
On Mon 04-06-18 18:37:35, nixiaoming wrote: > In the function memcg_init_list_lru > if call goto fail when i == 0, will cause out-of-bounds at lru->node[i] How? All I can see is that the fail path does for (i = i - 1; i >= 0; i--) so it will not do anything for i=0. -- Michal Hocko SUSE

Re: [PATCH] mm: Add conditions to avoid out-of-bounds

2018-06-04 Thread Michal Hocko
On Mon 04-06-18 18:37:35, nixiaoming wrote: > In the function memcg_init_list_lru > if call goto fail when i == 0, will cause out-of-bounds at lru->node[i] How? All I can see is that the fail path does for (i = i - 1; i >= 0; i--) so it will not do anything for i=0. -- Michal Hocko SUSE

[PATCH] mm: Add conditions to avoid out-of-bounds

2018-06-04 Thread nixiaoming
In the function memcg_init_list_lru if call goto fail when i == 0, will cause out-of-bounds at lru->node[i] The same out-of-bounds access scenario exists in the functions memcg_update_list_lru and __memcg_init_list_lru_node Signed-off-by: nixiaoming --- mm/list_lru.c | 7 +++ 1 file

[PATCH] mm: Add conditions to avoid out-of-bounds

2018-06-04 Thread nixiaoming
In the function memcg_init_list_lru if call goto fail when i == 0, will cause out-of-bounds at lru->node[i] The same out-of-bounds access scenario exists in the functions memcg_update_list_lru and __memcg_init_list_lru_node Signed-off-by: nixiaoming --- mm/list_lru.c | 7 +++ 1 file