Markus Weippert
f62ceb880a
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:46:12 +01:00
..
2023-12-08 08:46:12 +01:00
2022-01-27 10:54:20 +01:00
2019-11-05 14:53:03 -05:00
2020-01-07 12:07:08 -05:00
2020-03-03 10:02:46 -05:00
2021-03-09 11:11:12 +01:00
2023-01-14 10:16:31 +01:00
2023-08-11 11:57:44 +02:00
2023-03-11 16:39:54 +01:00
2020-03-27 14:42:51 -04:00
2020-03-27 14:42:51 -04:00
2023-05-17 11:48:06 +02:00
2021-03-04 11:38:44 +01:00
2023-04-05 11:23:44 +02:00
2023-12-08 08:46:11 +01:00
2020-07-20 11:17:41 -04:00
2020-08-04 16:01:40 -04:00
2022-06-29 08:59:45 +02:00
2023-05-17 11:48:07 +02:00
2022-04-20 09:23:18 +02:00
2020-08-04 15:51:28 -04:00
2023-08-30 16:23:11 +02:00
2020-07-16 12:35:15 -07:00
2023-05-17 11:48:07 +02:00
2019-08-15 15:57:39 -04:00
2020-09-25 08:20:03 -06:00
2020-05-20 17:09:44 -04:00
2022-06-29 08:59:45 +02:00
2020-09-29 16:33:08 -04:00
2020-05-15 10:29:36 -04:00
2020-05-15 10:29:36 -04:00
2020-07-01 07:27:24 -06:00
2023-08-11 11:57:38 +02:00
2022-08-21 15:15:36 +02:00
2020-05-15 10:29:36 -04:00
2020-09-29 16:33:12 -04:00
2021-06-03 09:00:30 +02:00
2023-04-05 11:23:42 +02:00
2023-04-05 11:23:42 +02:00
2020-05-20 17:09:44 -04:00
2020-05-20 17:09:44 -04:00
2021-03-30 14:32:06 +02:00
2023-01-14 10:16:31 +01:00
2019-12-05 17:05:24 -05:00
2023-04-05 11:23:40 +02:00
2023-12-08 08:46:12 +01:00
2021-04-21 13:00:54 +02:00
2023-12-08 08:46:12 +01:00
2021-06-16 12:01:37 +02:00
2020-08-04 15:48:13 -04:00
2023-12-08 08:46:12 +01:00
2022-08-21 15:16:19 +02:00
2021-07-19 09:45:01 +02:00
2020-07-08 12:21:53 -04:00
2023-10-10 21:53:39 +02:00
2020-06-05 14:59:53 -04:00
2023-04-05 11:23:42 +02:00
2021-03-04 11:38:44 +01:00
2021-01-27 11:54:57 +01:00
2020-07-16 15:34:47 +02:00
2020-08-23 17:36:59 -05:00
2023-09-19 12:20:23 +02:00
2020-12-30 11:54:25 +01:00
2020-07-01 07:27:24 -06:00
2020-09-02 08:00:07 -06:00
2020-05-13 12:02:23 -07:00
2020-07-08 17:20:46 -06:00
2023-08-11 11:57:38 +02:00
2022-01-16 09:14:21 +01:00
2023-07-27 08:44:29 +02:00
2023-07-27 08:44:29 +02:00
2023-09-23 11:01:09 +02:00
2020-05-13 12:02:23 -07:00
2020-08-02 23:03:52 -07:00
2020-07-21 17:18:12 -07:00
2022-10-26 13:25:53 +02:00
2020-09-24 16:44:44 -07:00
2023-07-27 08:44:36 +02:00
2020-12-09 20:46:00 -08:00