lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 4 Jul 2018 14:25:36 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Tarick Bedeir <tarick@...gle.com>
Cc:     Yishai Hadas <yishaih@...lanox.com>, dledford@...hat.com,
        jgg@...pe.ca, Eric Dumazet <edumazet@...gle.com>,
        linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] IB/mlx4: Test port number before querying type.

On Tue, Jul 03, 2018 at 07:44:25AM -0700, Tarick Bedeir wrote:
> On Mon, Jul 2, 2018 at 11:21 PM Leon Romanovsky <leon@...nel.org> wrote:
> >
> > On Mon, Jul 02, 2018 at 02:02:34PM -0700, Tarick Bedeir wrote:
> > > rdma_ah_find_type() can reach into ib_device->port_immutable with a
> > > potentially out-of-bounds port number, so check that the port number is
> > > valid first.
> > >
> > > Fixes: 44c58487d51a ("IB/core: Define 'ib' and 'roce' rdma_ah_attr types")
> > > Signed-off-by: Tarick Bedeir <tarick@...gle.com>
> > > ---
> > >  drivers/infiniband/hw/mlx4/qp.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
> > > index f045491f2c14..4f1dabecf9a5 100644
> > > --- a/drivers/infiniband/hw/mlx4/qp.c
> > > +++ b/drivers/infiniband/hw/mlx4/qp.c
> > > @@ -4034,9 +4034,9 @@ static void to_rdma_ah_attr(struct mlx4_ib_dev *ibdev,
> > >       u8 port_num = path->sched_queue & 0x40 ? 2 : 1;
> > >
> > >       memset(ah_attr, 0, sizeof(*ah_attr));
> > > -     ah_attr->type = rdma_ah_find_type(&ibdev->ib_dev, port_num);
> > >       if (port_num == 0 || port_num > dev->caps.num_ports)
> >
> > Did you get any warning from any checker about out-of-bounds access?
>
> Indeed, I observed a KASAN warning for an out-of-bounds read in
> to_rdma_ah_attr().
>
> > According to the line above, port_num can be 2 or 1 which are valid ports for mlx4
> > and the check above doesn't do much.
>
> There are mlx4 devices with only one port.

Thanks, I never saw such device, but found one on ebay :).

Reviewed-by: Leon Romanovsky <leonro@...lanox.com>

Download attachment "signature.asc" of type "application/pgp-signature" (802 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ