Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1206205

Re: [PATCH v2] serial: max310x: Fix out of bounds access

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] serial: max310x: Fix out of bounds access
Date 2015-08-12 17:20 +0200
Message-ID <pWFYS-8aR-9@gated-at.bofh.it> (permalink)
References <pWyE1-5X6-7@gated-at.bofh.it> <pWBBU-1Ls-45@gated-at.bofh.it> <pWBBU-1Ls-43@gated-at.bofh.it> <pWCRk-3tG-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Aug 12, 2015 at 07:50:25PM +0800, Kang Yin Su wrote:
> On 12 August 2015 at 17:46, Alexander Shiyan <shc_work@mail.ru> wrote:
> >> Среда, 12 августа 2015, 15:36 +08:00 от cantona <cantona@cantona.net>:
> >>
> >>
> >> added Alexander Shiyan < shc_work@mail.ru >.
> >>
> >> On 12 August 2015 at 15:22, Su Kang Yin  < cantona@cantona.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@cantona.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".

Yes, that is a very common pattern we use in the kernel.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2] serial: max310x: Fix out of bounds access Su Kang Yin <cantona@cantona.net> - 2015-08-12 09:30 +0200
  Re: [PATCH v2] serial: max310x: Fix out of bounds access Alexander Shiyan <shc_work@mail.ru> - 2015-08-12 12:40 +0200
    Re: [PATCH v2] serial: max310x: Fix out of bounds access Kang Yin Su <cantona@cantona.net> - 2015-08-12 14:00 +0200
      Re: [PATCH v2] serial: max310x: Fix out of bounds access Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-08-12 17:20 +0200

csiph-web