From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web09.2544.1605305535994441946 for ; Fri, 13 Nov 2020 14:12:16 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GbpMEmwq; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605305535; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FmRlXyar8HJb2XiOljX3FKYHL/ptLkB0HbrrxUgo5S8=; b=GbpMEmwq0R/qt1YCxwx1DTWEIfiSi/G1o3V7nUKaEVja0W2ZOt3DgenSolN5z9QDftCqpE 4kdtqvoxIJAlLoHmd/SRddUUZhbabHYrzEGUrlxg+QND5ypxf2daO9yqqeVjs7Jr9oc6hu Q8Zh8SnBtha/uN/uNXvJ9vzVHdiYR5I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-457-W-qeNApKPyab6cY8VasDVQ-1; Fri, 13 Nov 2020 17:12:11 -0500 X-MC-Unique: W-qeNApKPyab6cY8VasDVQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6C950801FDD; Fri, 13 Nov 2020 22:12:10 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-113.ams2.redhat.com [10.36.112.113]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DE23385; Fri, 13 Nov 2020 22:12:09 +0000 (UTC) Subject: Re: [edk2-devel] NULL Pointer Check is needed for InternalImageHandleToFvHandle of DxeServicesLib To: devel@edk2.groups.io, weihao.cai@intel.com Cc: "Dong, Jun Z" References: From: "Laszlo Ersek" Message-ID: Date: Fri, 13 Nov 2020 23:12:08 +0100 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit On 11/13/20 10:08, Cai, Weihao wrote: > Hi EDK2 Dev, > > We met a system hang issue recently and after investigation, it was caused by invalid data returned by "InternalImageHandleToFvHandle" of DxeServicesLib. > > We call GetSectionFromAnyFv-> InternalImageHandleToFvHandle to get handle. > But InternalImageHandleToFvHandle cannot locate LoadedImageProtocol (This is expected). The returned status is "Invalid Parameter" and "LoadedImage" pointer is NULL. > The problem is InternalImageHandleToFvHandle does not check returned status or "LoadedImage" pointer, just return "LoadedImage->DeviceHandle". > Since "LoadedImage" pointer is NULL, "LoadedImage->DeviceHandle" is invalid handle (random data, but not NULL) which cause system hang. > > I think InternalImageHandleToFvHandle should check returned status or "LoadedImage" pointer. If it is failed, just return NULL, not any random data. > [cid:image001.jpg@01D6B9DF.9634B310] > > Best Regards > Rick Cai Please file a new ticket at with this information, and please consider submitting a patch to the mailing list for review. Please talk to your colleagues about the expected git settings in your edk2 clone, and the patch submission process. Thanks Laszlo