Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6658096rwl; Thu, 29 Dec 2022 17:38:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXtgihpS/IGvGiWmmogYFTxi0+ycLn3itHdI9qkUcYTakk4tiShZzuUMMpd2swNxarOQeD2v X-Received: by 2002:a05:6a20:7908:b0:9d:efbe:2052 with SMTP id b8-20020a056a20790800b0009defbe2052mr37138045pzg.8.1672364289169; Thu, 29 Dec 2022 17:38:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672364289; cv=none; d=google.com; s=arc-20160816; b=zQYt8boI1W9Lb7xwQqYMs8322PhGfZ5Yc9DttRwkFj2wcnSiaL4m7RrQFSbOvmEZGW RrWP/sDr89afaogNu5vudWKQYWxmQfioN0qILm2QO+EJik+4odk7U12262WtYdhvDU8I H6ts2wcblj3KJispTgGU2D9+i+4eM3fc7HwaZYqk3FGlikeHR5lZjGEBdgDmjNQtyEXR rJZ9VbxOuaaocjEsJYNwgMn5+vDLCx0h20oPQq1r9jciIwS6Jtv7SDrIKkeBMM+8YV20 gcZMsqO5hKjEr7Vx3sECZ9yeBiSisU1ETFL7von+Fs2rugWllHcY5V6k2Bgip7d4eAno OMVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:references :in-reply-to:mime-version:dkim-signature; bh=VOn8eoQiO6gbJRcKeLobts+OA5WiHLhdUl1hzpTzSXA=; b=h5SxGgqFAG1dq6ihZdez/DNCQ2+H31DpyEBHLzbkeEpT9xk3Vg3penQNGFP+rQKMjg OHtUJ/P6LKNLYiFOAKzSk5OmGxfwg+TnJGeEPUqW+qbKbOAECrlesZF6ydukPG74NPnu emSnGkqhj645mf/APusEFenH6URaKTHcbI7zFA5j9N7ibtbHoU1RZREYCIRmuw2GNtG/ 82eWE8dGR4OwQC0bZwQm9yrVn3a5KJIQ8gmvv2AEuteXCwsrbW4X11+wEVGI1Jrim4SX nb/fMH2HIZ1fQ9iEvpMFSZraxE991/7mhjKMeERuLUVFlUP/gl/zvK7wPRyoTO9NU9l4 OoXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="OFaCVO/B"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g71-20020a636b4a000000b0049bb86670d0si7978295pgc.290.2022.12.29.17.38.01; Thu, 29 Dec 2022 17:38:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="OFaCVO/B"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234281AbiL3Bc6 (ORCPT + 63 others); Thu, 29 Dec 2022 20:32:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbiL3Bc4 (ORCPT ); Thu, 29 Dec 2022 20:32:56 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EF37DE9A; Thu, 29 Dec 2022 17:32:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4C405B81A97; Fri, 30 Dec 2022 01:32:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB074C433F0; Fri, 30 Dec 2022 01:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672363973; bh=VOn8eoQiO6gbJRcKeLobts+OA5WiHLhdUl1hzpTzSXA=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=OFaCVO/BM/EYs/d+Qy170u7JNHZdmFbKFlg5mOl0+RiwGzW7KjdjC51N6kaVTkmaI Y8cSOVyvbc+GtJp2ZDnQdyBOF6bXrGAZ9G+2p/C1iDtMBoFa8U+xer7H1niNJLkSUp 0PsRj/9miK+8HLiL96LO9SoLKTM4wqwnknk6lu78dpT2yC2MFkUjHpBUdz5/MJJ+TS aYzAcaWBLfmTdtC9lTdCZVstkPBG2lvC4O2nMCofXldKEoFD19500yvoakyYu6zFhr tx5jN6JBpJf1q27QZ7MCbEplu4KEVM4u3BwOz7bkKNjZh/n8RgNd8W7vhICWFTTExs zkZE/w+pN7UKQ== Received: by mail-ot1-f49.google.com with SMTP id v15-20020a9d69cf000000b006709b5a534aso12397143oto.11; Thu, 29 Dec 2022 17:32:52 -0800 (PST) X-Gm-Message-State: AFqh2kqtm55EPjAVPIbZuu0yiv6lQVueWmpW7hHsAfhPEG9WqMbMd+NA 1mTYORJWXSW556IbpY/emO8dDAElHztLoZNbW28= X-Received: by 2002:a05:6830:12c6:b0:663:c86f:7573 with SMTP id a6-20020a05683012c600b00663c86f7573mr2099798otq.187.1672363971988; Thu, 29 Dec 2022 17:32:51 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a05:6838:2d06:0:0:0:0 with HTTP; Thu, 29 Dec 2022 17:32:51 -0800 (PST) In-Reply-To: References: From: Namjae Jeon Date: Fri, 30 Dec 2022 10:32:51 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1] exfat: fix reporting fs error when reading dir beyond EOF To: "Yuezhang.Mo@sony.com" Cc: "sj1557.seo@samsung.com" , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Andy.Wu@sony.com" , "Wataru.Aoyama@sony.com" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2022-12-26 16:23 GMT+09:00, Yuezhang.Mo@sony.com : > Since seekdir() does not check whether the position is valid, the > position may exceed the size of the directory. We found that for > a directory with discontinuous clusters, if the position exceeds > the size of the directory and the excess size is greater than or > equal to the cluster size, exfat_readdir() will return -EIO, > causing a file system error and making the file system unavailable. > > Reproduce this bug by: > > seekdir(dir, dir_size + cluster_size); > dirent = readdir(dir); > > The following log will be printed if mount with 'errors=remount-ro'. > > [11166.712896] exFAT-fs (sdb1): error, invalid access to FAT (entry > 0xffffffff) > [11166.712905] exFAT-fs (sdb1): Filesystem has been set read-only > > Fixes: 1e5654de0f51 ("exfat: handle wrong stream entry size in > exfat_readdir()") > > Signed-off-by: Yuezhang Mo > Reviewed-by: Andy Wu > Reviewed-by: Aoyama Wataru Applied, Thanks for your patch!