aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2022-05-25 21:36:19 -0700
committerJakub Kicinski <kuba@kernel.org>2022-05-25 21:36:20 -0700
commit1679ea99bcfa8c68518b04c87992b2b2fc096513 (patch)
treebe36a6ae8030157e48a946e6363217a83b7406eb
parentMerge tag 'net-next-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next (diff)
parentamt: fix possible memory leak in amt_rcv() (diff)
Merge branch 'amt-fix-several-bugs'
Taehee Yoo says: ==================== amt: fix several bugs This patchset fixes several bugs in amt module First patch fixes typo. Second patch fixes wrong return value of amt_update_handler(). A relay finds a tunnel if it receives an update message from the gateway. If it can't find a tunnel, amt_update_handler() should return an error, not success. But it always returns success. Third patch fixes a possible memory leak in amt_rcv(). A skb would not be freed if an amt interface doesn't have a socket. ==================== Link: https://lore.kernel.org/r/20220523161708.29518-1-ap420073@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/amt.c6
-rw-r--r--include/net/amt.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/amt.c b/drivers/net/amt.c
index de4ea518c793..ebee5f07a208 100644
--- a/drivers/net/amt.c
+++ b/drivers/net/amt.c
@@ -57,7 +57,7 @@ static char *type_str[] = {
"AMT_MSG_MEMBERSHIP_QUERY",
"AMT_MSG_MEMBERSHIP_UPDATE",
"AMT_MSG_MULTICAST_DATA",
- "AMT_MSG_TEARDOWM",
+ "AMT_MSG_TEARDOWN",
};
static char *action_str[] = {
@@ -2423,7 +2423,7 @@ static bool amt_update_handler(struct amt_dev *amt, struct sk_buff *skb)
}
}
- return false;
+ return true;
report:
iph = ip_hdr(skb);
@@ -2679,7 +2679,7 @@ static int amt_rcv(struct sock *sk, struct sk_buff *skb)
amt = rcu_dereference_sk_user_data(sk);
if (!amt) {
err = true;
- goto out;
+ goto drop;
}
skb->dev = amt->dev;
diff --git a/include/net/amt.h b/include/net/amt.h
index 7a4db8b903ee..0e40c3d64fcf 100644
--- a/include/net/amt.h
+++ b/include/net/amt.h
@@ -15,7 +15,7 @@ enum amt_msg_type {
AMT_MSG_MEMBERSHIP_QUERY,
AMT_MSG_MEMBERSHIP_UPDATE,
AMT_MSG_MULTICAST_DATA,
- AMT_MSG_TEARDOWM,
+ AMT_MSG_TEARDOWN,
__AMT_MSG_MAX,
};