Fix potential NULL pointer dereference regression

945b407486 neglected to `NULL` check
`tx->tx_objset`, which is already done in the function. This upset
Coverity, which complained about a "dereference after null check".

Upon inspection, it was found that whenever `dmu_tx_create_dd()` is
called followed by `dmu_tx_assign()`, such as in
`dsl_sync_task_common()`, `tx->tx_objset` will be `NULL`.

Reported-by: Coverity (CID 1527261)
Reviewed-by: Mariusz Zaborski <mariusz.zaborski@klarasystems.com>
Reviewed-by: Youzhong Yang <yyang@mathworks.com>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14170
This commit is contained in:
Richard Yao 2022-11-10 09:01:58 -05:00 committed by Brian Behlendorf
parent 16f0fdaddd
commit 9e2be2dfbd
1 changed files with 1 additions and 1 deletions

View File

@ -1321,7 +1321,7 @@ top_of_function:
* we want to let it through. * we want to let it through.
*/ */
if (ignorequota || netfree || dsl_dir_phys(dd)->dd_quota == 0 || if (ignorequota || netfree || dsl_dir_phys(dd)->dd_quota == 0 ||
(dmu_objset_type(tx->tx_objset) == DMU_OST_ZVOL && (tx->tx_objset && dmu_objset_type(tx->tx_objset) == DMU_OST_ZVOL &&
zvol_enforce_quotas == B_FALSE)) zvol_enforce_quotas == B_FALSE))
quota = UINT64_MAX; quota = UINT64_MAX;
else else