diff options
author | Chunwei Chen <[email protected]> | 2023-10-02 16:58:01 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2023-10-03 09:06:07 -0700 |
commit | 0d870a17750feaeee9071c161d3248508a126043 (patch) | |
tree | 125d37dac41d86c532be4890ee16ad04cd1b3ac6 /include/os | |
parent | 608741d062fe4b92c8018fff96b24a9629c08bcb (diff) |
Fix invalid pointer access in trace_dbuf.h
In dnode_destroy, dn_objset is invalidated. However, it will later call
into dbuf_destroy, in which DTRACE_SET_STATE will try to access spa_name
via dn_objset causing illegal pointer access.
Reviewed-by: Brian Atkinson <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes #15333
Diffstat (limited to 'include/os')
-rw-r--r-- | include/os/linux/zfs/sys/trace_dbuf.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/os/linux/zfs/sys/trace_dbuf.h b/include/os/linux/zfs/sys/trace_dbuf.h index 11d25be35..0f6a98b47 100644 --- a/include/os/linux/zfs/sys/trace_dbuf.h +++ b/include/os/linux/zfs/sys/trace_dbuf.h @@ -60,8 +60,12 @@ #define DBUF_TP_FAST_ASSIGN \ if (db != NULL) { \ - __assign_str(os_spa, \ - spa_name(DB_DNODE(db)->dn_objset->os_spa)); \ + if (POINTER_IS_VALID(DB_DNODE(db)->dn_objset)) { \ + __assign_str(os_spa, \ + spa_name(DB_DNODE(db)->dn_objset->os_spa)); \ + } else { \ + __assign_str(os_spa, "NULL"); \ + } \ \ __entry->ds_object = db->db_objset->os_dsl_dataset ? \ db->db_objset->os_dsl_dataset->ds_object : 0; \ |