Skip to content
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

providers/irdma: Validate input before memory window bind #1107

Merged
merged 1 commit into from
Jan 27, 2022

Conversation

Sindhu-Devale
Copy link
Contributor

@Sindhu-Devale Sindhu-Devale commented Dec 9, 2021

Check for a non null MR, address and length
before allowing bind operation.

Also, add check to make sure the MR and MW are in
same PD before posting a bind MW op.

Fixes: 14a0fc8 ("rdma-core/irdma: Implement device supported verb APIs")
Signed-off-by: Tatyana Nikolova tatyana.e.nikolova@intel.com
Signed-off-by: Sindhu-Devale sindhu.devale@intel.com

return EINVAL;

if (bind_info->mr) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Why do we need these checks in user-space and not in the driver?
    It is preferable to have one place for the checks and drivers are supposed to have these type of checks anyway.
  2. I imagine almost all drivers need these checks. Why irdma is special here?
  3. You have double SOB for Tatyana in the commit message.
    Signed-off-by: Signed-off-by: Tatyana Nikolova tatyana.e.nikolova@intel.com

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Why do we need these checks in user-space and not in the driver?
    It is preferable to have one place for the checks and drivers are supposed to have these type of checks anyway.
  2. I imagine almost all drivers need these checks. Why irdma is special here?
  3. You have double SOB for Tatyana in the commit message.
    Signed-off-by: Signed-off-by: Tatyana Nikolova tatyana.e.nikolova@intel.com

Hi Leon - Thanks for the review. Sindhu is out for the rest of the year. And will work on these review comments when she is back on Jan 4th.

Shiraz

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bind isn't supposed to call to the kernel, but perhaps the checkes should be done in the core rdma-core code..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will send out a patch. Thanks Jason/Leon.

Copy link
Member

@jgunthorpe jgunthorpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address Leon's remarks

irdma does not do proper input validation checks on the
memory window bind. Specifically, the checks for non-null MR,
address and length as well as one to ensure MR and MW are
in same PD are missing.

Fix this by moving these checks to core code and remove it
from providers rxe, hns, mlx5 and irdma too.

Fixes: 14a0fc8 ("rdma-core/irdma: Implement device supported verb APIs")
Signed-off-by: Sindhu-Devale <sindhu.devale@intel.com>
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
@Sindhu-Devale Sindhu-Devale force-pushed the libirdma-12-9-fixes branch 2 times, most recently from 67ef6ce to a83619b Compare January 25, 2022 19:14
@rleon
Copy link
Member

rleon commented Jan 26, 2022

Looks good, if no one complains, I will merge it tomorrow, before rdma-core release.

Thanks

@rleon rleon merged commit ebbdb85 into linux-rdma:master Jan 27, 2022
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.

4 participants