Memory leak phenomenon from FMAC driver

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
YoTa_1693656
Level 6
Level 6
Distributor - Marubun (Japan)
250 replies posted 250 sign-ins 100 replies posted

Hello, Infineon/Cypress team

[Issue]

We are evaluating below FMAC driver below to use CYW43455. The FMAC driver occurs memory leak.

https://community.cypress.com/docs/DOC-21490

memory_leak.jpg

[Test Procedure]

kernel version: 4.14.78

for i in `seq 1 100`

do

top -n 1

  insmod compat.ko

  insmod cfg80211.ko

  insmod brcmutil.ko

  insmod brcmfmac.ko

sleep 1

  rmmod brcmfmac

  rmmod brcmutil

  rmmod brcm80211

  rmmod cfg80211

  rmmod compat

done

[Consideration]

Under our investigation, we narrow down two suspected locations to cause a memory leak.

1)

<cypress-fmac-v5.4.18-2020_0925\v5.4.18-backportscompat\backport-genetlink.c>

Line 230:

ops = kzalloc(sizeof(*ops) * (family->n_ops + 1), GFP_KERNEL);

2)

"backport_x509_cert_parse" in compat.ko

[Need Help]

Can Cypress fix this memory leak phenomenon?

We are happy if Cypress(Infineon) provides us a fixed patch for the FMAC source code.

Thanks,

Yoshinori

0 Likes
4 Replies
GauravS_31
Moderator
Moderator
Moderator
10 questions asked 250 solutions authored 250 sign-ins

We will investigate the memory leak phenomenon in the latest driver release. Thank you for sharing your observations. Did you use mallinfo to measure the memory consumption?

0 Likes
YoTa_1693656
Level 6
Level 6
Distributor - Marubun (Japan)
250 replies posted 250 sign-ins 100 replies posted

Hello Gaurav-san

>Did you use mallinfo to measure the memory consumption?

No, we did not. To measure it, we used the following feature included the Linux kernel.

$ make menuconfig

'-> Kernel hacking

->Kernel memory leak detector

->Simple test for the kernel memory leak detector

By the way, regarding 1), we guess the following additional code is necessary to fix.

<cypress-fmac-v5.4.18-2020_0925\v5.4.18-backportscompat\backport-genetlink.c>

int backport_genl_unregister_family(struct genl_family *family)

{

+ if (family->copy_ops) {

+ kfree(family->copy_ops);

+ }

:

How do you think?

Thanks,

Yoshinori

0 Likes
lock attach
Attachments are accessible only for community members.
YoTa_1693656
Level 6
Level 6
Distributor - Marubun (Japan)
250 replies posted 250 sign-ins 100 replies posted

Hello Gaurav-san

Regarding 1)

We resolved the memory leak by attachment patch at our site. please review the patch.

Regarding 2)

Under our investigation, the memory leak occurs at "backport_x509_cert_parse" object. The estimated amount is 128B.

If it's difficult to fix this issue, let me know that.

Thanks,

Yoshinori

0 Likes
lock attach
Attachments are accessible only for community members.
YoTa_1693656
Level 6
Level 6
Distributor - Marubun (Japan)
250 replies posted 250 sign-ins 100 replies posted

Hello Gaurav-san

Regarding 2)

We could fix the memory leak in "backport_x509_cert_parse" by attachment "free-X509_cert_parse-compat.patch".

Thus, now, our request is very simple. Could you review attachment patches?

(If you think those patches are no problem, I close this thread.)

Thanks,

Yoshinori

0 Likes