# Re: \[PATCH v9\] module: replace module\_layout with module\_memory

- From: Thomas Gleixner \<hidden\>
- Date: 2023-02-07 10:13:46 
- List: linux-modules
- Page: https://ratatoskr.run/linux-modules/2023/02/2093526
- Thread: https://ratatoskr.run/linux-modules/2023/02/2090720/t.md

```text
On Mon, Feb 06 2023 at 23:27, Song Liu wrote:
>> On Feb 6, 2023, at 1:45 PM, Thomas Gleixner [ref] wrote:
>>> +static void free_mod_mem(struct module *mod)
>>> +{
>>> + /* free the memory in the right order to avoid use-after-free */
>> 
>> How do we end up with a UAF when the ordering is different?
>
> IIUC, we need remove MOD_DATA at last, which hosts "mod".

Oh. Please add a comment to that effect.

Thanks,

        tglx
```
