All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: qla2xxx: fix NULL deref, check user input
@ 2026-05-20 18:03 Alexander A. Klimov
  2026-05-20 18:03 ` [PATCH] smb: smbdirect: divide, not multiply, milliseconds by 1000 Alexander A. Klimov
  2026-05-20 18:03 ` [PATCH] staging: greybus: audio: expect 0 from kstrtoint(), not 1 Alexander A. Klimov
  0 siblings, 2 replies; 11+ messages in thread
From: Alexander A. Klimov @ 2026-05-20 18:03 UTC (permalink / raw)
  To: Nilesh Javali, maintainer:QLOGIC QLA2XXX FC-SCSI DRIVER,
	James E.J. Bottomley, Martin K. Petersen, Quinn Tran,
	Himanshu Madhani, open list:QLOGIC QLA2XXX FC-SCSI DRIVER,
	open list
  Cc: Alexander A. Klimov

qla2x00_dfs_fce_write() did this:

    OUTPUT = kstrtoul(INPUT, BASE, 0);

Whenever INPUT was successfully parsed, kstrtoul() wrote its output
to *(unsigned long*)0. Otherwise, OUTPUT was set to an error value.
I added proper error handling and call kstrtoul() as expected now:

    ERROR = kstrtoul(INPUT, BASE, &OUTPUT);

Fixes: 841df27d619e ("scsi: qla2xxx: Move FCE Trace buffer allocation to user control")
Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
---
 drivers/scsi/qla2xxx/qla_dfs.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index 43970caca7b3..efb0fb198a30 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -510,7 +510,14 @@ qla2x00_dfs_fce_write(struct file *file, const char __user *buffer,
 		return PTR_ERR(buf);
 	}
 
-	enable = kstrtoul(buf, 0, 0);
+	rc = kstrtoul(buf, 0, &enable);
+	if (rc) {
+		ql_dbg(ql_dbg_user, vha, 0xd03d,
+		    "fail to parse user input.");
+		rc = -EINVAL;
+		goto out_free;
+	}
+
 	rc = count;
 
 	mutex_lock(&ha->fce_mutex);
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-05-23  9:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-20 18:03 [PATCH] scsi: qla2xxx: fix NULL deref, check user input Alexander A. Klimov
2026-05-20 18:03 ` [PATCH] smb: smbdirect: divide, not multiply, milliseconds by 1000 Alexander A. Klimov
2026-05-20 19:14   ` Stefan Metzmacher
2026-05-21  5:41   ` Namjae Jeon
2026-05-21  7:46     ` Stefan Metzmacher
2026-05-20 18:03 ` [PATCH] staging: greybus: audio: expect 0 from kstrtoint(), not 1 Alexander A. Klimov
2026-05-21  8:38   ` Greg Kroah-Hartman
2026-05-21 18:42     ` Alexander A. Klimov
2026-05-22  5:07       ` Greg Kroah-Hartman
2026-05-22  5:54         ` Alexander A. Klimov
2026-05-23  9:50         ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.