Received: from list by lists.gnu.org with archive (Exim 4.71) id 1eDGxp-00048J-99 for mharc-grub-devel@gnu.org; Fri, 10 Nov 2017 16:35:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39068) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDGxn-00048C-Ss for grub-devel@gnu.org; Fri, 10 Nov 2017 16:35:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eDGxk-0006Rw-PF for grub-devel@gnu.org; Fri, 10 Nov 2017 16:35:47 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:38111) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eDGxk-0006Q9-Gt for grub-devel@gnu.org; Fri, 10 Nov 2017 16:35:44 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vAALZZNQ022634 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 Nov 2017 21:35:35 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id vAALZYef013938 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 Nov 2017 21:35:35 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id vAALZYRC010815; Fri, 10 Nov 2017 21:35:34 GMT Received: from olila.local.net-space.pl (/10.175.242.8) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 10 Nov 2017 13:35:34 -0800 Date: Fri, 10 Nov 2017 22:35:30 +0100 From: Daniel Kiper To: Eric Snowberg Cc: The development of GNU GRUB , "Vladimir 'phcoder' Serbinenko" Subject: Re: [PATCH] ls: prevent double open Message-ID: <20171110213530.GQ12877@olila.local.net-space.pl> References: <1508184672-164532-1-git-send-email-eric.snowberg@oracle.com> <20171017132224.GU7593@olila.local.net-space.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0022.oracle.com [156.151.31.74] Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by userp1040.oracle.com id vAALZZNQ022634 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 156.151.31.81 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Nov 2017 21:35:48 -0000 On Wed, Oct 18, 2017 at 10:30:37AM -0600, Eric Snowberg wrote: > > On Oct 17, 2017, at 7:22 AM, Daniel Kiper w= rote: > > On Mon, Oct 16, 2017 at 01:11:12PM -0700, Eric Snowberg wrote: > >> Prevent a double open. This can cause problems with some ieee1275 > >> devices, causing the system to hang. The double open can occur > >> as follows: > >> > >> grub_ls_list_files (char *dirname, int longlist, int all, int human) > >> dev =3D grub_device_open (device_name); > >> dev remains open while: > >> grub_normal_print_device_info (device_name); > >> dev =3D grub_device_open (name); > >> > >> Signed-off-by: Eric Snowberg > > > > In general LGTM. One nitpick... > > > >> --- > >> grub-core/commands/ls.c | 2 ++ > >> 1 files changed, 2 insertions(+), 0 deletions(-) > >> > >> diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c > >> index 0eaf836..a7318ab 100644 > >> --- a/grub-core/commands/ls.c > >> +++ b/grub-core/commands/ls.c > >> @@ -201,6 +201,8 @@ grub_ls_list_files (char *dirname, int longlist,= int all, int human) > >> if (grub_errno =3D=3D GRUB_ERR_UNKNOWN_FS) > >> grub_errno =3D GRUB_ERR_NONE; > >> > >> + grub_device_close (dev); > >> + dev =3D NULL; > > > > I would put a comment before why it is needed. > > > > Ok, I=E2=80=99ll add a comment and submit a V2. I was going to apply this today but have not found v2... :-((( If you post it I will apply it immediately. Daniel