]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg: UefiPxeBcDxe: Add EXCLUSIVE attribute when opening SNP protocol installed...
authoredk2-devel-bounces@lists.01.org <edk2-devel-bounces@lists.01.org>
Fri, 14 Sep 2018 08:24:15 +0000 (16:24 +0800)
committerJiaxin Wu <Jiaxin.wu@intel.com>
Mon, 17 Sep 2018 06:32:35 +0000 (14:32 +0800)
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1152

v2: Sync the same logic to Ipv6 and update code comments.

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: Subramanian, Sriram <sriram-s@hpe.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c

index bc9dc914f3201996d3cb993f34b557b97f1d4121..0ab640becaf45c96daea38de57fb505598be4f6b 100644 (file)
@@ -814,7 +814,7 @@ PxeBcCreateIp4Children (
     }\r
 \r
     //\r
-    // Open SNP on the child handle BY_DRIVER. It will prevent any additionally\r
+    // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally\r
     // layering to perform the experiment.\r
     //\r
     Status = gBS->OpenProtocol (\r
@@ -823,7 +823,7 @@ PxeBcCreateIp4Children (
                     (VOID **) &Snp,\r
                     This->DriverBindingHandle,\r
                     Private->Ip4Nic->Controller,\r
-                    EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                    EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE\r
                     );\r
     if (EFI_ERROR (Status)) {\r
       goto ON_ERROR;\r
@@ -1157,7 +1157,7 @@ PxeBcCreateIp6Children (
     }\r
 \r
     //\r
-    // Open SNP on the child handle BY_DRIVER. It will prevent any additionally\r
+    // Open SNP on the child handle BY_DRIVER|EXCLUSIVE. It will prevent any additionally\r
     // layering to perform the experiment.\r
     //\r
     Status = gBS->OpenProtocol (\r
@@ -1166,7 +1166,7 @@ PxeBcCreateIp6Children (
                     (VOID **) &Snp,\r
                     This->DriverBindingHandle,\r
                     Private->Ip6Nic->Controller,\r
-                    EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                    EFI_OPEN_PROTOCOL_BY_DRIVER|EFI_OPEN_PROTOCOL_EXCLUSIVE\r
                     );\r
     if (EFI_ERROR (Status)) {\r
       goto ON_ERROR;\r