Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751363AbbKOLYN (ORCPT ); Sun, 15 Nov 2015 06:24:13 -0500 Received: from a.ns.miles-group.at ([95.130.255.143]:11949 "EHLO radon.swed.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750962AbbKOLYM (ORCPT ); Sun, 15 Nov 2015 06:24:12 -0500 Subject: Re: Endless getdents() in vfat filesystem To: Vegard Nossum , OGAWA Hirofumi , Andrew Morton References: <56468C1E.2060401@oracle.com> <56472C2F.5090207@oracle.com> <87r3js3baj.fsf@mail.parknet.co.jp> <56474DDB.7020904@nod.at> <87egfs30l8.fsf@mail.parknet.co.jp> <56486709.7000004@oracle.com> Cc: LKML From: Richard Weinberger Message-ID: <56486B59.9010400@nod.at> Date: Sun, 15 Nov 2015 12:24:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <56486709.7000004@oracle.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1518 Lines: 47 Am 15.11.2015 um 12:05 schrieb Vegard Nossum: > On 11/14/2015 07:19 PM, OGAWA Hirofumi wrote: >> Richard Weinberger writes: >> >>>>> Yes, it does fixes the problem here, but I can't really comment on the >>>>> correctness of the patch. >>>>> >>>>> Thanks for the quick reponse, >>>> >>>> I made cleanup and made sure fake_offset is corrected. >>>> >>>> Richard, Signed-off-by was missed in your patch, so I added. Can you >>>> agree to Signed-off-by? >>> >>> Sure! >> >> Attached updated patch made smaller changes, and with missed Cc: stable. >> >> Andrew, please queue this up. >> >> Thanks. >> > > It would be nice to have a proper patch description too. How about this? > > """ > For the root directory, . and .. are faked (using dir_emit_dots()) and > ctx->pos is reset from 2 to 0. > > A corrupted root directory could cause fat_get_entry() to fail, but > ->iterate() (fat_readdir()) reports progress to the VFS (with ctx->pos > rewound to 0), so any following calls to ->iterate() continue to return > the same entries again and again. > > The result is that userspace will never see the end of the directory, > causing e.g. 'ls' to hang in a getdents() loop. > """ Agreed. And you deserve also a Reported-and-tested-by. :-) Thanks, //richard -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/