mirror of
https://github.com/opnsense/src.git
synced 2026-06-10 17:22:46 -04:00
Under #ifdef DIAGNOSTIC, NULL out componentname pointers if we free the
pnbuf to increase the chances of detecting use of a free'd name buffer if SAVENAME or SAVESTART wasn't passed in. Curiously, running with these changes doesn't panic the kernel, and should.
This commit is contained in:
parent
57d4ef078c
commit
eeb9251884
1 changed files with 18 additions and 2 deletions
|
|
@ -134,6 +134,10 @@ namei(ndp)
|
|||
|
||||
if (error) {
|
||||
uma_zfree(namei_zone, cnp->cn_pnbuf);
|
||||
#ifdef DIAGNOSTIC
|
||||
cnp->cn_pnbuf = NULL;
|
||||
cnp->cn_nameptr = NULL;
|
||||
#endif
|
||||
ndp->ni_vp = NULL;
|
||||
return (error);
|
||||
}
|
||||
|
|
@ -175,15 +179,23 @@ namei(ndp)
|
|||
error = lookup(ndp);
|
||||
if (error) {
|
||||
uma_zfree(namei_zone, cnp->cn_pnbuf);
|
||||
#ifdef DIAGNOSTIC
|
||||
cnp->cn_pnbuf = NULL;
|
||||
cnp->cn_nameptr = NULL;
|
||||
#endif
|
||||
return (error);
|
||||
}
|
||||
/*
|
||||
* Check for symbolic link
|
||||
*/
|
||||
if ((cnp->cn_flags & ISSYMLINK) == 0) {
|
||||
if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0)
|
||||
if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0) {
|
||||
uma_zfree(namei_zone, cnp->cn_pnbuf);
|
||||
else
|
||||
#ifdef DIAGNOSTIC
|
||||
cnp->cn_pnbuf = NULL;
|
||||
cnp->cn_nameptr = NULL;
|
||||
#endif
|
||||
} else
|
||||
cnp->cn_flags |= HASBUF;
|
||||
|
||||
if (vn_canvmio(ndp->ni_vp) == TRUE &&
|
||||
|
|
@ -244,6 +256,10 @@ namei(ndp)
|
|||
dp = ndp->ni_dvp;
|
||||
}
|
||||
uma_zfree(namei_zone, cnp->cn_pnbuf);
|
||||
#ifdef DIAGNOSTIC
|
||||
cnp->cn_pnbuf = NULL;
|
||||
cnp->cn_nameptr = NULL;
|
||||
#endif
|
||||
vrele(ndp->ni_dvp);
|
||||
vput(ndp->ni_vp);
|
||||
ndp->ni_vp = NULL;
|
||||
|
|
|
|||
Loading…
Reference in a new issue