Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3351049pxa; Tue, 25 Aug 2020 19:59:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZcYGQ/RbwdZasraJX0HPrtgXBEM8KqYYdGWBHbO41vimpMq3ESEg0uwth63/n3f1f8397 X-Received: by 2002:a17:906:64c6:: with SMTP id p6mr13300273ejn.348.1598410788161; Tue, 25 Aug 2020 19:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598410788; cv=none; d=google.com; s=arc-20160816; b=sidDf0qfASZi+vCOhRitqe0KHto/O17SF7l3WViqQQF+2Wzl13mbpfZDt6MqsZX8mn VdIpJ8An58K31WRIc8rMHxtSJNcUz2s6VT8Xlk1XR/JyXly2DXLZijI6ncXQQIktyx0Z WxRWA3o9voKo+gBN+xXy81/OFRaYsw8WnBLfTuUBaptz6SExOW9XsA59bC9or22AUyZB mzyi2ZL2Ax0G6fa8iHK0zwP7/Nle1elpSN+edj5U6nsbb2jyIosHhEWtWCbtf4PjlGWe LA6v3Jh+y8MlAxPzEr/dVPVj+FfhJiQRGVctv3QmU6a5iimDR8HyxAC56b3rreNmBBXu pNJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=hbFEodepPvZbmGlOCAW6pdL+PginykbrTuYJhMivWLU=; b=NbkLPYE+GWSVfbVa0kHmHyj3ENIeVJ+nuIuETwiEFdJPwu943Sh+YIdd+B6P6MwoNR EajSxPZv6RzJ5QB1pwz1YdkQYPNQGLLbpavgjj131/Ue2Rc9P7NSjF2SknYICk+Fm6ph UiPlP3MfbmH3fa3RpAFvwgMrEnBSLYQfsibbBofEphDR9KlKr+ZR0B8Ne951cTJGtFg5 W7vqHLmizG0BXuTIeSFuEdPNyUAIuc11uXXhN7PVTVw2QiwcPC7/aQzNO4m9x9iLIwTj 1cgvON8x+6wLH3iS4h9gtdJTJiI3hhGZP9QECTQNDs4JfCvW8jXI2uYo5+6sc38sqgpx 1PYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JRtgxN04; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w10si543599edx.512.2020.08.25.19.59.25; Tue, 25 Aug 2020 19:59:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JRtgxN04; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726717AbgHZC41 (ORCPT + 99 others); Tue, 25 Aug 2020 22:56:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726672AbgHZC40 (ORCPT ); Tue, 25 Aug 2020 22:56:26 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B76FC061574; Tue, 25 Aug 2020 19:56:26 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id n3so442356pjq.1; Tue, 25 Aug 2020 19:56:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=hbFEodepPvZbmGlOCAW6pdL+PginykbrTuYJhMivWLU=; b=JRtgxN04gxU/IDzMXlbNw78semo21YBgHHcNoAJbnR8jpjdjspaNQ1Mftdhsz9QGPH jlSF1BkqJEhpSeIj0gismWgIY1pyC4ypjxqBmwTFct/ARCWxtawBzaXiXjMWGSDKTESn cm/hayB1tXowLPiC1gKmKFBJo1YOJLlnQMyLKmDHMvdV38Y1F7qfmQZiHFtCDkMfWA/R LBMwbalKomRo2k8WmJ5V4tFsIATzLx4qh+LxdhaPLM2eZYGDJa08RG134oy7zYAjtzSA obq5uhESHqOOIEF8Ddyg4Muc+sOAgPW4LQRgDEQ2LcsBc7ZOV4v74iwJi2DAzWCofocD PR1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=hbFEodepPvZbmGlOCAW6pdL+PginykbrTuYJhMivWLU=; b=Lh4ZMXM8cam+6GBjh/MGfbavfA+0pGzDIDmHVgkkL2FYWSygtvl4mbgsDoKZkXzq35 RpknLIzgFOtIURHUMbuTJ5NoZebIhGXmYv+7ImkCIZop1VBzbhRIXusWtfxTiN01plUu EizJsjDUKHA02WKth19MbuE8PRDOxDPOOGD6g6+5FsV62oi24OrlEkvLyh8yHAEusp/C bMlPUK2M1dp++YF2/shRJPYTf/OG74hhtEd7Y2NCCVbeMd6fMWoc9WhR7CUBB065qpTN gnoF16L8ITsu79yfrqKPEscG40RVh2U8f3yfYDj7jL70YJ7Vq9Hnx02Yht3RLIFlnpuX mVKA== X-Gm-Message-State: AOAM530UX62vJ2YUqdIdft9peeQVeL3bjMldj7LaI2ocOBXT5x+v2pmX BnghHGrDosMlx4VTqAJNV5VmKFDXGKE= X-Received: by 2002:a17:90a:19c8:: with SMTP id 8mr3746355pjj.152.1598410585817; Tue, 25 Aug 2020 19:56:25 -0700 (PDT) Received: from [192.168.1.200] (FL1-111-169-205-196.hyg.mesh.ad.jp. [111.169.205.196]) by smtp.gmail.com with ESMTPSA id fz19sm397834pjb.40.2020.08.25.19.56.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Aug 2020 19:56:25 -0700 (PDT) Subject: Re: [PATCH v3] exfat: integrates dir-entry getting and validation To: Namjae Jeon Cc: kohada.tetsuhiro@dc.mitsubishielectric.co.jp, mori.takahiro@ab.mitsubishielectric.co.jp, motai.hirotaka@aj.mitsubishielectric.co.jp, 'Sungjong Seo' , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200806010229.24690-1-kohada.t2@gmail.com> <003c01d66edc$edbb1690$c93143b0$@samsung.com> <000001d67787$d3abcbb0$7b036310$@samsung.com> <000101d67b44$ac458c80$04d0a580$@samsung.com> From: Tetsuhiro Kohada Message-ID: Date: Wed, 26 Aug 2020 11:56:22 +0900 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <000101d67b44$ac458c80$04d0a580$@samsung.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/08/26 10:03, Namjae Jeon wrote: >> 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. Currently, various types of verification will not be needed. Let's add it when we need it. > >>> - /* 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. OK. I'll add TYPE_NAME verification after checksum verification, in next patch. However, I think it is enough to validate TYPE_NAME when extracting name. Could you please tell me why you think you need TYPE_NAME validation here? BR --- Tetsuhiro Kohada >