]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
kern: cpuset: plug a unr leak
authorkevans <kevans@FreeBSD.org>
Tue, 8 Dec 2020 18:44:06 +0000 (18:44 +0000)
committerkevans <kevans@FreeBSD.org>
Tue, 8 Dec 2020 18:44:06 +0000 (18:44 +0000)
commitbe6234a2164099e1b54ae9bee82520cd747df71a
treec12c0e90a302c9b4d7796e0739ff757e0ba5c747
parent827b9866f55931c88ec3bec75618ee99bdd2dea2
kern: cpuset: plug a unr leak

cpuset_rel_defer() is supposed to be functionally equivalent to
cpuset_rel() but with anything that might sleep deferred until
cpuset_rel_complete -- this setup is used specifically for cpuset_setproc.

Add in the missing unr free to match cpuset_rel. This fixes a leak that
was observed when I wrote a small userland application to try and debug
another issue, which effectively did:

cpuset(&newid);
cpuset(&scratch);

newid gets leaked when scratch is created; it's off the list, so there's
no mechanism for anything else to relinquish it. A more realistic reproducer
would likely be a process that inherits some cpuset that it's the only ref
for, but it creates a new one to modify. Alternatively, administratively
reassigning a process' cpuset that it's the last ref for will have the same
effect.

Discovered through D27498.

MFC after: 1 week
sys/kern/kern_cpuset.c