Received: from list by lists.gnu.org with archive (Exim 4.71) id 1eIFqj-000635-5S for mharc-grub-devel@gnu.org; Fri, 24 Nov 2017 10:25:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIFqg-00062A-OF for grub-devel@gnu.org; Fri, 24 Nov 2017 10:25:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIFqd-0005YN-Hk for grub-devel@gnu.org; Fri, 24 Nov 2017 10:25:02 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:45469) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eIFqd-0005Y0-Aa for grub-devel@gnu.org; Fri, 24 Nov 2017 10:24:59 -0500 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vAOFOutV010507 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 24 Nov 2017 15:24:57 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id vAOFOulF020518 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 24 Nov 2017 15:24:56 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 vAOFOtb3024695 for ; Fri, 24 Nov 2017 15:24:56 GMT Received: from olila.local.net-space.pl (/10.175.176.116) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 24 Nov 2017 07:24:55 -0800 Date: Fri, 24 Nov 2017 16:24:51 +0100 From: Daniel Kiper To: Eric Snowberg Cc: The development of GNU GRUB Subject: Re: [PATCH v2] ls: prevent double open Message-ID: <20171124152451.GR12877@olila.local.net-space.pl> References: <1510590448-182206-1-git-send-email-eric.snowberg@oracle.com> <20171121132012.GI12877@olila.local.net-space.pl> <0B217BB5-37E9-4C16-BDA0-4CEDD3D90E53@oracle.com> <20171123151940.GQ12877@olila.local.net-space.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20171123151940.GQ12877@olila.local.net-space.pl> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0021.oracle.com [156.151.31.71] Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by aserp1040.oracle.com id vAOFOutV010507 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 141.146.126.69 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, 24 Nov 2017 15:25:04 -0000 On Thu, Nov 23, 2017 at 04:19:40PM +0100, Daniel Kiper wrote: > On Tue, Nov 21, 2017 at 03:24:38PM -0700, Eric Snowberg wrote: > > > On Nov 21, 2017, at 6:20 AM, Daniel Kiper = wrote: > > > On Mon, Nov 13, 2017 at 08:27:28AM -0800, 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 huma= n) > > >> 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 > > >> --- > > >> changes from v1: > > >> - Added comment > > >> --- > > >> grub-core/commands/ls.c | 4 ++++ > > >> 1 files changed, 4 insertions(+), 0 deletions(-) > > >> > > >> diff --git a/grub-core/commands/ls.c b/grub-core/commands/ls.c > > >> index 0eaf836..fcbb3da 100644 > > >> --- a/grub-core/commands/ls.c > > >> +++ b/grub-core/commands/ls.c > > >> @@ -201,6 +201,10 @@ grub_ls_list_files (char *dirname, int longli= st, int all, int human) > > >> if (grub_errno =3D=3D GRUB_ERR_UNKNOWN_FS) > > >> grub_errno =3D GRUB_ERR_NONE; > > >> > > >> + /* Close device to prevent a double open in > > >> + grub_normal_print_device_info. */ > > >> + grub_device_close (dev); > > >> + dev =3D NULL; > > > > > > Are you OK if I put above between "#ifdef GRUB_MACHINE_IEEE1275" an= d "#endif=E2=80=9D? > > > > I suppose you could add that. > > Great! > > > Is this patch causing problems on a different platform? > > Nope, but I would like to be on safe side. So, I will add it and push. Pushed! Daniel