]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
IB/hfi1: Fix for potential refcount leak in hfi1_open_file()
authorAlex Estrin <alex.estrin@intel.com>
Thu, 1 Feb 2018 18:43:58 +0000 (10:43 -0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 6 Jun 2018 17:44:25 +0000 (13:44 -0400)
commite4806942336c73293787cec749a361300940d0b2
tree4bf137ffcc6811f863459b1f3601147be3cdd4b2
parentbf0875bbb2ea3d9e68a8fa91e8add4c648784376
IB/hfi1: Fix for potential refcount leak in hfi1_open_file()

BugLink: http://bugs.launchpad.net/bugs/1774063
[ Upstream commit 2b1e7fe16124e86ee9242aeeee859c79a843e3a2 ]

The dd refcount is speculatively incremented prior to allocating
the fd memory with kzalloc(). If that kzalloc() failed the dd
refcount leaks.
Increment refcount on kzalloc success.

Fixes: e11ffbd57520 ("IB/hfi1: Do not free hfi1 cdev parent structure early")
Reviewed-by: Michael J Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Alex Estrin <alex.estrin@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/infiniband/hw/hfi1/file_ops.c