Oleksandr Natalenko 31b5991a9a scsi: qedf: Do not touch __user pointer in qedf_dbg_debug_cmd_read() directly
The qedf_dbg_debug_cmd_read() function invokes sprintf() directly on a
__user pointer, which may crash the kernel.

Avoid doing that by using a small on-stack buffer for scnprintf() and then
calling simple_read_from_buffer() which does a proper copy_to_user() call.

Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Link: https://lore.kernel.org/lkml/20230724120241.40495-1-oleksandr@redhat.com/
Link: https://lore.kernel.org/linux-scsi/20230726101236.11922-1-skashyap@marvell.com/
Cc: Saurav Kashyap <skashyap@marvell.com>
Cc: Rob Evers <revers@redhat.com>
Cc: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Jozef Bacik <jobacik@redhat.com>
Cc: Laurence Oberman <loberman@redhat.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: GR-QLogic-Storage-Upstream@marvell.com
Cc: linux-scsi@vger.kernel.org
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Tested-by: Laurence Oberman <loberman@redhat.com>
Acked-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Oleksandr Natalenko <oleksandr@redhat.com>
Link: https://lore.kernel.org/r/20230731084034.37021-3-oleksandr@redhat.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-07-31 14:42:59 -04:00
..
2023-06-29 11:00:17 -07:00
2023-07-06 22:25:06 -07:00
2023-07-03 12:56:23 -07:00
2023-06-29 11:00:17 -07:00
2023-07-03 12:56:23 -07:00
2023-06-28 16:43:10 -07:00
2023-07-06 09:56:53 -07:00
2023-06-29 08:09:31 -06:00
2023-07-03 15:38:26 -07:00
2023-06-29 16:03:58 -07:00
2023-07-06 09:48:31 -07:00
2023-06-29 11:00:17 -07:00
2023-07-06 22:42:54 -07:00
2023-06-29 11:00:17 -07:00
2023-07-03 12:56:23 -07:00
2023-07-08 12:28:00 -07:00
2023-07-03 12:56:23 -07:00
2023-06-29 15:28:33 -07:00
2023-06-29 20:57:27 -07:00
2023-07-03 11:26:05 -07:00
2023-07-08 12:08:39 -07:00
2023-07-05 10:42:32 -07:00
2023-07-06 10:06:04 -07:00
2023-07-03 10:55:04 -07:00
2023-06-28 14:02:03 -07:00
2023-06-15 13:42:18 +02:00
2023-06-29 14:58:26 -07:00
2023-07-01 08:58:41 -07:00
2023-07-05 21:38:13 -07:00
2023-06-29 15:22:19 -07:00
2023-07-05 12:55:06 -07:00
2023-07-06 19:20:23 -07:00
2023-07-03 17:03:05 -07:00
2023-06-29 15:22:19 -07:00
2023-07-03 10:43:10 -07:00
2023-07-06 19:24:11 -07:00
2023-07-05 10:42:32 -07:00
2023-06-29 15:22:19 -07:00
2023-07-25 21:34:35 -04:00
2023-07-03 15:38:26 -07:00
2023-06-30 15:22:09 -07:00
2023-07-03 15:38:26 -07:00
2023-07-03 11:31:01 -07:00