From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752874AbdJGB4P (ORCPT ); Fri, 6 Oct 2017 21:56:15 -0400 Received: from m12-12.163.com ([220.181.12.12]:33108 "EHLO m12-12.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752263AbdJGB4O (ORCPT ); Fri, 6 Oct 2017 21:56:14 -0400 Subject: Re: [PATCH] ext2/super: Fix a possible sleep-in-atomic bug in parse_options To: Linus Torvalds Cc: Al Viro , Jan Kara , Sagi Grimberg , james.smart@broadcom.com, "linux-ext4@vger.kernel.org" , linux-fsdevel , Linux Kernel Mailing List References: <1507339246-13067-1-git-send-email-baijiaju1990@163.com> From: Jia-Ju Bai Message-ID: Date: Sat, 7 Oct 2017 09:55:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-CM-TRANSID: DMCowAAHX7v4M9hZr0JhIQ--.60518S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrurW5Cr18KFy8urWUKFW7urg_yoWkWwc_ZF 1vyF4fAryUtFnIqF4Svr4IkrZrtr47Zr18Jwn0q3Z8J34rZFWxWFn2krnI9anYqay8Krs8 Jrn5Wws5JF9IgjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU5Y1v3UUUUU== X-Originating-IP: [183.172.144.119] X-CM-SenderInfo: xedlyx5dmximizq6il2tof0z/1tbiThhqelUC0IVvIwAAsI Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for your reply. I agree that extra allocation in match_number() and match_u64int() may be unnecessary. Thanks, Jia-Ju Bai On 2017/10/7 9:37, Linus Torvalds wrote: > On Fri, Oct 6, 2017 at 6:20 PM, Jia-Ju Bai wrote: >> To fix it, GFP_KERNEL is replaced with GFP_ATOMIC. >> This bug is found by my static analysis tool and my code review. > I'm not saying your patch is wrong, but it's a shame that we do that > extra allocation in match_number() and match_u64int(), and that we > don't have anything that is just size-limited. > > And there really isn't anything saying that we shouldn't do the same > silly thing to match_u64int(). Maybe we don't have any actual users > that need it for now, but still.. > > Oh well. > > I do wonder if we shouldn't just use something like > > "skip leading zeroes, copy to size-limited stack location instead" > > because the input length really *is* limited once you skip leading > zeroes (and whatever base marker we have). We might have at most a > 64-bit value in octal, so 22 bytes max. > > But I guess just changing the two GFP_KERNEL's to GFP_ATOMIC is much simpler. > > Linus