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.24; helo=mga09.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 BCA6F21962301 for ; Mon, 22 Oct 2018 19:25:18 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Oct 2018 19:25:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,414,1534834800"; d="scan'208";a="83342788" Received: from ray-dev.ccr.corp.intel.com ([10.239.9.11]) by orsmga007.jf.intel.com with ESMTP; 22 Oct 2018 19:25:16 -0700 From: Ruiyu Ni To: edk2-devel@lists.01.org Cc: Star Zeng Date: Tue, 23 Oct 2018 10:26:30 +0800 Message-Id: <20181023022630.121580-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.16.1.windows.1 Subject: [PATCH] MdeModulePkg/UsbMass: Fix USB key write failure 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: Tue, 23 Oct 2018 02:25:18 -0000 Commit e59db6a732dbbb064b1e39a288a25edc90adac5d * MdeModulePkg/UsbMass: Merge UsbBoot(Read|Write)Blocks(16) introduces a bug that causes writing to USB key always fails. When that patch is verified, only reading was verified. The root cause is when the writing operation is performed, the data direction EfiUsbDataIn is wrongly used. Instead, it should be EfiUsbDataOut. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Star Zeng --- MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c index c35c7bdc12..69e2252134 100644 --- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c +++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c @@ -861,7 +861,7 @@ UsbBootReadWriteBlocks ( UsbMass, &Cmd, (UINT8) sizeof (USB_BOOT_READ_WRITE_10_CMD), - EfiUsbDataIn, + Write ? EfiUsbDataOut : EfiUsbDataIn, Buffer, ByteSize, Timeout @@ -941,7 +941,7 @@ UsbBootReadWriteBlocks16 ( UsbMass, Cmd, (UINT8) sizeof (Cmd), - EfiUsbDataIn, + Write ? EfiUsbDataOut : EfiUsbDataIn, Buffer, ByteSize, Timeout -- 2.16.1.windows.1