From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9792AC433FE for ; Tue, 8 Dec 2020 17:13:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49FCC23B05 for ; Tue, 8 Dec 2020 17:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730683AbgLHRN2 (ORCPT ); Tue, 8 Dec 2020 12:13:28 -0500 Received: from www62.your-server.de ([213.133.104.62]:54104 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730469AbgLHRN1 (ORCPT ); Tue, 8 Dec 2020 12:13:27 -0500 Received: from sslproxy06.your-server.de ([78.46.172.3]) by www62.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1kmgXd-000EBd-AZ; Tue, 08 Dec 2020 18:12:45 +0100 Received: from [85.7.101.30] (helo=pc-9.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kmgXd-0009EJ-4s; Tue, 08 Dec 2020 18:12:45 +0100 Subject: Re: [PATCH v2 1/1] xdp: avoid calling kfree twice To: Zhu Yanjun , zyjzyj2000@gmail.com, bjorn.topel@intel.com, magnus.karlsson@intel.com, netdev@vger.kernel.org, jonathan.lemon@gmail.com References: <20201209050315.5864-1-yanjun.zhu@intel.com> From: Daniel Borkmann Message-ID: Date: Tue, 8 Dec 2020 18:12:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20201209050315.5864-1-yanjun.zhu@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.102.4/26012/Tue Dec 8 15:38:50 2020) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 12/9/20 6:03 AM, Zhu Yanjun wrote: > In the function xdp_umem_pin_pages, if npgs != umem->npgs and > npgs >= 0, the function xdp_umem_unpin_pages is called. In this > function, kfree is called to handle umem->pgs, and then in the > function xdp_umem_pin_pages, kfree is called again to handle > umem->pgs. Eventually, umem->pgs is freed twice. > > Acked-by: Björn Töpel > Signed-off-by: Zhu Yanjun Please also fix up the commit log according to Bjorn's prior feedback [0]. If it's just a cleanup, it should state so, the commit message right now makes it sound like an actual double free bug. [0] https://lore.kernel.org/netdev/0fef898d-cf5e-ef1b-6c35-c98669e9e0ed@intel.com/