From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZksaQ-0004eM-TA for mharc-grub-devel@gnu.org; Sat, 10 Oct 2015 07:45:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkoCL-0005gh-LK for grub-devel@gnu.org; Sat, 10 Oct 2015 03:04:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkoCF-00061k-NM for grub-devel@gnu.org; Sat, 10 Oct 2015 03:04:05 -0400 Received: from mail-lb0-x235.google.com ([2a00:1450:4010:c04::235]:36405) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkoCF-00061c-FO for grub-devel@gnu.org; Sat, 10 Oct 2015 03:03:59 -0400 Received: by lbcao8 with SMTP id ao8so102016822lbc.3 for ; Sat, 10 Oct 2015 00:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=Cr+v98nulHmpaI4cs6he0aMnHqSjZezQfIcWTihVteQ=; b=bj4LWmAHMH2E3NVY27wWSiv8MpJk+BHNOIu02b4onqiZNltGKDACG8LO6+cUPzBvvT MsSjwYP1yAAgwwclOwqcTc/tMQ9EZEuAcGGNASQLHX2Zdklwap1v9q4sNQJLuMVbBsAh wdy82RXxB1u8VUpTr+BKfMZX/WMVNXXHW83kYAx/WkdbTpI12ACu9hYu5dOZMTlqtANy ZvoZ3j7fwjjGNgpeyWZBgzpajnkD/5FobcDaOU2Udyob8lSXOc03A0RI+UJ06F+KvwcD iy7hUSd4rSOhcg63+UW9MyPz3PPDp2B9PdmzCdD+E4Zp3DZ3M8nRyOYwTOEzjqGli1Zf 9r3A== X-Received: by 10.25.24.224 with SMTP id 93mr5400513lfy.84.1444460638683; Sat, 10 Oct 2015 00:03:58 -0700 (PDT) Received: from [192.168.1.43] (ppp91-76-142-206.pppoe.mtu-net.ru. [91.76.142.206]) by smtp.gmail.com with ESMTPSA id j11sm944127lfe.24.2015.10.10.00.03.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Oct 2015 00:03:57 -0700 (PDT) Subject: Re: [PATCH] net: don't free uninitialized sockets in dns To: Josef Bacik References: <1439921023-3547412-1-git-send-email-jbacik@fb.com> <55D4B0A5.9060101@gmail.com> From: Andrei Borzenkov Message-ID: <5618B85C.4080603@gmail.com> Date: Sat, 10 Oct 2015 10:03:56 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <55D4B0A5.9060101@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::235 Cc: The development of GNU GRUB , kernel-team@fb.com X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Oct 2015 07:04:10 -0000 ping? 19.08.2015 19:36, Andrei Borzenkov пишет: > 18.08.2015 21:03, Josef Bacik пишет: >> If we cannot open a connection to our dns server we will have NULL >> sockets in >> our array, so don't do the cleanup on any sockets that didn't get >> created. >> > > We can avoid having holes to start with. Could you test attached patch? > >> Signed-off-by: Josef Bacik >> --- >> grub-core/net/dns.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/grub-core/net/dns.c b/grub-core/net/dns.c >> index 9d0c8fc..c356318 100644 >> --- a/grub-core/net/dns.c >> +++ b/grub-core/net/dns.c >> @@ -601,7 +601,10 @@ grub_net_dns_lookup (const char *name, >> grub_free (data.name); >> grub_netbuff_free (nb); >> for (j = 0; j < send_servers; j++) >> - grub_net_udp_close (sockets[j]); >> + { >> + if (sockets[j]) >> + grub_net_udp_close (sockets[j]); >> + } >> >> grub_free (sockets); >> >> >