Markus Weippert
042d287ea2
bcache: revert replacing IS_ERR_OR_NULL with IS_ERR
...
commit bb6cc253861bd5a7cf8439e2118659696df9619f upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-08 08:43:25 +01:00
..
2023-12-08 08:43:25 +01:00
2022-01-27 09:04:28 +01:00
2020-03-25 08:06:07 +01:00
2021-03-11 14:04:59 +01:00
2023-01-18 11:30:42 +01:00
2023-08-11 11:45:35 +02:00
2023-03-11 16:31:48 +01:00
2021-03-04 09:39:57 +01:00
2023-04-05 11:15:38 +02:00
2023-12-08 08:43:24 +01:00
2022-07-02 16:27:31 +02:00
2023-05-17 11:13:21 +02:00
2023-08-30 16:31:53 +02:00
2023-08-11 11:45:01 +02:00
2023-08-11 11:45:01 +02:00
2019-08-29 08:28:55 +02:00
2019-01-26 09:32:42 +01:00
2019-07-03 13:14:45 +02:00
2020-06-25 15:32:49 +02:00
2019-01-26 09:32:42 +01:00
2023-08-11 11:45:32 +02:00
2021-05-22 10:59:23 +02:00
2023-08-11 11:45:01 +02:00
2021-06-03 08:38:04 +02:00
2023-04-05 11:15:38 +02:00
2023-04-05 11:15:38 +02:00
2023-08-11 11:45:01 +02:00
2019-09-16 08:22:12 +02:00
2023-01-18 11:30:42 +01:00
2019-01-31 08:14:38 +01:00
2023-04-05 11:15:37 +02:00
2019-01-26 09:32:42 +01:00
2023-12-08 08:43:25 +01:00
2021-04-28 13:16:50 +02:00
2023-12-08 08:43:25 +01:00
2023-12-08 08:43:25 +01:00
2022-08-25 11:15:30 +02:00
2020-06-25 15:32:58 +02:00
2020-06-25 15:32:58 +02:00
2020-07-09 09:37:12 +02:00
2019-12-17 20:34:53 +01:00
2023-04-05 11:15:38 +02:00
2023-08-11 11:45:02 +02:00
2018-08-01 15:49:39 -07:00
2020-12-30 11:26:16 +01:00
2019-12-17 20:34:55 +01:00
2019-12-17 20:34:55 +01:00
2023-08-11 11:45:25 +02:00
2019-12-17 20:34:55 +01:00
2023-08-11 11:45:22 +02:00
2023-08-11 11:45:22 +02:00
2023-09-23 10:48:17 +02:00
2019-02-06 17:30:16 +01:00
2018-08-31 17:38:09 -07:00
2023-08-11 11:45:01 +02:00
2023-08-11 11:45:25 +02:00