mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
scmi: Avoid a use-after-free
Use LIST_FOREACH_SAFE to avoid a use-after-free in scmi_reqs_pool_free. The next pointer will be invalid after the call to free meaning LIST_FOREACH will dereference a freed struct to move to the next item. Reviewed by: emaste Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D50753
This commit is contained in:
parent
1254c42c68
commit
d41a2ba73c
1 changed files with 2 additions and 2 deletions
|
|
@ -291,9 +291,9 @@ scmi_reqs_pool_allocate(device_t dev, const int max_msg, const int max_payld_sz)
|
|||
static void
|
||||
scmi_reqs_pool_free(struct scmi_reqs_pool *rp)
|
||||
{
|
||||
struct scmi_req *req;
|
||||
struct scmi_req *req, *tmp;
|
||||
|
||||
LIST_FOREACH(req, &rp->head, next) {
|
||||
LIST_FOREACH_SAFE(req, &rp->head, next, tmp) {
|
||||
mtx_destroy(&req->mtx);
|
||||
free(req, M_DEVBUF);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue