MQX 4.1.1. FTPSRV_init memory allocation

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MQX 4.1.1. FTPSRV_init memory allocation

跳至解决方案
1,926 次查看
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.

标签 (1)
标记 (2)
0 项奖励
回复
1 解答
1,657 次查看
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 项奖励
回复
3 回复数
1,657 次查看
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 项奖励
回复
1,658 次查看
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 项奖励
回复
1,657 次查看
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 项奖励
回复