From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753306AbdJGC2v (ORCPT ); Fri, 6 Oct 2017 22:28:51 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:40782 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753258AbdJGC2q (ORCPT ); Fri, 6 Oct 2017 22:28:46 -0400 Date: Sat, 7 Oct 2017 03:28:39 +0100 From: Al Viro To: Linus Torvalds Cc: Jia-Ju Bai , Jan Kara , Sagi Grimberg , james.smart@broadcom.com, "linux-ext4@vger.kernel.org" , linux-fsdevel , Linux Kernel Mailing List Subject: Re: [PATCH] ext2/super: Fix a possible sleep-in-atomic bug in parse_options Message-ID: <20171007022839.GP21978@ZenIV.linux.org.uk> References: <1507339246-13067-1-git-send-email-baijiaju1990@163.com> <20171007020217.GN21978@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171007020217.GN21978@ZenIV.linux.org.uk> User-Agent: Mutt/1.9.0 (2017-09-02) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 07, 2017 at 03:02:17AM +0100, Al Viro wrote: > > 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. > > There's match_strdup() as well... > > FWIW, ext2 side also looks fishy; it might be cleaner if we > collected new state into some object and applied it only after the last > possible failure exit. The entire "restore the original state" logics > would go away... I'm not saying that the bug had been introduced by conversion to spinlock, BTW - it was racy back when ext2_remount() relied upon BKL. I hadn't considered the atomicity issues back then - mea culpa...