Commit a5dbae77 authored by Jinjie Ruan's avatar Jinjie Ruan Committed by sanglipeng
Browse files

scsi: lpfc: Fix the NULL vs IS_ERR() bug for debugfs_create_file()

stable inclusion
from stable-v5.10.197
commit 7635020b9bd4e4de37ec092c8690a534e971ceab
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I96Q8P

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7635020b9bd4e4de37ec092c8690a534e971ceab



--------------------------------

[ Upstream commit 7dcc683d ]

Since debugfs_create_file() returns ERR_PTR and never NULL, use IS_ERR() to
check the return value.

Fixes: 2fcbc569 ("scsi: lpfc: Make debugfs ktime stats generic for NVME and SCSI")
Fixes: 4c47efc1 ("scsi: lpfc: Move SCSI and NVME Stats to hardware queue structures")
Fixes: 6a828b0f ("scsi: lpfc: Support non-uniform allocation of MSIX vectors to hardware queues")
Fixes: 95bfc6d8 ("scsi: lpfc: Make FW logging dynamically configurable")
Fixes: 9f778708 ("scsi: lpfc: Add debugfs support for cm framework buffers")
Fixes: c490850a ("scsi: lpfc: Adapt partitioned XRI lists to efficient sharing")
Signed-off-by: default avatarJinjie Ruan <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/r/20230906030809.2847970-1-ruanjinjie@huawei.com


Reviewed-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 52350a45
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -5909,7 +5909,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
					    phba->hba_debugfs_root,
					    phba,
					    &lpfc_debugfs_op_multixripools);
		if (!phba->debug_multixri_pools) {
		if (IS_ERR(phba->debug_multixri_pools)) {
			lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
					 "0527 Cannot create debugfs multixripools\n");
			goto debug_failed;
@@ -5921,7 +5921,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
			debugfs_create_file(name, 0644,
					    phba->hba_debugfs_root,
					    phba, &lpfc_debugfs_ras_log);
		if (!phba->debug_ras_log) {
		if (IS_ERR(phba->debug_ras_log)) {
			lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
					 "6148 Cannot create debugfs"
					 " ras_log\n");
@@ -5942,7 +5942,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
			debugfs_create_file(name, S_IFREG | 0644,
					    phba->hba_debugfs_root,
					    phba, &lpfc_debugfs_op_lockstat);
		if (!phba->debug_lockstat) {
		if (IS_ERR(phba->debug_lockstat)) {
			lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
					 "4610 Can't create debugfs lockstat\n");
			goto debug_failed;
@@ -6171,7 +6171,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
		debugfs_create_file(name, 0644,
				    vport->vport_debugfs_root,
				    vport, &lpfc_debugfs_op_scsistat);
	if (!vport->debug_scsistat) {
	if (IS_ERR(vport->debug_scsistat)) {
		lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
				 "4611 Cannot create debugfs scsistat\n");
		goto debug_failed;
@@ -6182,7 +6182,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
		debugfs_create_file(name, 0644,
				    vport->vport_debugfs_root,
				    vport, &lpfc_debugfs_op_ioktime);
	if (!vport->debug_ioktime) {
	if (IS_ERR(vport->debug_ioktime)) {
		lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
				 "0815 Cannot create debugfs ioktime\n");
		goto debug_failed;