hello:
In embedded devices with relatively small memory, if the transfer speed of ncm is fast and other programs occupy CPU memory, it is likely that the return value ncm ->skd_tx_data of alloc_skb() is NULL, and the code is likely to enter err. If skb2 is not processed in err, it will cause memory leakage.
Thank you.
nanfengwq@xxxxxxxx
From: gregkhDate: 2024-05-19 22:37Subject: Re: memory leakage in ncm_wrap_ntb() in USB ncm mode with kernel 5.15On Sun, May 19, 2024 at 10:23:10PM +0800, nanfengwq@xxxxxxxx wrote:> Hello:> I have discovered a risk of memory leakage in ncm_wrap_ntb() under USB ncm mode in kernel 5.15, and I have fixed it.> Please help me review it.>> If this modification is effective, it can also be integrated into other kernel versions, such as kernel 4.14, and so on.>> The logic of a memory leak is as follows:>> If the return value skb2 of package_for_tx() is not NULL, and the return value ncm->skb_tx_data of alloc_skb() is NULL, then the code will go to err, where there is no processing of skb2, resulting in a memory leak in skb2.>>> Thank you.>>>>Hi,This is the friendly patch-bot of Greg Kroah-Hartman. You have sent hima patch that has triggered this response. He used to manually respondto these common problems, but in order to save his sanity (he keptwriting the same thing over and over, yet to different people), I wascreated. Hopefully you will not take offence and will fix the problemin your patch and resubmit it so that it can be accepted into the Linuxkernel tree.You are receiving this message because of the following common error(s)as indicated below:- Your patch did not apply to any known trees that Greg is in controlof. Possibly this is because you made it against Linus's tree, notthe linux-next tree, which is where all of the development for thenext version of the kernel is at. Please refresh your patch againstthe linux-next tree, or even better yet, the development treespecified in the MAINTAINERS file for the subsystem you are submittinga patch for, and resend it.- You did not specify a description of why the patch is needed, orpossibly, any description at all, in the email body. Please read thesection entitled "The canonical patch format" in the kernel file,Documentation/process/submitting-patches.rst for what is needed inorder to properly describe the change.- You did not write a descriptive Subject: for the patch, allowing Greg,and everyone else, to know what this patch is all about. Please readthe section entitled "The canonical patch format" in the kernel file,Documentation/process/submitting-patches.rst for what a properSubject: line should look like.- It looks like you did not use your "real" name for the patch on eitherthe Signed-off-by: line, or the From: line (both of which have tomatch). Please read the kernel file,Documentation/process/submitting-patches.rst for how to do thiscorrectly.If you wish to discuss this problem further, or you have questions abouthow to resolve this issue, please feel free to respond to this email andGreg will reply once he has dug out from the pending patches receivedfrom other developers.thanks,greg k-h's patch email bot
Attachment:
0001-USB-NCM-mode-There-is-a-memory-leak.patch
Description: Binary data