From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=fan.wang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3D328211300AE for ; Fri, 14 Sep 2018 00:40:08 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Sep 2018 00:40:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,372,1531810800"; d="scan'208";a="262547349" Received: from fanwang2-hp.ccr.corp.intel.com ([10.239.9.29]) by fmsmga005.fm.intel.com with ESMTP; 14 Sep 2018 00:38:42 -0700 From: Wang Fan To: edk2-devel@lists.01.org Cc: Ye Ting , Fu Siyuan , Wu Jiaxin Date: Fri, 14 Sep 2018 15:38:30 +0800 Message-Id: <20180914073830.2904-1-fan.wang@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 Subject: [Patch] NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed by PXE. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2018 07:40:09 -0000 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1152 The PXE driver installs a SNP and open this SNP with attribute BY_DRIVER to avoid it being opened by MNP driver, this SNP is also expected not to be opened by other drivers with EXCLUSIVE attribute. In some cases, other drivers may happen to do this by error, and thus cause a system crash. This patch adds EXCLUSIVE attribute when opening SNP in PXE driver, and will reject all OpenProtocol requests by EXCLUSIVE. Cc: Ye Ting Cc: Fu Siyuan Cc: Wu Jiaxin Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wang Fan --- NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c index bc9dc914f3..1a9671d373 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c @@ -821,11 +821,11 @@ PxeBcCreateIp4Children ( Private->Ip4Nic->Controller, &gEfiSimpleNetworkProtocolGuid, (VOID **) &Snp, This->DriverBindingHandle, Private->Ip4Nic->Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER + EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE ); if (EFI_ERROR (Status)) { goto ON_ERROR; } } -- 2.16.2.windows.1