-
Notifications
You must be signed in to change notification settings - Fork 92
fix BO offset and size check #956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Max Zhen <max.zhen@amd.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a buffer overflow validation issue in the AMDXDNA driver's sync_bo ioctl handler. The original check was insufficient to prevent integer overflow when adding offset and size.
Key Changes:
- Enhanced validation in
amdxdna_drm_sync_bo_ioctlto check offset and size individually before checking their sum - Added guards against integer overflow in buffer bounds validation
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (gobj->size < args->offset + args->size) { | ||
| if (gobj->size < args->offset || | ||
| gobj->size < args->size || | ||
| args->offset > gobj->size - args->size) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor, just to keep this line consistent to the above two lines, maybe change it to gobj->size < args->offset + args->size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is done to avoid overflow from args->offset + args->size. gobj->size - args->size is safe since line 1215 has done the check.
No description provided.