From: Hin-Tak Leung Subject: Re: [PATCH V2] hfsplus: fixes worst-case unicode to char conversion of file names and attributes Date: Tue, 8 Apr 2014 17:43:09 +0100 (BST) Message-ID: <1396975389.10068.YahooMailBasic@web172302.mail.ir2.yahoo.com> Reply-To: htl10@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: hintak.leung@gmail.com, linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk, hch@infradead.org To: slava@dubeyko.com, anton@tuxera.com Return-path: Received: from nm30-vm5.bullet.mail.ir2.yahoo.com ([212.82.97.83]:23635 "EHLO nm30-vm5.bullet.mail.ir2.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751037AbaDHQnM convert rfc822-to-8bit (ORCPT ); Tue, 8 Apr 2014 12:43:12 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: ------------------------------ On Tue, Apr 8, 2014 5:15 PM BST Vyacheslav Dubeyko wrote: >On Tue, 2014-04-08 at 16:06 +0100, Anton Altaparmakov wrote: >> Hi Hin-Tak, >>=20 >> That now looks good. >>=20 >> I agree with you that doing a major cleanup of how attribute names a= re >> handled is a separate patch.=A0 As you say that is much more work an= d it >> is not as trivial as this.=A0 I think doing the attribute handling >> properly requires reworking how it all fits together because it is >> imposing the name length checks at the wrong level - they need to be >> done after conversion to UTF-16 not whilst they are still in the >> current NLS (except of course you want to check that they are not to= o >> big to fit in the buffer though it is not at all clear to me why the >> argument is being copied into a buffer in the first place at least i= n >> one of the places I looked at - seems a waste of CPU time to me). >>=20 >Yes, it is possible to split the work on several patches. I agree with >it. > >But I suppose that these patches needs to be joined in one patchset. >Because reported issue can be solved by fix as for file names as for >xattr names. > >Of course, it is possible to fix the issue with file names, firstly, a= nd >then the issue with xattr names. But it doesn't make sense to mix fixe= s >for file names and for xattr names in one patch. Because partial fix i= n >hfsplus_listxattr() doesn't fix the issue for xattr names. > Think of it as "fixes worst-case usage of hfsplus_uni2asc()", then it makes sense to have this as one patch. Allowing full usage of getting and setting of long multi-lingual attributes, and checking other uses of HFSPLUS_ATTR_MAX_STRLEN really need to be another (multiple others). There are only two usages of hfsplus_uni2asc(), one for names and one for attributes. >> Also, I don't think it is needed to set up a kmem cache for this - >> kmalloc is perfect - as at any one time there will be a vanishingly >> small number of these buffers allocated at any one time.=A0 After al= l, >> how many concurrent readdir() calls are there going to be on a volum= e >> at any one time?=A0 It is not like the struct inode or other long li= ved >> memory structures where you end up with thousands of them in memory = at >> any one time... > >Yes, kmalloc can be enough for readdir() case. But I suppose that it >needs to use kmem cache for the case of xattr names. It will be more >efficient solution. > -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html