[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230919073715.GC4494@unreal>
Date: Tue, 19 Sep 2023 10:37:15 +0300
From: Leon Romanovsky <leon@...nel.org>
To: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: Jason Gunthorpe <jgg@...pe.ca>, Parav Pandit <parav@...lanox.com>,
Jack Morgenstein <jackm@...lanox.com>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v3][next] RDMA/core: Use size_{add,sub,mul}() in calls to
struct_size()
On Sun, Sep 17, 2023 at 03:21:36PM -0600, Gustavo A. R. Silva wrote:
> If, for any reason, the open-coded arithmetic causes a wraparound,
The thing is that it doesn't.
> the protection that `struct_size()` provides against potential integer
> overflows is defeated. Fix this by hardening calls to `struct_size()`
> with `size_add()`, `size_sub()` and `size_mul()`.
>
> Fixes: 467f432a521a ("RDMA/core: Split port and device counter sysfs attributes")
> Fixes: a4676388e2e2 ("RDMA/core: Simplify how the gid_attrs sysfs is created")
> Fixes: e9dd5daf884c ("IB/umad: Refactor code to use cdev_device_add()")
> Fixes: 324e227ea7c9 ("RDMA/device: Add ib_device_get_by_netdev()")
> Fixes: 5aad26a7eac5 ("IB/core: Use struct_size() in kzalloc()")
> Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>
> ---
> Changes in v3:
> - Include changes to other files in drivers/infiniband/core/
> - Update changelog text with a more descriptive argument for the
> changes.
> - Add more `Fixes:` tags.
I don't think that any of these Fixes are necessary, as nothing wrong
in the code you changed.
Thanks
Powered by blists - more mailing lists