qcacmn: Fix to release lock correctly in DP_PRINT_STATS

Currently, sysfs_write_user_buffer spinlock is not
released correctly in DP_PRINT_STATS() when the
buffer size reaches max value. This is causing a
soft lockup, when the next DP_PRINT_STATS() call
is waiting to acquire the spinlock.
This change prevents the softlockup by properly
handling the release of the spinlock.

Change-Id: I13c3e26f7a26b501c5d23b8dc4b978f61beeabd0
CRs-Fixed: 3495547
This commit is contained in:
Namita Nair
2023-05-18 15:36:57 -07:00
committed by Rahul Choudhary
parent 74bcf45dff
commit ce47d03e6b

View File

@@ -388,7 +388,7 @@ void DP_PRINT_STATS(const char *fmt, ...)
curr_len = soc->sysfs_config->curr_buffer_length;
max_len = soc->sysfs_config->max_buffer_length;
if ((max_len - curr_len) <= 1)
return;
goto fail;
qdf_spinlock_acquire(&soc->sysfs_config->sysfs_write_user_buffer);
if (soc->sysfs_config->buf) {
@@ -396,7 +396,7 @@ void DP_PRINT_STATS(const char *fmt, ...)
max_len - curr_len, fmt, val);
curr_len += buf_written;
if ((max_len - curr_len) <= 1)
return;
goto rel_lock;
buf_written += scnprintf(soc->sysfs_config->buf + curr_len,
max_len - curr_len, "\n");
@@ -406,6 +406,12 @@ void DP_PRINT_STATS(const char *fmt, ...)
}
}
va_end(val);
return;
rel_lock:
qdf_spinlock_release(&soc->sysfs_config->sysfs_write_user_buffer);
fail:
va_end(val);
}
#endif /* WLAN_SYSFS_DP_STATS */
/**