Markus Weippert
0daf3b0fe4
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:52:19 +01:00
..
2023-12-08 08:52:19 +01:00
2023-06-16 18:24:13 -04:00
2023-02-14 14:23:06 -05:00
2021-10-27 16:53:47 -04:00
2023-03-30 15:57:51 -04:00
2023-03-30 15:57:51 -04:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-11-28 17:20:12 +00:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-06-19 13:19:33 -07:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-07-25 11:55:50 -04:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-06-12 08:04:05 -06:00
2021-04-19 13:20:31 -04:00
2023-06-12 08:04:05 -06:00
2023-09-14 11:18:29 -04:00
2023-11-28 17:19:58 +00:00
2023-12-03 07:33:09 +01:00
2023-04-11 12:09:08 -04:00
2023-04-11 12:09:08 -04:00
2023-06-12 08:04:05 -06:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-06-16 18:24:13 -04:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:07 -05:00
2023-06-05 10:57:40 -06:00
2023-07-25 11:55:50 -04:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:06 -05:00
2023-04-11 12:01:01 -04:00
2023-09-14 11:18:29 -04:00
2023-04-11 12:01:01 -04:00
2023-04-11 12:01:01 -04:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:06 -05:00
2023-04-11 12:09:08 -04:00
2023-04-11 12:01:01 -04:00
2023-04-11 12:01:01 -04:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-04-11 12:01:01 -04:00
2023-08-29 20:21:42 -07:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:06 -05:00
2023-04-11 12:01:01 -04:00
2023-02-14 14:23:07 -05:00
2023-06-12 08:04:05 -06:00
2023-03-16 13:37:06 -04:00
2023-03-16 13:37:06 -04:00
2023-04-11 12:01:01 -04:00
2023-04-11 12:09:08 -04:00
2023-02-14 14:23:08 -05:00
2023-09-14 11:18:29 -04:00
2023-04-11 12:01:01 -04:00
2023-06-30 12:16:00 -07:00
2023-02-14 14:23:06 -05:00
2023-06-30 12:16:00 -07:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-04-11 12:09:08 -04:00
2023-12-08 08:52:16 +01:00
2023-02-14 14:23:06 -05:00
2023-06-28 10:43:04 -07:00
2023-12-08 08:52:18 +01:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-12-08 08:52:16 +01:00
2023-04-11 12:09:08 -04:00
2023-04-11 12:09:08 -04:00
2023-06-16 18:24:13 -04:00
2023-05-31 09:50:02 -06:00
2021-06-04 12:07:24 -04:00
2023-09-20 13:48:06 -04:00
2022-07-14 12:14:31 -06:00
2023-09-15 15:39:59 -04:00
2023-06-16 18:24:14 -04:00
2023-08-02 09:13:09 -06:00
2022-08-02 14:38:59 -07:00
2023-06-05 10:56:46 -06:00
2023-07-27 00:13:30 -07:00
2023-07-27 00:13:29 -07:00
2023-08-15 09:40:26 -07:00
2023-07-27 00:13:30 -07:00
2023-07-27 00:13:30 -07:00
2023-07-27 00:13:29 -07:00
2023-12-03 07:33:07 +01:00
2023-09-08 13:16:40 -07:00
2023-08-17 21:11:31 -07:00
2023-06-30 15:43:50 -07:00
2023-06-23 09:33:16 -07:00
2023-09-11 14:41:58 -07:00
2023-07-27 00:13:29 -07:00
2023-08-15 09:40:27 -07:00
2022-08-02 17:14:31 -06:00
2023-05-31 09:50:02 -06:00
2023-10-03 08:53:09 -07:00
2023-06-27 21:24:18 -07:00
2023-08-15 09:40:26 -07:00
2023-07-27 00:13:29 -07:00