Manish Rangankar
28027ec8e3
scsi: qedi: Fix crash while reading debugfs attribute
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>
2024-04-24 21:09:08 -04:00
..
2024-03-13 18:34:05 -07:00
2024-03-21 13:21:31 -07:00
2024-03-22 10:41:13 -07:00
2024-03-21 13:21:31 -07:00
2024-04-11 21:37:50 -04:00
2024-03-07 20:36:32 -08:00
2024-03-12 17:37:54 +02:00
2024-03-21 13:34:15 -07:00
2024-03-22 12:46:07 -07:00
2024-03-21 12:44:10 -07:00
2024-03-21 13:21:31 -07:00
2024-03-07 11:53:30 -07:00
2024-03-07 21:52:03 +00:00
2024-03-21 13:21:31 -07:00
2024-03-19 11:57:26 -07:00
2024-03-23 14:42:45 -07:00
2024-03-21 13:21:31 -07:00
2024-03-22 10:41:13 -07:00
2024-03-22 10:41:13 -07:00
2024-03-15 14:46:54 -07:00
2024-03-18 15:11:44 -07:00
2024-03-15 11:58:32 -07:00
2024-03-07 20:37:04 +00:00
2024-03-15 12:25:13 -07:00
2024-03-11 20:38:36 -07:00
2024-03-11 18:14:06 -07:00
2024-04-11 21:37:49 -04:00
2024-03-24 13:54:06 -07:00
2024-03-21 13:21:31 -07:00
2024-03-14 10:22:26 -07:00
2024-03-21 19:04:31 -07:00
2024-03-21 13:21:31 -07:00
2024-03-14 09:56:15 -07:00
2024-03-21 10:01:02 -07:00
2024-03-14 18:03:09 -07:00
2024-03-05 20:01:14 -08:00
2024-03-20 09:45:04 +01:00
2024-03-05 21:25:18 +01:00
2024-03-21 13:21:31 -07:00
2024-03-18 15:34:03 -07:00
2024-03-21 12:44:10 -07:00
2024-03-06 14:03:31 +00:00
2024-03-24 10:45:31 -07:00
2024-03-07 20:32:47 +00:00
2024-03-18 21:09:02 +01:00
2024-03-07 20:26:24 -08:00
2024-03-14 18:03:09 -07:00
2024-03-15 17:53:48 -07:00
2024-03-13 12:23:36 -07:00
2024-03-07 20:38:15 +00:00
2024-03-22 12:34:26 -07:00
2024-03-18 17:30:46 +00:00
2024-03-21 13:21:31 -07:00
2024-03-13 10:59:28 -07:00
2024-04-11 21:37:48 -04:00
2024-03-21 12:44:10 -07:00
2024-03-23 08:43:21 -07:00
2024-03-18 17:30:46 +00:00
2024-03-07 20:32:38 +00:00
2024-03-21 15:09:29 -07:00
2024-03-25 14:24:36 -04:00
2024-03-15 11:58:32 -07:00
2024-03-21 13:23:07 -06:00
2024-03-07 20:21:53 +00:00
2024-03-21 13:34:15 -07:00
2024-03-11 10:39:24 +05:30
2024-03-08 10:00:07 +01:00
2024-03-07 21:50:06 +00:00
2024-03-14 10:58:27 -07:00
2024-03-10 09:07:00 +01:00
2024-03-22 10:41:13 -07:00
2024-03-21 12:35:20 -07:00
2024-03-16 11:24:51 -07:00
2024-03-21 13:21:31 -07:00
2024-03-13 11:33:10 -07:00
2024-03-14 10:19:48 -07:00
2024-03-13 20:45:54 +01:00
2024-03-07 21:51:39 +00:00
2024-03-12 17:44:08 -07:00
2024-03-04 11:45:22 +01:00
2024-03-11 18:14:06 -07:00
2024-03-22 09:52:37 -07:00
2024-03-21 10:37:39 -07:00
2024-03-21 17:16:46 -07:00
2024-04-12 06:32:01 -04:00
2024-03-15 12:47:21 -07:00
2024-04-24 21:09:08 -04:00
2024-03-21 15:18:18 -07:00
2024-03-07 20:21:39 +00:00
2024-03-21 14:50:39 -07:00
2024-03-15 12:22:52 -07:00
2024-03-22 09:57:00 -07:00
2024-04-11 21:37:48 -04:00
2024-03-25 14:03:35 -04:00
2024-03-12 10:35:24 -07:00
2024-03-13 20:35:48 +01:00
2024-03-21 12:35:20 -07:00
2024-03-21 12:44:10 -07:00
2024-04-24 21:01:40 -04:00
2024-03-07 21:52:59 +00:00
2024-04-12 06:32:01 -04:00
2024-03-19 02:45:51 -04:00
2024-03-15 13:21:13 -07:00
2024-03-19 08:57:39 -07:00
2024-03-22 10:09:08 -07:00
2024-03-09 11:37:18 +01:00
2024-03-19 03:19:22 -04:00
2024-03-17 12:06:10 -07:00
2024-03-19 08:48:09 -07:00
2024-03-07 08:48:10 +00:00