xfs: don't try to get a reference to a NULL oz in xfs_get_cached_zone
PATCH 1/1 xfs: don't try to get a reference to a NULL oz in xfs_get_cached_zone
oz can be NULL when we resample it after taking i_flags_lock, so account for that.
Fixes 2d829cc76777 ("xfs: fix racy open zone caching")
Signed-off-by Christoph Hellwig <[email protected]>
--- fs/xfs/xfs_zone_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_zone_alloc.c +1 -1
@@ -819,7 +819,7 @@ xfs_get_cached_zone(spin_unlock (&ip->i_flags_lock); } -if (!atomic_inc_not_zero (&oz->oz_ref)) +if (oz && !atomic_inc_not_zero (&oz->oz_ref)) oz =NULL ; out_unlock:rcu_read_unlock ();
Signature · 1 line
2.53.0
Quoted 5 lines · Christoph Hellwig
oz can be NULL when we resample it after taking
i_flags_lock, so account for that.Fixes 2d829cc76777 ("xfs: fix racy open zone caching")Signed-off-by Christoph Hellwig <[email protected]>
Reviewed-by Carlos Maiolino <[email protected]>
Quoted 21 lines
--- fs/xfs/xfs_zone_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/xfs_zone_alloc.c +1
-1@@ -819,7 +819,7 @@ xfs_get_cached_zone(spin_unlock (&ip->i_flags_lock); } -if (!atomic_inc_not_zero (&oz->oz_ref)) +if (oz && !atomic_inc_not_zero (&oz->oz_ref)) oz =NULL ; out_unlock:rcu_read_unlock ();Signature · 1 line
2.53.0
Quoted 14 lines · Christoph Hellwig
oz can be NULL when we resample it after taking
i_flags_lock, so account for that.Fixes 2d829cc76777 ("xfs: fix racy open zone caching")Signed-off-by Christoph Hellwig <[email protected]>--- fs/xfs/xfs_zone_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/xfs_zone_alloc.c +0
-0
fs/xfs/xfs_zone_alloc.c xfs_get_cached_zone( · line 825
Quoted 8 lines
fs/xfs/xfs_zone_alloc.c +1
-1@@ -819,7 +819,7 @@ xfs_get_cached_zone(spin_unlock (&ip->i_flags_lock); } -if (!atomic_inc_not_zero (&oz->oz_ref)) +if (oz && !atomic_inc_not_zero (&oz->oz_ref)) oz =NULL ; out_unlock:rcu_read_unlock ();
Looks good,
Reviewed-by Hans Holmberg <[email protected]>
Quoted 4 lines · Christoph Hellwig
oz can be NULL when we resample it after taking
i_flags_lock, so account for that.
Applied to for-next, thanks!
[1/1] xfs: don't try to get a reference to a NULL oz in xfs_get_cached_zone
commit: 14e379600d3e57ab0872b049c28cfe5ef519d439
Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>