MFC r276904:
Improve style and fix a possible use-after-free case introduced in r268384 by reinitializing the 'freestate' pointer after freeing the memory. Obtained from: HardenedBSD (71fab80c5dd3034b71a29a61064625018671bbeb) PR: 194525 Submitted by: Oliver Pinter <oliver.pinter@hardenedbsd.org>
This commit is contained in:
parent
ae11365e35
commit
f72184af7f
@ -740,12 +740,13 @@ lf_advlockasync(struct vop_advlockasync_args *ap, struct lockf **statep,
|
||||
|
||||
VI_UNLOCK(vp);
|
||||
|
||||
if (freestate) {
|
||||
if (freestate != NULL) {
|
||||
sx_xlock(&lf_lock_states_lock);
|
||||
LIST_REMOVE(freestate, ls_link);
|
||||
sx_xunlock(&lf_lock_states_lock);
|
||||
sx_destroy(&freestate->ls_lock);
|
||||
free(freestate, M_LOCKF);
|
||||
freestate = NULL;
|
||||
}
|
||||
|
||||
if (error == EDOOFUS) {
|
||||
|
Loading…
Reference in New Issue
Block a user