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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BY5PR11MB3863D5353446248321EE84E9C3A90@BY5PR11MB3863.namprd11.prod.outlook.com>
Date:   Wed, 13 Jan 2021 01:19:08 +0000
From:   "Karan Tilak Kumar (kartilak)" <kartilak@...co.com>
To:     Dinghao Liu <dinghao.liu@....edu.cn>, "kjlu@....edu" <kjlu@....edu>
CC:     "Satish Kharat (satishkh)" <satishkh@...co.com>,
        "Sesidhar Baddela (sebaddel)" <sebaddel@...co.com>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] scsi: fnic: Fix memleak in vnic_dev_init_devcmd2

Acked-by: Karan Tilak Kumar <kartilak@...co.com>

Regards,
Karan

-----Original Message-----
From: Dinghao Liu <dinghao.liu@....edu.cn> 
Sent: Friday, December 25, 2020 12:35 AM
To: dinghao.liu@....edu.cn; kjlu@....edu
Cc: Satish Kharat (satishkh) <satishkh@...co.com>; Sesidhar Baddela (sebaddel) <sebaddel@...co.com>; Karan Tilak Kumar (kartilak) <kartilak@...co.com>; James E.J. Bottomley <jejb@...ux.ibm.com>; Martin K. Petersen <martin.petersen@...cle.com>; linux-scsi@...r.kernel.org; linux-kernel@...r.kernel.org
Subject: [PATCH] scsi: fnic: Fix memleak in vnic_dev_init_devcmd2

When ioread32() returns 0xFFFFFFFF, we should execute cleanup functions like other error handling paths before returning.

Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
---
 drivers/scsi/fnic/vnic_dev.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/fnic/vnic_dev.c b/drivers/scsi/fnic/vnic_dev.c index a2beee6e09f0..5988c300cc82 100644
--- a/drivers/scsi/fnic/vnic_dev.c
+++ b/drivers/scsi/fnic/vnic_dev.c
@@ -444,7 +444,8 @@ static int vnic_dev_init_devcmd2(struct vnic_dev *vdev)
 	fetch_index = ioread32(&vdev->devcmd2->wq.ctrl->fetch_index);
 	if (fetch_index == 0xFFFFFFFF) { /* check for hardware gone  */
 		pr_err("error in devcmd2 init");
-		return -ENODEV;
+		err = -ENODEV;
+		goto err_free_wq;
 	}
 
 	/*
@@ -460,7 +461,7 @@ static int vnic_dev_init_devcmd2(struct vnic_dev *vdev)
 	err = vnic_dev_alloc_desc_ring(vdev, &vdev->devcmd2->results_ring,
 			DEVCMD2_RING_SIZE, DEVCMD2_DESC_SIZE);
 	if (err)
-		goto err_free_wq;
+		goto err_disable_wq;
 
 	vdev->devcmd2->result =
 		(struct devcmd2_result *) vdev->devcmd2->results_ring.descs;
@@ -481,8 +482,9 @@ static int vnic_dev_init_devcmd2(struct vnic_dev *vdev)
 
 err_free_desc_ring:
 	vnic_dev_free_desc_ring(vdev, &vdev->devcmd2->results_ring);
-err_free_wq:
+err_disable_wq:
 	vnic_wq_disable(&vdev->devcmd2->wq);
+err_free_wq:
 	vnic_wq_free(&vdev->devcmd2->wq);
 err_free_devcmd2:
 	kfree(vdev->devcmd2);
--
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ