Skip to content

Commit 041309f

Browse files
committed
mptcp: pm: Return local variable instead of freed pointer
JIRA: https://issues.redhat.com/browse/RHEL-115576 Upstream Status: net-next.git commit def9d09 commit def9d09 Author: Thorsten Blum <thorsten.blum@linux.dev> Date: Sun Apr 13 11:34:34 2025 +0200 mptcp: pm: Return local variable instead of freed pointer Commit e4c28e3 ("mptcp: pm: move generic PM helpers to pm.c") removed an unnecessary if-check, which resulted in returning a freed pointer. This still works due to the implicit boolean conversion when returning the freed pointer from mptcp_remove_anno_list_by_saddr(), but it can be confusing and potentially error-prone. To improve clarity, add a local variable to explicitly return a boolean value instead. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20250413-net-next-mptcp-sched-mib-sft-misc-v2-3-0f83a4350150@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
1 parent 4190999 commit 041309f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/mptcp/pm.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,13 @@ bool mptcp_remove_anno_list_by_saddr(struct mptcp_sock *msk,
146146
const struct mptcp_addr_info *addr)
147147
{
148148
struct mptcp_pm_add_entry *entry;
149+
bool ret;
149150

150151
entry = mptcp_pm_del_add_timer(msk, addr, false);
152+
ret = entry;
151153
kfree(entry);
152-
return entry;
154+
155+
return ret;
153156
}
154157

155158
bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk)

0 commit comments

Comments
 (0)