MQX 4.1.1. FTPSRV_init memory allocation

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX 4.1.1. FTPSRV_init memory allocation

Jump to solution
901 Views
CorderBollie
Contributor II

Hello.

I found an issue with the FTPSRV_init function of RTCS in MQX 4.1.1.

The function uses RTCS_mem_alloc_zero to allocate memory for its FTPSRV_STRUCT, the session pointer and session task ID's.

However if this function is called from a task (e.g. an initialization task) that runs out normally then the allocated memory is freed in _task_destroy.

Now, if an other task allocateds memory, it is possible that the session struct and semaphores are overwritten in memory while the ftp task is running.

This leads to exceptions in various other tasks that are using semaphores also because the LWSEM list of the kernel data is now broken.

To make a long story short, I think that FTPSRV_init should use RTCS_MEM_alloc_system_zero to allocate memory.

Labels (1)
Tags (2)
0 Kudos
1 Solution
632 Views
karelm_
Contributor IV

Hi,

this issue is already solved in MQX+SDK 1.1.0 release and fix will also be part of next MQX release (MQX 4.2).

Best regards,

Karel

View solution in original post

0 Kudos
3 Replies
632 Views
matthewkendall
Contributor V

In general, if you have an initialisation task that allocates memory or other objects, either directly or via calls to other modules, then it is a good idea not to let that initialisation task expire but to just call _task_block() at its conclusion.

0 Kudos
633 Views
karelm_
Contributor IV

Hi,

this issue is already solved in MQX+SDK 1.1.0 release and fix will also be part of next MQX release (MQX 4.2).

Best regards,

Karel

0 Kudos
632 Views
CorderBollie
Contributor II

Thats what I mean with a list of known issues.

It took two days for me to find that 'KNOWN' issue.

(List of known bugs/issues)

0 Kudos