Re: [PATCH v2] ceph: strengthen the validation check about rsize/wsize/readdir_max_bytes

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

 



That also makes sense, thanks for your suggestion.

I’ll fix in V3.


> 在 2018年5月30日,下午4:18,Ilya Dryomov <idryomov@xxxxxxxxx> 写道:
> 
> On Wed, May 30, 2018 at 9:59 AM, Chengguang Xu <cgxu519@xxxxxxx> wrote:
>> The check(intval < PAGE_SIZE) will involve type cast to intval,
>> so even when specifying negative value to rsize/wsize/readdir_max_bytes,
>> it will pass the validation check successfully.
>> 
>> Signed-off-by: Chengguang Xu <cgxu519@xxxxxxx>
>> ---
>> v1->v2:
>> - strengthen the validation check for readdir_max_bytes as well.
>> 
>> fs/ceph/super.c | 8 +++++---
>> 1 file changed, 5 insertions(+), 3 deletions(-)
>> 
>> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
>> index b33082e6878f..d7e140830d0b 100644
>> --- a/fs/ceph/super.c
>> +++ b/fs/ceph/super.c
>> @@ -256,12 +256,14 @@ static int parse_fsopt_token(char *c, void *private)
>>                break;
>>                /* misc */
>>        case Opt_wsize:
>> -               if (intval < PAGE_SIZE || intval > CEPH_MAX_WRITE_SIZE)
>> +               if (intval < 0 ||
>> +                       intval < PAGE_SIZE || intval > CEPH_MAX_WRITE_SIZE)
> 
> Cast PAGE_SIZE to int instead:
> 
>  intval < (int)PAGE_SIZE || intval > CEPH_MAX_WRITE_SIZE
> 
> Thanks,
> 
>                Ilya

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux