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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220708025058.5120-1-liubo03@inspur.com>
Date:   Thu, 7 Jul 2022 22:50:58 -0400
From:   Bo Liu <liubo03@...pur.com>
To:     <hare@...e.de>, <jejb@...ux.ibm.com>, <martin.petersen@...cle.com>
CC:     <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Bo Liu <liubo03@...pur.com>
Subject: [PATCH] scsi: fcoe: Check dev_set_name() return value

It's possible that dev_set_name() returns -ENOMEM, catch and handle this.

Signed-off-by: Bo Liu <liubo03@...pur.com>
---
 drivers/scsi/fcoe/fcoe_sysfs.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index af658aa38fed..4da331cfc108 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -828,7 +828,10 @@ struct fcoe_ctlr_device *fcoe_ctlr_device_add(struct device *parent,
 	if (!ctlr->devloss_work_q)
 		goto out_del_q;
 
-	dev_set_name(&ctlr->dev, "ctlr_%d", ctlr->id);
+	error = dev_set_name(&ctlr->dev, "ctlr_%d", ctlr->id);
+	if (error)
+		goto out_del_q2;
+
 	error = device_register(&ctlr->dev);
 	if (error)
 		goto out_del_q2;
@@ -1024,7 +1027,9 @@ struct fcoe_fcf_device *fcoe_fcf_device_add(struct fcoe_ctlr_device *ctlr,
 
 	fcf->dev_loss_tmo = ctlr->fcf_dev_loss_tmo;
 
-	dev_set_name(&fcf->dev, "fcf_%d", fcf->id);
+	error = dev_set_name(&fcf->dev, "fcf_%d", fcf->id);
+	if (error)
+		goto out_del;
 
 	fcf->fabric_name = new_fcf->fabric_name;
 	fcf->switch_name = new_fcf->switch_name;
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ