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

Potential access after "free" #60

Closed
jovere opened this issue Feb 8, 2021 · 3 comments
Closed

Potential access after "free" #60

jovere opened this issue Feb 8, 2021 · 3 comments
Assignees
Labels
eth Ethernet-related issue or pull-request mw Middleware-related issue or pull-request. projects Projects-related (demos, applications, examples) issue or pull-request.
Milestone

Comments

@jovere
Copy link

jovere commented Feb 8, 2021

I don't have a full setup or reproduction of the issue, because I found it on a code review on a different project. It is in regards to the code linked below:

dmarxdesc = (ETH_DMADescTypeDef *)(dmarxdesc->Buffer2NextDescAddr);

From what I understand in the above linked code, the buffer is being "freed" back to the DMA on line 429 and then being accessed again on line 430. What would happen if a DMA interrupt were to occur between these two lines of code? It appears to me that this has the potential to point to the wrong buffer causing memory leaks or other issues. A safe version of lines 429-430 would be as follows:

    __IO ETH_DMADescTypeDef *next = (ETH_DMADescTypeDef *)(dmarxdesc->Buffer2NextDescAddr);
    dmarxdesc->Status |= ETH_DMARXDESC_OWN;
    dmarxdesc = next;

This code appares to be implemented in many other cube libraries as well.

@RKOUSTM RKOUSTM added the eth Ethernet-related issue or pull-request label Feb 9, 2021
@RKOUSTM
Copy link
Contributor

RKOUSTM commented Feb 10, 2021

Hi @jovere,

Thank you for contribution. It has been transferred to our technical teams. We will be back to you as soon as we get an answer. Thank you for you again for your contribution.

With regards

@RKOUSTM RKOUSTM added projects Projects-related (demos, applications, examples) issue or pull-request. mw Middleware-related issue or pull-request. labels Feb 10, 2021
@RKOUSTM RKOUSTM moved this from To do to Assigned in stm32cube-mcu-fw-dashboard Feb 10, 2021
@RKOUSTM
Copy link
Contributor

RKOUSTM commented Aug 4, 2021

Hi @jovere,

I hope you are fine. Sorry for the delay it may take sometimes to answer. The new version of the ETH HAL driver in the frame of a future release will take this update into consideration.

Thank you again for this contribution and thank you in advance for your patience. We will keep you informed.

With regards,

@RKOUSTM RKOUSTM moved this from Assigned to In progress in stm32cube-mcu-fw-dashboard Aug 4, 2021
@RKOUSTM
Copy link
Contributor

RKOUSTM commented Apr 4, 2022

Hi @jovere,

Thank you for your contribution. A reworked ETH HAL driver and an updated ethernetif.c file are now available in the frame of the STM32CubeF4 v1.27.0. This new ETH HAL driver breaks the compatibility with the previous one.

Please allow me then to close this issue. Thank you again for your contribution. We are looking forward to reading your feedback.

With regards,

@RKOUSTM RKOUSTM closed this as completed Apr 4, 2022
stm32cube-mcu-fw-dashboard automation moved this from In progress to Done Apr 4, 2022
@RKOUSTM RKOUSTM added this to the 1.27.0 milestone Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
eth Ethernet-related issue or pull-request mw Middleware-related issue or pull-request. projects Projects-related (demos, applications, examples) issue or pull-request.
Projects
Development

No branches or pull requests

2 participants