Re: [PATCH net v2 2/2] ax25: fix potential reference counting leak in ax25_addr_ax25dev
From: Markus Elfring <hidden>
Date: 2024-05-03 07:36:31
Also in:
kernel-janitors, linux-hams, lkml
From: Markus Elfring <hidden>
Date: 2024-05-03 07:36:31
Also in:
kernel-janitors, linux-hams, lkml
How do you think about to append parentheses to the function name in the summary phrase?
The reference counting of ax25_dev potentially increase more than once in ax25_addr_ax25dev(), which will cause memory leak. In order to fix the above issue, only increase the reference counting of ax25_dev once, when the res is not null.
Would you find the following change description a bit nicer? The reference counter of the object “ax25_dev” can be increased multiple times in ax25_addr_ax25dev(). This will cause a memory leak so far. Thus move a needed function call behind a for loop and increase the reference counter only when the local variable “res” is not a null pointer. …
+++ b/net/ax25/ax25_dev.c@@ -37,8 +37,9 @@ ax25_dev *ax25_addr_ax25dev(ax25_address *addr)
… Would you like to omit curly brackets in the affected function implementation? Regards, Markus