Zheyu Ma
738216c195
memstick: r592: Fix a UAF bug when removing the driver
In r592_remove(), the driver will free dma after freeing the host, which
may cause a UAF bug.
The following log reveals it:
[ 45.361796 ] BUG: KASAN: use-after-free in r592_remove+0x269/0x350 [r592]
[ 45.364286 ] Call Trace:
[ 45.364472 ] dump_stack_lvl+0xa8/0xd1
[ 45.364751 ] print_address_description+0x87/0x3b0
[ 45.365137 ] kasan_report+0x172/0x1c0
[ 45.365415 ] ? r592_remove+0x269/0x350 [r592]
[ 45.365834 ] ? r592_remove+0x269/0x350 [r592]
[ 45.366168 ] __asan_report_load8_noabort+0x14/0x20
[ 45.366531 ] r592_remove+0x269/0x350 [r592]
[ 45.378785 ]
[ 45.378903 ] Allocated by task 4674:
[ 45.379162 ] ____kasan_kmalloc+0xb5/0xe0
[ 45.379455 ] __kasan_kmalloc+0x9/0x10
[ 45.379730 ] __kmalloc+0x150/0x280
[ 45.379984 ] memstick_alloc_host+0x2a/0x190
[ 45.380664 ]
[ 45.380781 ] Freed by task 5509:
[ 45.381014 ] kasan_set_track+0x3d/0x70
[ 45.381293 ] kasan_set_free_info+0x23/0x40
[ 45.381635 ] ____kasan_slab_free+0x10b/0x140
[ 45.381950 ] __kasan_slab_free+0x11/0x20
[ 45.382241 ] slab_free_freelist_hook+0x81/0x150
[ 45.382575 ] kfree+0x13e/0x290
[ 45.382805 ] memstick_free+0x1c/0x20
[ 45.383070 ] device_release+0x9c/0x1d0
[ 45.383349 ] kobject_put+0x2ef/0x4c0
[ 45.383616 ] put_device+0x1f/0x30
[ 45.383865 ] memstick_free_host+0x24/0x30
[ 45.384162 ] r592_remove+0x242/0x350 [r592]
[ 45.384473 ] pci_device_remove+0xa9/0x250
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Link: https://lore.kernel.org/r/1634383581-11055-1-git-send-email-zheyuma97@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2021-10-19 13:04:42 +02:00
..
2021-09-27 11:40:43 -07:00
2021-09-14 09:02:13 +02:00
2021-09-03 08:06:02 -06:00
2021-10-03 11:10:09 -07:00
2021-09-01 08:44:42 -07:00
2021-09-29 20:31:41 -06:00
2021-08-19 17:08:31 +02:00
2021-10-06 08:01:13 +03:00
2021-09-12 11:44:58 -07:00
2021-09-11 10:05:56 -07:00
2021-09-03 11:11:54 -07:00
2021-09-21 17:53:54 +02:00
2021-09-17 12:05:04 -07:00
2021-09-07 12:38:59 -07:00
2021-09-24 15:58:41 +08:00
2021-09-09 11:48:27 -07:00
2021-09-09 11:39:57 -07:00
2021-09-08 11:50:26 -07:00
2021-09-09 11:07:47 -07:00
2021-09-07 12:42:21 +05:30
2021-09-16 11:00:12 +02:00
2021-09-11 09:47:33 -07:00
2021-10-08 11:57:54 -07:00
2021-09-16 15:20:55 -07:00
2021-09-30 12:11:35 -07:00
2021-10-08 11:57:54 -07:00
2021-09-27 10:00:43 +02:00
2021-09-15 17:18:56 -07:00
2021-10-02 05:14:11 -07:00
2021-09-14 09:03:16 +02:00
2021-10-04 21:56:20 +02:00
2021-09-08 12:55:35 -07:00
2021-09-27 14:49:49 -03:00
2021-09-11 09:08:28 -07:00
2021-09-13 15:49:55 +03:00
2021-10-08 11:57:54 -07:00
2021-09-27 17:38:49 +02:00
2021-09-22 14:44:25 +01:00
2021-09-03 15:33:47 -07:00
2021-08-20 11:00:08 +02:00
2021-09-14 13:23:22 -07:00
2021-08-31 22:57:45 -05:00
2021-09-14 11:22:26 +02:00
2021-09-22 08:45:58 -07:00
2021-10-08 11:57:54 -07:00
2021-10-19 13:04:42 +02:00
2021-09-07 12:38:59 -07:00
2021-09-21 16:17:15 +02:00
2021-10-19 13:02:58 +02:00
2021-09-08 12:55:35 -07:00
2021-10-08 11:57:54 -07:00
2021-09-23 12:53:06 +01:00
2021-09-07 13:05:02 -07:00
2021-09-27 11:40:43 -07:00
2021-09-27 10:02:07 -06:00
2021-09-21 17:38:37 +02:00
2021-10-06 11:12:28 +02:00
2021-08-30 19:25:42 +02:00
2021-09-09 12:44:31 +02:00
2021-09-02 13:16:00 -07:00
2021-10-08 16:46:09 -07:00
2021-09-20 12:43:34 +01:00
2021-09-08 12:55:35 -07:00
2021-10-08 11:57:54 -07:00
2021-09-21 15:49:23 +02:00
2021-08-30 11:47:32 -07:00
2021-08-25 20:12:16 +02:00
2021-10-07 09:50:31 -07:00
2021-09-02 22:27:46 +02:00
2021-09-17 13:16:38 +01:00
2021-09-01 15:25:28 -07:00
2021-09-14 10:20:19 +02:00
2021-10-01 14:45:23 -07:00
2021-10-04 23:40:11 -04:00
2021-09-01 08:44:42 -07:00
2021-10-07 21:13:57 +02:00
2021-09-01 10:29:29 -07:00
2021-09-22 11:58:24 -07:00
2021-10-04 09:53:40 -07:00
2021-09-22 00:17:29 -04:00
2021-09-14 07:54:56 +02:00
2021-09-21 15:17:11 +02:00
2021-09-06 12:27:03 -07:00
2021-10-08 12:55:23 -07:00
2021-10-08 10:16:01 -07:00
2021-09-14 18:10:43 -04:00
2021-09-23 14:12:36 -06:00
2021-09-28 07:27:29 -07:00
2021-10-06 11:12:28 +02:00
2021-09-14 18:09:57 -04:00
2021-09-27 11:57:19 -07:00
2021-10-08 12:55:23 -07:00
2021-10-07 16:51:26 +02:00