Fix for a potential bug caught by Coverity. Pointed out to me by Kris Kennaway.

This commit is contained in:
Mohan Srinivasan 2006-09-14 17:57:02 +00:00
parent 7410947271
commit 3c5b80d6c2

View File

@ -306,7 +306,8 @@ namei(struct nameidata *ndp)
static int
compute_cn_lkflags(struct mount *mp, int lkflags)
{
if ((lkflags & LK_SHARED) && !(mp->mnt_kern_flag & MNTK_LOOKUP_SHARED)) {
if (mp == NULL ||
((lkflags & LK_SHARED) && !(mp->mnt_kern_flag & MNTK_LOOKUP_SHARED))) {
lkflags &= ~LK_SHARED;
lkflags |= LK_EXCLUSIVE;
}