From patchwork Mon May 23 16:17:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taehee Yoo X-Patchwork-Id: 12859259 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AE63C433FE for ; Mon, 23 May 2022 16:17:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238739AbiEWQRp (ORCPT ); Mon, 23 May 2022 12:17:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238793AbiEWQRb (ORCPT ); Mon, 23 May 2022 12:17:31 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8364D66C93 for ; Mon, 23 May 2022 09:17:21 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id n10so14497713pjh.5 for ; Mon, 23 May 2022 09:17:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iPgV0XKVA7CN/1GtqSgXFmgmjxLYIDCCIxwiYiTCOt0=; b=oGs4qQZexHkc7tfWnkq4TqIJjsY3Oh66/ArhUO2nd4WliRSG3+JpFmk51aTDd777OL OYfZ/DTIw8HFfY+Smu9yUqqJmZRPPrjEDVP32HVFHPzgrN8PH5Yyb8pG4pL6DIXVJmvw e/m/6Cw6yo6dGji9llesX/A6PMSNsmfqxtTU2W/mqsRRygII9IrdLUB7LQrG/8fGWY1V ntWFszzQvZfixC3hDUsV/9JxhW2whatl9SITh00Woo9dllFA4JeDlNmR5SEQP9M2kDw0 NXMRAqZAyhmYOu+Za68z2oNP0h0iRXzq6AYF3d5vRgQxiVBVlRXpK2kPYVa71iq8jTFj Dg9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iPgV0XKVA7CN/1GtqSgXFmgmjxLYIDCCIxwiYiTCOt0=; b=DIkerCSb9+S4f2GQj0gUFnt2R6/3ICKh9faq7h2xpdtuwZYlWa1oJdxPxfU74ncaTm MG17h2b/LnUWgQAxgb6/NvI36sAaoWBzghhzCif4YLTMDswmsR3+cVxYv1h0DNFuZ65i HtVW7x6o9tcadn1hGjHlO2GkCLEjn1g+42TATnlye3YyrnZHpmD15m6b0i6yGIDq70SB 6kv3iyCzM4s8EnaR6i0omSA/gRKZTiJRvwfIcXRTtUecvldtfELdepOE8wgS5Hjgd9Em 8mp9zOjw4KUwX+MgWLyBu5nBuBhxvnl/mSUTzH2CTEvco+dpfOgQNfbW9923KkNwYp1G ORnw== X-Gm-Message-State: AOAM533YXSGbxCLE3LiJeOywSG1sBUGZrSDdvKtqBxmtYKBWHx2FP7fm Mj7n9QBJamiMBoZjjCbAAVo= X-Google-Smtp-Source: ABdhPJx1pYp5LHavbro1zZvs7qudPnaTDzarZ6Fpxb/roTJAegw8W3JKKY6vLBADitBwYTRSuVrLyw== X-Received: by 2002:a17:90b:1c92:b0:1dd:10ff:8f13 with SMTP id oo18-20020a17090b1c9200b001dd10ff8f13mr27048505pjb.54.1653322640606; Mon, 23 May 2022 09:17:20 -0700 (PDT) Received: from localhost.localdomain ([182.213.254.91]) by smtp.gmail.com with ESMTPSA id c8-20020a170902c2c800b0015e8d4eb2ccsm5252127pla.278.2022.05.23.09.17.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 09:17:20 -0700 (PDT) From: Taehee Yoo To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: ap420073@gmail.com Subject: [PATCH net 1/3] amt: fix typo in amt Date: Mon, 23 May 2022 16:17:06 +0000 Message-Id: <20220523161708.29518-2-ap420073@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220523161708.29518-1-ap420073@gmail.com> References: <20220523161708.29518-1-ap420073@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org AMT_MSG_TEARDOWM is defined, But it should be AMT_MSG_TEARDOWN. Fixes: b9022b53adad ("amt: add control plane of amt interface") Signed-off-by: Taehee Yoo --- drivers/net/amt.c | 2 +- include/net/amt.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/amt.c b/drivers/net/amt.c index de4ea518c793..f41668ddd94a 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[] = { 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, }; From patchwork Mon May 23 16:17:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taehee Yoo X-Patchwork-Id: 12859261 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA202C433EF for ; Mon, 23 May 2022 16:17:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238748AbiEWQRs (ORCPT ); Mon, 23 May 2022 12:17:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238796AbiEWQRb (ORCPT ); Mon, 23 May 2022 12:17:31 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1AAA66F92 for ; Mon, 23 May 2022 09:17:23 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id x12so14082678pgj.7 for ; Mon, 23 May 2022 09:17:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xyBPWf3AN19Kx98veRFzdwWoDGnFy6v28BCT/4ZU3/o=; b=SmGIT4CCRy/LiSzLIDzLRa+mM3Uy5hJDzrWwQ1+9Znf17p8GqzVaU9CRbRrvaTGqZ2 3HJZbeEjs2jABru3iy92332p2UxsErO+Ng+NSDK82xlJ3PpjgzojoZFx/mvYhHDPBT3n hQUqdZSHdLp3qbE5tFQD651NgxpFq9soYLfwxbmY3d8IAQP1K2lbNxCrhz07ATqEQMP3 rz2BfMgaece0P/59Na9ioVF1kiQ7ikX4SEArZEwDWRV1+DkaG8kf8rRzo7DVTMuwLgJC IVLfElPiut2H89L/awmqIYZ1fPgRUNNAHcQ68FeWsXUbNcwKaj+WZT+Lm+tJWvf6esLH Lq9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xyBPWf3AN19Kx98veRFzdwWoDGnFy6v28BCT/4ZU3/o=; b=bT/aY5J7mRXPYdKh4P6Nqbnln0g9BAB/OfsrvQVtZ6LcIeelb6ZxRPztZ37G9Z2Kx6 ff3QcM87GDx8fGQeLooDTrUKBI+CwT5zbU7tf1a6l1W2QnuLB3PoeRS1d9PcnsWjUq2s p4QRCqkMR+JiGyl5iBO2i/cTeb3UbSboZfrAWC1UB1NDXHQMtmdRqQgRkO+o43Z1dn4H 9F4pjHHNSTWVSApwmVJNF6ykaADIHobFxnUaL1JyYy7Rdwpp58p5R1u0orEmCtKkksEt dfSo9gYHs/0QCzbz33eLuza/QU4hzv/nns5pzYN69ikVTJNmY85VN4P18UtTbvH4FGEY c6sw== X-Gm-Message-State: AOAM530oS9SijbhSo1zIcNiST+zjnWIlbE2gx1r/lPCeMQ164K60nBLm kdu9625rLgtmzLHshKbEO2w= X-Google-Smtp-Source: ABdhPJwG3h83gjJzYaXBn8E9O0DFb9WB6FGz+hg+jqMFot8DsdtDnNU2oUUwbCilhMNBf/JLBi5oUw== X-Received: by 2002:a62:8686:0:b0:518:29a8:93b5 with SMTP id x128-20020a628686000000b0051829a893b5mr24132242pfd.71.1653322643273; Mon, 23 May 2022 09:17:23 -0700 (PDT) Received: from localhost.localdomain ([182.213.254.91]) by smtp.gmail.com with ESMTPSA id c8-20020a170902c2c800b0015e8d4eb2ccsm5252127pla.278.2022.05.23.09.17.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 09:17:22 -0700 (PDT) From: Taehee Yoo To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: ap420073@gmail.com Subject: [PATCH net 2/3] amt: fix return value of amt_update_handler() Date: Mon, 23 May 2022 16:17:07 +0000 Message-Id: <20220523161708.29518-3-ap420073@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220523161708.29518-1-ap420073@gmail.com> References: <20220523161708.29518-1-ap420073@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org If a relay receives an update message, it lookup a tunnel. and if there is no tunnel for that message, it should be treated as an error, not a success. But amt_update_handler() returns false, which means success. Fixes: cbc21dc1cfe9 ("amt: add data plane of amt interface") Signed-off-by: Taehee Yoo --- drivers/net/amt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/amt.c b/drivers/net/amt.c index f41668ddd94a..635de07b2e40 100644 --- a/drivers/net/amt.c +++ b/drivers/net/amt.c @@ -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); From patchwork Mon May 23 16:17:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taehee Yoo X-Patchwork-Id: 12859260 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C773C433EF for ; Mon, 23 May 2022 16:17:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238714AbiEWQRq (ORCPT ); Mon, 23 May 2022 12:17:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238811AbiEWQRb (ORCPT ); Mon, 23 May 2022 12:17:31 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FDAA544CC for ; Mon, 23 May 2022 09:17:26 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id a9so12074268pgv.12 for ; Mon, 23 May 2022 09:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=23CBLMwb3guE5iJvJwXPI+qbRLvKp4RVuSYLI9nOoJw=; b=BuuSoLFK4Vp/mmoV6ukmUMED2WupMs+dhkwNuuf+MLSu6tNlyF5yHTxVa8qs75Jb1t wK5f1mFjStAf+YDHP0f/KOB0UKlDAx0Lt3KHkbG9H2/cLw62x6meZMBaxUtkQRafzNTu l+XMwi75wkkVXpUXDad27poMBy7Yo+oDUcnEbPk3lzWYovd1e9OyBNABR5egkn8UABf3 em+8gqZd0UXUFHdkPnxRr4+tOhO/ymasVsxlummMZMiROglon619RUaT2AocZ6PggluD kNUxMP8Jm1vu4CK5iGqOokUZpdGRcDJQ/Chn1u/vX6ZFHua2b82vuZa6lDD5lLIelq62 Hu+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=23CBLMwb3guE5iJvJwXPI+qbRLvKp4RVuSYLI9nOoJw=; b=IhWtmIfd3G+a6uJYd8LS5wSsK3DnFqIgHBGxiXdawX1JiMUBOtLSWdhYapgqpD53ZP OBm/cay740Q+NUcaCdZly4lBdFAjaYfoiNqY8zEDsaBjIcdQFFv+IL4wbuKr4RSB0us6 MppHH1kVui6i3UZbqRPBozRGXqKkzAxYOn9XxlrJAJt2IS6qESrBa/9P2TaHRGVWwpA6 VADBycRV9di3h26e8ie/xRrz1UN6joEkOJXpaq6ALYrOKrLOT29uTxV6+EtxRvvnVT67 xMojN3PdpWZ7MPPG6EJl8j9VTv4BBfHDVVu4MT2cvQdpDxTOEf8KVNDJi0hHgsa9f5Ug nSBA== X-Gm-Message-State: AOAM532YUWpimUW+Llw+7N8Ra7rNFPzBqw4wc0MGzhDCHYfeLGZTqaB3 b/doj+Whp1Ci9jXXjDwIEiA= X-Google-Smtp-Source: ABdhPJzz+KnYrmdnbmtN5FbdS54UppsKGY/Ep49TOjEo65o9Y15AwQbufyDL3uVE4Lv7BULtKaqtgg== X-Received: by 2002:a05:6a00:1305:b0:512:ebab:3b20 with SMTP id j5-20020a056a00130500b00512ebab3b20mr24450505pfu.82.1653322645817; Mon, 23 May 2022 09:17:25 -0700 (PDT) Received: from localhost.localdomain ([182.213.254.91]) by smtp.gmail.com with ESMTPSA id c8-20020a170902c2c800b0015e8d4eb2ccsm5252127pla.278.2022.05.23.09.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 09:17:25 -0700 (PDT) From: Taehee Yoo To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: ap420073@gmail.com Subject: [PATCH net 3/3] amt: fix possible memory leak in amt_rcv() Date: Mon, 23 May 2022 16:17:08 +0000 Message-Id: <20220523161708.29518-4-ap420073@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220523161708.29518-1-ap420073@gmail.com> References: <20220523161708.29518-1-ap420073@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org If an amt receives packets and it finds socket. If it can't find a socket, it should free a received skb. But it doesn't. So, a memory leak would possibly occur. Fixes: cbc21dc1cfe9 ("amt: add data plane of amt interface") Signed-off-by: Taehee Yoo --- drivers/net/amt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/amt.c b/drivers/net/amt.c index 635de07b2e40..ebee5f07a208 100644 --- a/drivers/net/amt.c +++ b/drivers/net/amt.c @@ -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;