Skip to content

Fix crash when ending an update for an unassigned device - #702

Open
shubham-x06 wants to merge 1 commit into
p4lang:mainfrom
shubham-x06:fix-update-device-end-unassigned
Open

shubham-x06 wants to merge 1 commit into
p4lang:mainfrom
shubham-x06:fix-update-device-end-unassigned

Conversation

@shubham-x06

@shubham-x06 shubham-x06 commented Nov 24, 2026 •

Copy link
Copy Markdown

description

This change checks whether a device is assigned before ending a config update in pi_update_device_end and __pi_update_device_end. If the device is not assigned, it returns PI_STATUS_DEV_NOT_ASSIGNED instead of crashing (e.g., null pointer dereference on target backends like BMv2). It also adds a regression test to verify the behavior and fixes a command name typo in the CLI help text for update_device_end.

scope

  • Added device assignment check in pi_update_device_end in src/pi.c to return PI_STATUS_DEV_NOT_ASSIGNED when the device is not assigned
  • Added device assignment check in __pi_update_device_end in src/pi_rpc_server.c
  • Added a regression test case FrontendGeneric_UpdateDeviceUnassigned.End in tests/frontends/generic/test.c
  • Fixed help string typo in update_device_end_hs in CLI/device_commands.c

Fixes #701

Checks whether a device is assigned before ending an update in pi_update_device_end and the RPC server handler, returning PI_STATUS_DEV_NOT_ASSIGNED if not assigned instead of causing a crash. Also fixes a typo in CLI update_device_end_hs and adds a regression test case.

Closes p4lang#701

Signed-off-by: Shubham <shubhammittal0610@proton.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix crash when ending an update for an unassigned device

1 participant