[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190729052043.GJ4674@mtr-leonro.mtl.com>
Date: Mon, 29 Jul 2019 08:20:43 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Jia-Ju Bai <baijiaju1990@...il.com>
Cc: dledford@...hat.com, jgg@...pe.ca, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [BUG] infiniband: mlx5: a possible null-pointer dereference in
set_roce_addr()
On Mon, Jul 29, 2019 at 10:16:30AM +0800, Jia-Ju Bai wrote:
> In set_roce_addr(), there is an if statement on line 589 to check whether
> gid is NULL:
> if (gid)
>
> When gid is NULL, it is used on line 613:
> return mlx5_core_roce_gid_set(..., gid->raw, ...);
>
> Thus, a possible null-pointer dereference may occur.
>
> This bug is found by a static analysis tool STCheck written by us.
>
> I do not know how to correctly fix this bug, so I only report it.
You should fix the tool, gid and gid->raw are the same pointers in C.
In this case, "mlx5_core_roce_gid_set(..., gid->raw, ...);" will be
equal to "mlx5_core_roce_gid_set(..., NULL, ...);" and
mlx5_core_roce_gid_set() is designed to handle this case.
Thanks
>
>
> Best wishes,
> Jia-Ju Bai
Powered by blists - more mailing lists