Re: [PATCH for-rc or next 3/3] IB/qib: Call kobject_put() when kobject_init_and_add() fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/19/2020 8:00 PM, Jason Gunthorpe wrote:
On Mon, May 11, 2020 at 11:13:28PM -0400, Dennis Dalessandro wrote:
From: Kaike Wan <kaike.wan@xxxxxxxxx>

When kobject_init_and_add() returns an error in the function
qib_create_port_files(), the function kobject_put() is not called for
the corresponding kobject, which potentially leads to memory leak.

This patch fixes the issue by calling kobject_put() even if
kobject_init_and_add() fails. In addition, the ppd->diagc_kobj is
released along with other kobjects when the sysfs is unregistered.

Fixes: f931551bafe1 ("IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters")
Cc: <stable@xxxxxxxxxxxxxxx>
Suggested-by: Lin Yi <teroincn@xxxxxxxxx>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@xxxxxxxxx>
Signed-off-by: Kaike Wan <kaike.wan@xxxxxxxxx>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@xxxxxxxxx>
Reviewed-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
---
  drivers/infiniband/hw/qib/qib_sysfs.c |    9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)

Applied to for-rc

Are you respinning the other two patches?

Yes, Kaike is working on getting updates to those two out.

-Denny




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux