Skip to content

Fix numerous nvme issues - see each commit#1743

Open
spbrogan wants to merge 4 commits intomicrosoft:release/202511from
spbrogan:fix_nvme_issues
Open

Fix numerous nvme issues - see each commit#1743
spbrogan wants to merge 4 commits intomicrosoft:release/202511from
spbrogan:fix_nvme_issues

Conversation

@spbrogan
Copy link
Copy Markdown
Member

@spbrogan spbrogan commented Apr 4, 2026

Description

Fix numerous nvme issues - see each commit.

fixes #1739, #1738, #1744

For details on how to complete these options and their meaning refer to CONTRIBUTING.md.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

Host based unit tests authored to show failure.
Host based unit tests passed after changes

Integration Instructions

None. Existing module.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release/202511@8178984). Learn more about missing BASE report.

Additional details and impacted files
@@                Coverage Diff                @@
##             release/202511    #1743   +/-   ##
=================================================
  Coverage                  ?    1.58%           
=================================================
  Files                     ?      634           
  Lines                     ?   232393           
  Branches                  ?      420           
=================================================
  Hits                      ?     3690           
  Misses                    ?   228688           
  Partials                  ?       15           
Flag Coverage Δ
MdeModulePkg 1.58% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@os-d
Copy link
Copy Markdown
Contributor

os-d commented Apr 4, 2026

Since this is not causing an active problem, can you take this directly to edk2? We can still review it there.

@spbrogan spbrogan force-pushed the fix_nvme_issues branch 2 times, most recently from 73dcd7f to dec896e Compare April 4, 2026 19:04
spbrogan added 4 commits April 4, 2026 12:07
…ate and protocol opens

Why this is a real bug:
After allocating Private via AllocateZeroPool (line ~1201) and successfully opening both gEfiDevicePathProtocolGuid and gEfiPciIoProtocolGuid BY_DRIVER, the function attempts PciIo->Attributes(EfiPciIoAttributeOperationGet, ...). If this call fails, the code executes return Status instead of goto Exit.

Trigger path:

NvmExpressDriverBindingStart is called.
OpenProtocol for DevicePath succeeds (opens BY_DRIVER).
OpenProtocol for PciIo succeeds (opens BY_DRIVER).
AllocateZeroPool for Private succeeds.
PciIo->Attributes(Get) returns an error.
return Status bypasses the Exit: label.
Why this is NOT a false positive:
The Exit: label at line ~1340 performs FreePool(Private), gBS->CloseProtocol(PciIo), and gBS->CloseProtocol(DevicePath). The direct return skips all of these. No other caller cleans up Private or closes the protocols.

Consequence:
Memory leak of NVME_CONTROLLER_PRIVATE_DATA. Two protocols remain opened BY_DRIVER on the controller handle, preventing other drivers from binding.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants