RE: [PATCH v3] exfat: integrates dir-entry getting and validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Second: Range validation and type validation should not be separated.
> When I started making this patch, I intended to add only range validation.
> However, after the caller gets the ep, the type validation follows.
> Get ep, null check of ep (= range verification), type verification is a series of procedures.
> There would be no reason to keep them independent anymore.
> Range and type validation is enforced when the caller uses ep.
You can add a validate flags as argument of exfat_get_dentry_set(), e.g. none, basic and strict.
none : only range validation.
basic : range + type validation.
strict : range + type + checksum and name length, etc.
 
> > -	/* validiate cached dentries */
> > -	for (i = 1; i < num_entries; i++) {
> > -		ep = exfat_get_dentry_cached(es, i);
> > -		if (!exfat_validate_entry(exfat_get_entry_type(ep), &mode))
> > +	ep = exfat_get_dentry_cached(es, ENTRY_STREAM);
> > +	if (!ep || ep->type != EXFAT_STREAM)
> > +		goto free_es;
> > +	es->de[ENTRY_STREAM] = ep;
> 
> The value contained in stream-ext dir-entry should not be used before validating the EntrySet checksum.
> So I would insert EntrySet checksum validation here.
> In that case, the checksum verification loop would be followed by the TYPE_NAME verification loop, can
> you acceptable?
Yes. That would be great.

Thanks!
> 
> 
> > diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index
> > 44dc04520175..0e4cc8ba2f8e 100644
> > --- a/fs/exfat/exfat_fs.h
> > +++ b/fs/exfat/exfat_fs.h
> > @@ -33,6 +33,12 @@ enum {
> >   	NLS_NAME_OVERLEN,	/* the length is over than its limit */
> >   };
> >
> > +enum {
> > +	ENTRY_FILE,
> > +	ENTRY_STREAM,
> > +	ENTRY_NAME,
> > +};
> 
> This is necessary!
> With this, some magic numbers will be gone.
> But, I think it's better to use a name that can be recognized as an offset/index in the EntrySet.
> And, I think it's better to define this in "exfat_raw.h"
Okay, You can rename it and move it to there.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux