[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABJLtPG7gfR8VSVfzRgF8XgON7F-mhfMu7C2an0sfQYLBNiLpg@mail.gmail.com>
Date: Wed, 12 Aug 2015 19:50:25 +0800
From: Kang Yin Su <cantona@...tona.net>
To: Alexander Shiyan <shc_work@...l.ru>
Cc: Jiri Slaby <jslaby@...e.com>, linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v2] serial: max310x: Fix out of bounds access
On 12 August 2015 at 17:46, Alexander Shiyan <shc_work@...l.ru> wrote:
>> Среда, 12 августа 2015, 15:36 +08:00 от cantona <cantona@...tona.net>:
>>
>>
>> added Alexander Shiyan < shc_work@...l.ru >.
>>
>> On 12 August 2015 at 15:22, Su Kang Yin < cantona@...tona.net > wrote:
>> >Max310x driver supports up to 4 UART devices but array size of
>> >"struct max310x_one" is set to 1. That leads to out of bounds
>> >access on UART port registration.
>> >
>> >This patch fixed it by increase the array size to 4 which is
>> >maximum supported UART.
>> >
>> >Signed-off-by: Su Kang Yin < cantona@...tona.net >
>> >---
> ...
>
> This seems incorrect. The number of ports is allocated dynamically by:
> ...
> /* Alloc port structure */
> s = devm_kzalloc(dev, sizeof(*s) + sizeof(struct max310x_one) * devtype->nr, GFP_KERNEL);
> ...
>
> Thanks.
>
> ---
>
Oh, my bad. But it looks confusing. So we must ensure "struct
max310x_one p[0]" must the last element of "struct max310x_port".
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists