[#6641] ifconfig only frees the first page of tx_desc
Submitted By: Regis DARGENT
Open Date
2011-06-14 06:34:20
Priority:
Medium Assignee:
Sonic Zhang
Status:
Open Fixed In Release:
N/A
Found In Release:
2010R1-RC5 Release:
Category:
Networking Board:
N/A
Processor:
ALL Silicon Revision:
Is this bug repeatable?:
Yes Resolution:
Fixed
Uboot version or rev.:
Toolchain version or rev.:
4.3.5
App binary format:
N/A
Summary: ifconfig only frees the first page of tx_desc
Details:
When you call ifconfig <eth interface> down, only the first allocated page of the tx_desc is freed, causing memory leak.
In fact, bfin_mac_free (when CONFIG_BFIN_MAC_USE_L1 not defined), uses sizeof(ptr) to determine the number of bytes to be deallocated, which only reports the size of the first element in the case of a table. Therefore, only the page(s) corresponding to the size of one element are freed. In the case of a 10 elements table, each of size 1596 bytes, only the first 4kB page is freed instead of the 16kB allocated.
How to reproduce the bug:
a simple loop may do it:
while (1)
ifconfig eth0 up (with a valid IP)
wait for the interface to come up (eg 5sec)
ifconfig eth0 down
wait for the interface to come down (eg 5sec)
done
a proposed patch is attached.
Follow-ups
--- Sonic Zhang 2011-06-15 05:55:14
Thanks for the bug report. I commit a more unified patch other than put macro
around each free line.
Files
Changes
Commits
Dependencies
Duplicates
Associations
Tags
File Name File Type File Size Posted By
bfin_mac.c application/c 47023 Regis DARGENT