Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8da0d1c authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds
Browse files

knfsd: Validate filehandle type in fsid_source



fsid_source decided where to get the 'fsid' number to
return for a GETATTR based on the type of filehandle.
It can be from the device, from the fsid, or from the
UUID.

It is possible for the filehandle to be inconsistent
with the export information, so make sure the export information
actually has the info implied by the value returned by
fsid_source.

Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Cc: "Luiz Fernando N. Capitulino" <lcapitulino@gmail.com>
Signed-off-by: default avatar"J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a1033be7
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -566,13 +566,23 @@ enum fsid_source fsid_source(struct svc_fh *fhp)
	case FSID_DEV:
	case FSID_ENCODE_DEV:
	case FSID_MAJOR_MINOR:
		if (fhp->fh_export->ex_dentry->d_inode->i_sb->s_type->fs_flags
		    & FS_REQUIRES_DEV)
			return FSIDSOURCE_DEV;
		break;
	case FSID_NUM:
		if (fhp->fh_export->ex_flags & NFSEXP_FSID)
			return FSIDSOURCE_FSID;
		break;
	default:
		break;
	}
	/* either a UUID type filehandle, or the filehandle doesn't
	 * match the export.
	 */
	if (fhp->fh_export->ex_flags & NFSEXP_FSID)
		return FSIDSOURCE_FSID;
		else
	if (fhp->fh_export->ex_uuid)
		return FSIDSOURCE_UUID;
	}
	return FSIDSOURCE_DEV;
}