
Manish RangankarandGreg Kroah-Hartman
fa85b016a5
scsi: qedi: Fix crash while reading debugfs attribute
[ Upstream commit 28027ec8e3 ]
The qedi_dbg_do_not_recover_cmd_read() function invokes sprintf() directly
on a __user pointer, which results into the crash.
To fix this issue, use a small local stack buffer for sprintf() and then
call simple_read_from_buffer(), which in turns make the copy_to_user()
call.
BUG: unable to handle page fault for address: 00007f4801111000
PGD 8000000864df6067 P4D 8000000864df6067 PUD 864df7067 PMD 846028067 PTE 0
Oops: 0002 [#1] PREEMPT SMP PTI
Hardware name: HPE ProLiant DL380 Gen10/ProLiant DL380 Gen10, BIOS U30 06/15/2023
RIP: 0010:memcpy_orig+0xcd/0x130
RSP: 0018:ffffb7a18c3ffc40 EFLAGS: 00010202
RAX: 00007f4801111000 RBX: 00007f4801111000 RCX: 000000000000000f
RDX: 000000000000000f RSI: ffffffffc0bfd7a0 RDI: 00007f4801111000
RBP: ffffffffc0bfd7a0 R08: 725f746f6e5f6f64 R09: 3d7265766f636572
R10: ffffb7a18c3ffd08 R11: 0000000000000000 R12: 00007f4881110fff
R13: 000000007fffffff R14: ffffb7a18c3ffca0 R15: ffffffffc0bfd7af
FS: 00007f480118a740(0000) GS:ffff98e38af00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f4801111000 CR3: 0000000864b8e001 CR4: 00000000007706e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
<TASK>
? __die_body+0x1a/0x60
? page_fault_oops+0x183/0x510
? exc_page_fault+0x69/0x150
? asm_exc_page_fault+0x22/0x30
? memcpy_orig+0xcd/0x130
vsnprintf+0x102/0x4c0
sprintf+0x51/0x80
qedi_dbg_do_not_recover_cmd_read+0x2f/0x50 [qedi 6bcfdeeecdea037da47069eca2ba717c84a77324]
full_proxy_read+0x50/0x80
vfs_read+0xa5/0x2e0
? folio_add_new_anon_rmap+0x44/0xa0
? set_pte_at+0x15/0x30
? do_pte_missing+0x426/0x7f0
ksys_read+0xa5/0xe0
do_syscall_64+0x58/0x80
? __count_memcg_events+0x46/0x90
? count_memcg_event_mm+0x3d/0x60
? handle_mm_fault+0x196/0x2f0
? do_user_addr_fault+0x267/0x890
? exc_page_fault+0x69/0x150
entry_SYSCALL_64_after_hwframe+0x72/0xdc
RIP: 0033:0x7f4800f20b4d
Tested-by: Martin Hoyer <mhoyer@redhat.com>
Reviewed-by: John Meneghini <jmeneghi@redhat.com>
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Link: https://lore.kernel.org/r/20240415072155.30840-1-mrangankar@marvell.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-27 13:49:01 +02:00
..
2024-01-01 12:42:45 +00:00
2023-07-31 11:28:55 -04:00
2023-08-21 17:50:59 -04:00
2024-02-05 20:14:19 +00:00
2023-12-13 18:45:17 +01:00
2024-06-12 11:11:49 +02:00
2024-05-17 12:02:11 +02:00
2023-05-26 13:52:19 -07:00
2024-03-26 18:20:01 -04:00
2023-04-26 16:07:23 -07:00
2023-04-27 11:53:57 -07:00
2023-08-21 17:13:56 -04:00
2023-04-27 16:36:55 -07:00
2024-02-23 09:25:01 +01:00
2024-01-25 15:35:22 -08:00
2024-05-17 12:02:15 +02:00
2023-11-28 17:19:42 +00:00
2024-02-05 20:14:34 +00:00
2024-02-05 20:14:20 +00:00
2024-06-12 11:11:42 +02:00
2024-05-17 12:02:09 +02:00
2023-11-28 17:19:55 +00:00
2024-06-21 14:38:25 +02:00
2024-06-21 14:38:25 +02:00
2023-08-21 17:50:58 -04:00
2023-05-31 19:59:26 -04:00
2023-09-13 20:08:40 -04:00
2024-06-12 11:11:50 +02:00
2024-06-27 13:49:01 +02:00
2024-06-12 11:11:50 +02:00
2023-07-25 21:51:04 -04:00
2024-03-01 13:35:06 +01:00
2023-08-24 22:30:32 -04:00
2023-05-31 18:04:30 -04:00
2023-05-26 13:52:19 -07:00
2023-05-22 17:31:56 -04:00
2023-07-31 14:38:17 -04:00
2023-06-12 08:04:04 -06:00
2023-03-24 19:19:22 -04:00
2023-03-24 19:19:22 -04:00
2023-08-21 16:37:11 -04:00
2024-04-03 15:28:59 +02:00
2024-06-12 11:11:43 +02:00
2023-05-26 13:52:19 -07:00
2023-03-24 19:19:56 -04:00
2023-03-24 19:19:56 -04:00
2023-04-24 23:11:47 -04:00
2023-04-18 23:01:23 -04:00
2023-09-17 17:46:13 +01:00
2023-06-24 15:50:13 -07:00
2024-03-01 13:35:06 +01:00
2023-03-24 19:19:57 -04:00
2023-03-24 19:19:57 -04:00
2023-03-24 20:27:17 -04:00
2023-03-24 19:19:57 -04:00
2023-03-24 19:19:57 -04:00
2023-08-24 22:11:29 -04:00
2024-04-10 16:36:00 +02:00
2024-04-10 16:36:00 +02:00
2023-06-21 21:13:00 -04:00
2023-05-22 15:13:03 -10:00
2023-03-24 19:19:58 -04:00
2023-08-21 17:13:56 -04:00
2023-09-05 05:26:49 -04:00
2023-08-21 16:32:40 -04:00
2023-03-24 19:19:58 -04:00
2023-03-24 19:19:59 -04:00
2023-08-21 16:37:11 -04:00
2023-08-24 21:34:28 -04:00
2023-06-12 08:04:04 -06:00
2023-05-31 11:05:34 -04:00
2023-07-05 21:37:43 -04:00
2023-08-24 22:13:03 -04:00
2024-02-16 19:10:53 +01:00
2023-06-12 08:04:04 -06:00
2024-04-27 17:11:30 +02:00
2024-02-05 20:14:34 +00:00
2023-07-31 15:39:39 -04:00
2024-04-03 15:28:59 +02:00
2023-04-13 11:49:20 -07:00
2023-08-24 22:11:29 -04:00
2023-06-16 12:19:59 -04:00
2023-07-25 21:48:13 -04:00
2024-06-21 14:38:25 +02:00
2023-06-16 12:19:59 -04:00
2024-06-21 14:38:25 +02:00
2023-07-05 21:58:10 -04:00
2024-06-21 14:38:25 +02:00
2023-09-28 21:23:18 +09:00
2023-04-27 11:53:57 -07:00
2024-04-17 11:19:34 +02:00
2023-03-24 19:19:59 -04:00
2023-06-30 11:57:07 -07:00
2023-08-24 22:16:28 -04:00
2023-05-31 11:36:40 -04:00
2024-02-23 09:24:54 +01:00
2023-07-23 15:49:41 -04:00
2023-08-24 22:11:29 -04:00
2023-03-24 19:19:59 -04:00
2023-08-24 22:06:44 -04:00