Markus Weippert
bb6cc25386
bcache: revert replacing IS_ERR_OR_NULL with IS_ERR
...
Commit 028ddcac477b ("bcache: Remove unnecessary NULL point check in
node allocations") replaced IS_ERR_OR_NULL by IS_ERR. This leads to a
NULL pointer dereference.
BUG: kernel NULL pointer dereference, address: 0000000000000080
Call Trace:
? __die_body.cold+0x1a/0x1f
? page_fault_oops+0xd2/0x2b0
? exc_page_fault+0x70/0x170
? asm_exc_page_fault+0x22/0x30
? btree_node_free+0xf/0x160 [bcache]
? up_write+0x32/0x60
btree_gc_coalesce+0x2aa/0x890 [bcache]
? bch_extent_bad+0x70/0x170 [bcache]
btree_gc_recurse+0x130/0x390 [bcache]
? btree_gc_mark_node+0x72/0x230 [bcache]
bch_btree_gc+0x5da/0x600 [bcache]
? cpuusage_read+0x10/0x10
? bch_btree_gc+0x600/0x600 [bcache]
bch_gc_thread+0x135/0x180 [bcache]
The relevant code starts with:
new_nodes[0] = NULL;
for (i = 0; i < nodes; i++) {
if (__bch_keylist_realloc(&keylist, bkey_u64s(&r[i].b->key)))
goto out_nocoalesce;
// ...
out_nocoalesce:
// ...
for (i = 0; i < nodes; i++)
if (!IS_ERR(new_nodes[i])) { // IS_ERR_OR_NULL before
028ddcac477b
btree_node_free(new_nodes[i]); // new_nodes[0] is NULL
rw_unlock(true, new_nodes[i]);
}
This patch replaces IS_ERR() by IS_ERR_OR_NULL() to fix this.
Fixes: 028ddcac477b ("bcache: Remove unnecessary NULL point check in node allocations")
Link: https://lore.kernel.org/all/3DF4A87A-2AC1-4893-AE5F-E921478419A9@suse.de/
Cc: stable@vger.kernel.org
Cc: Zheng Wang <zyytlz.wz@163.com>
Cc: Coly Li <colyli@suse.de>
Signed-off-by: Markus Weippert <markus@gekmihesg.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2023-11-24 09:39:03 -07:00
..
2023-11-10 16:57:49 +01:00
2023-11-08 09:21:18 -08:00
2023-11-03 14:51:08 -10:00
2023-11-08 09:00:49 +09:00
2023-11-02 14:05:18 -10:00
2023-11-07 16:56:10 -08:00
2023-11-21 07:42:04 -07:00
2023-10-23 11:04:51 -07:00
2023-11-01 14:46:51 -10:00
2023-10-26 09:42:37 +02:00
2023-11-03 14:51:08 -10:00
2023-11-03 14:51:08 -10:00
2023-11-01 14:46:51 -10:00
2023-11-10 09:23:17 -08:00
2023-10-24 10:53:45 +02:00
2023-11-07 20:45:12 +01:00
2023-10-27 18:04:29 +08:00
2023-11-02 14:09:01 -07:00
2023-11-02 19:38:47 -10:00
2023-11-03 18:56:51 -10:00
2023-11-02 20:53:31 -10:00
2023-10-30 19:09:55 -10:00
2023-11-05 21:15:17 +09:00
2023-11-10 09:23:17 -08:00
2023-11-03 14:51:08 -10:00
2023-11-09 13:47:52 -08:00
2023-11-10 14:59:30 -08:00
2023-10-27 13:19:04 +02:00
2023-11-03 14:51:08 -10:00
2023-10-31 18:32:51 -10:00
2023-11-03 15:44:25 -10:00
2023-10-31 17:44:17 -10:00
2023-11-08 10:27:17 +01:00
2023-11-04 16:25:36 -10:00
2023-11-03 14:51:08 -10:00
2023-11-02 15:20:30 -10:00
2023-11-09 14:18:42 -08:00
2023-11-09 13:37:28 -08:00
2023-11-10 12:22:14 -08:00
2023-10-30 19:09:55 -10:00
2023-11-09 13:47:52 -08:00
2023-11-03 10:07:39 -10:00
2023-11-05 18:45:32 -08:00
2023-11-24 09:39:03 -07:00
2023-11-06 15:06:06 -08:00
2023-11-09 13:37:28 -08:00
2023-10-24 22:36:39 -04:00
2023-11-02 14:40:51 -10:00
2023-11-08 09:21:18 -08:00
2023-11-07 13:08:12 +01:00
2023-11-10 09:19:46 -08:00
2023-11-12 11:34:19 -08:00
2023-11-22 18:41:14 -07:00
2023-11-03 14:51:08 -10:00
2023-11-10 09:23:17 -08:00
2023-10-30 14:54:40 +01:00
2023-11-10 08:41:23 +01:00
2023-11-04 16:20:36 -10:00
2023-11-07 16:40:42 -08:00
2023-11-10 12:22:14 -08:00
2023-11-03 19:06:12 -10:00
2023-11-04 10:23:23 +01:00
2023-11-04 08:46:37 -10:00
2023-11-01 14:46:51 -10:00
2023-11-03 16:00:42 -10:00
2023-10-24 22:07:07 +02:00
2023-11-08 18:47:07 -08:00
2023-11-10 09:20:48 +01:00
2023-10-30 13:14:27 +00:00
2023-10-24 14:10:04 -07:00
2023-10-23 13:11:07 -06:00
2023-11-05 18:49:40 -08:00
2023-11-20 11:50:54 -07:00
2023-11-02 20:53:31 -10:00
2023-10-25 16:50:11 +02:00
2023-11-03 10:07:39 -10:00
2023-11-03 19:10:41 -10:00
2023-11-10 11:44:38 -08:00
2023-11-01 10:02:18 +00:00
2023-11-09 13:47:52 -08:00
2023-11-02 15:13:50 -10:00
2023-10-31 15:28:37 -10:00
2023-11-03 16:00:42 -10:00
2023-11-10 09:19:46 -08:00
2023-11-02 15:13:50 -10:00
2023-11-03 16:00:42 -10:00
2023-11-01 09:20:00 -04:00
2023-11-03 14:51:08 -10:00
2023-11-05 09:02:32 -10:00
2023-11-10 09:16:02 +01:00
2023-11-04 15:58:13 -10:00
2023-11-05 09:02:32 -10:00
2023-11-10 09:19:46 -08:00
2023-11-02 19:38:47 -10:00
2023-11-10 09:19:46 -08:00
2023-11-10 09:19:46 -08:00