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
df4bc1ec8e
commit
5032a40c3b
@ -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 New Issue
Block a user