From patchwork Sun May 22 00:59:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 575243 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 61325C433EF for ; Sun, 22 May 2022 01:00:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348323AbiEVBAK (ORCPT ); Sat, 21 May 2022 21:00:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348260AbiEVBAH (ORCPT ); Sat, 21 May 2022 21:00:07 -0400 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A1F439BB7 for ; Sat, 21 May 2022 18:00:05 -0700 (PDT) Received: by mail-il1-x12e.google.com with SMTP id t15so1412761ilg.13 for ; Sat, 21 May 2022 18:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QKpWuvor5353AGWAKQRnBlR2jwT4S//yqIRK+fSNZWk=; b=eyiXHhFYeqlKXBdEh0qZtBEceIQlGhwQFov7FtZTiamgX4c3N7rmeqDJ9VjjaQtcNS UsYBS2WvXFrpb7ifKEUHr8BhglhyRzrp17SD1cUQiem9ZSKkM/hQ3hjsyApUsgytXxWT xAAt/BXM2fyEtjDzZ5If03IUIriSFgtRQHzX9Tuds5Sr/UgaKdXTUuEMO7d/TrWXkS93 //pZz/QvJ55CSamp4sg6GIIva5/V21UsDVGu4y/Rv/1j/R/FK2694qhebPpW2cjaBt23 lInvLJVjlcR+cbD0fyLYlwg7jKEMM32J3NXZ3uGTg5joSq3GOJtEwF8r7ISQMV5238bY BXxg== 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:mime-version:content-transfer-encoding; bh=QKpWuvor5353AGWAKQRnBlR2jwT4S//yqIRK+fSNZWk=; b=mudvBsMAyUgp8+f90wQfLQRfnJaRFC5aKHnfeQKyx7bAA94Zhy82jjGTl0nfCf+rlU CevzBjfgetu79YsGvRS5V6Q95tg2MmpRwqiO/GrQDgXfOwlSCKdbvPhgYt/0x7D/7/xD vjQ0+qAVf87VlxU6mBVBsDmneBlfwyXH959B42EPN/JIjC01Hx6Eswx7znSLB/H89FSK mhmgb4LcfElSHOTRx1HksC9tVw3UVKSI0Z4eA0/PTVOZ5KY0hFo6YE8fPsxs1pBT1zQL KoAc3PfTsCKtvxiWGYkZkmjdLBgCm+/Mp0Hby+40ECRktCcxYn0uFcCCAgI7a9l+1DzW ogIw== X-Gm-Message-State: AOAM531jX4L96T2+3vKwrqop4CvpdQvNxrK5q9WTCoc/CCy256EMnamF +WuyuX7ByovwCVQ8boY3OLUigA== X-Google-Smtp-Source: ABdhPJzwsgBwQcxz++V/OfI8ibnzh7s5eOX43rN63fw+IctTZ0dplBW5LczJi9V5LxIbdvlQFfNS6w== X-Received: by 2002:a92:bf06:0:b0:2c9:b21d:6db7 with SMTP id z6-20020a92bf06000000b002c9b21d6db7mr8205967ilh.222.1653181204506; Sat, 21 May 2022 18:00:04 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id t21-20020a02c495000000b0032eacab7e07sm939366jam.93.2022.05.21.18.00.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 18:00:04 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 1/2] net: ipa: fix page free in ipa_endpoint_trans_release() Date: Sat, 21 May 2022 19:59:58 -0500 Message-Id: <20220522005959.1175181-2-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220522005959.1175181-1-elder@linaro.org> References: <20220522005959.1175181-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Currently the (possibly compound) page used for receive buffers are freed using __free_pages(). But according to this comment above the definition of that function, that's wrong: If you want to use the page's reference count to decide when to free the allocation, you should allocate a compound page, and use put_page() instead of __free_pages(). Convert the call to __free_pages() in ipa_endpoint_trans_release() to use put_page() instead. Fixes: ed23f02680caa ("net: ipa: define per-endpoint receive buffer size") Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 0f489723689c5..675b7135644b8 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1385,11 +1385,8 @@ void ipa_endpoint_trans_release(struct ipa_endpoint *endpoint, } else { struct page *page = trans->data; - if (page) { - u32 buffer_size = endpoint->config.rx.buffer_size; - - __free_pages(page, get_order(buffer_size)); - } + if (page) + put_page(page); } } From patchwork Sun May 22 00:59:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 575494 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 BFB54C433F5 for ; Sun, 22 May 2022 01:00:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348490AbiEVBAI (ORCPT ); Sat, 21 May 2022 21:00:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348323AbiEVBAH (ORCPT ); Sat, 21 May 2022 21:00:07 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D7063981F for ; Sat, 21 May 2022 18:00:06 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id l15so7737528ilh.3 for ; Sat, 21 May 2022 18:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9nHOW+mnraB1XiSAtyqCqOmXRY0ima8MXF2hLYPrgyI=; b=tpNTJG3yM9Wz/y9QSl4vuGOCtsfjCxWgtWGDVssv2nSWwap6tnYkjE8HfUean1dleN xao8+lCvbkVBReXqb1FDVdzUz8N+P7BF8zrKfOipG7X45gGqumqVdxZUNhFSQd+yk1Uf zodhLnVEiarAswjBaNTIezlIOtclDKLgXqCgycRjD8887HkF5YKXNvZ1qCipPZe8/2Xj SsxuH4CBqBeUW1Fg6c5bX2u/Q5HQIcJiDuvd+mYET2DKDkN1GjIbxX7jPa1r3R5sb3xr 2EtxKFFVq38XsoVqRhd/t91Mb1It69uN6czQ8Euhj7pM/Duc3jEKTq9J7uwNiLntEukn 1g7w== 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:mime-version:content-transfer-encoding; bh=9nHOW+mnraB1XiSAtyqCqOmXRY0ima8MXF2hLYPrgyI=; b=VZ1FfncHcoO5i/DpCYUrEh5t2mK9zulW+i+3plrzMz3ft8IeZPzGRU8tiZjKtERcVh WSzUx+CXm/jiSkFYObvi9/wOmcKbYVWI11LPlcyyhO05s9K6McH6B2shPXAIPNeRW03M LoodVkgGmfUfiUcGnLW5Lt+9UNoIsaZ1bXPsCd2PQ2raNQ1mVARSj++3HZ4O4IwPNqON x3lDs8+nxFSH1RcfkksDmqL7NJOco3ByabY18GmiFJW6qPI337OSQiocu+Qe1wb9ytDy HD/0TsFqirAFhpbpJVa0YG9Hg1+54Byqci8LO3MbQ2dX5ffDSrvJNz/EmhbSsojDlEFE ejpA== X-Gm-Message-State: AOAM5304eqfUSs8s8VakoRZhi1m7zOuu2f3VJy7VMktDjBzT+8jkf0/1 v+eqcoLtCYNqFikJW2gx+pSaiA== X-Google-Smtp-Source: ABdhPJyjzHZPVoBDJOxEv9fzA9x6b3lvvd+2e2BtVOlQacms8+7X1Chb1aTuAc+8iH11Eim6GoHrwA== X-Received: by 2002:a92:d486:0:b0:2d1:19cb:9eba with SMTP id p6-20020a92d486000000b002d119cb9ebamr8075908ilg.29.1653181205689; Sat, 21 May 2022 18:00:05 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id t21-20020a02c495000000b0032eacab7e07sm939366jam.93.2022.05.21.18.00.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 18:00:05 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 2/2] net: ipa: fix page free in ipa_endpoint_replenish_one() Date: Sat, 21 May 2022 19:59:59 -0500 Message-Id: <20220522005959.1175181-3-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220522005959.1175181-1-elder@linaro.org> References: <20220522005959.1175181-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Currently the (possibly compound) pages used for receive buffers are freed using __free_pages(). But according to this comment above the definition of that function, that's wrong: If you want to use the page's reference count to decide when to free the allocation, you should allocate a compound page, and use put_page() instead of __free_pages(). Convert the call to __free_pages() in ipa_endpoint_replenish_one() to use put_page() instead. Fixes: 6a606b90153b8 ("net: ipa: allocate transaction in replenish loop") Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 675b7135644b8..dac4845cf596c 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1062,7 +1062,7 @@ static int ipa_endpoint_replenish_one(struct ipa_endpoint *endpoint, ret = gsi_trans_page_add(trans, page, len, offset); if (ret) - __free_pages(page, get_order(buffer_size)); + put_page(page); else trans->data = page; /* transaction owns page now */