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=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 1A96AC43461 for ; Wed, 2 Sep 2020 21:43:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E18BC207EA for ; Wed, 2 Sep 2020 21:43:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726528AbgIBVnY (ORCPT ); Wed, 2 Sep 2020 17:43:24 -0400 Received: from www62.your-server.de ([213.133.104.62]:56340 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726247AbgIBVnY (ORCPT ); Wed, 2 Sep 2020 17:43:24 -0400 Received: from sslproxy05.your-server.de ([78.46.172.2]) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1kDaXE-0003iS-Rq; Wed, 02 Sep 2020 23:43:16 +0200 Received: from [178.196.57.75] (helo=pc-9.home) by sslproxy05.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDaXE-000OWb-M7; Wed, 02 Sep 2020 23:43:16 +0200 Subject: Re: [PATCH bpf-next] xsk: fix use-after-free in failed shared_umem bind To: Magnus Karlsson , bjorn.topel@intel.com, ast@kernel.org, netdev@vger.kernel.org, jonathan.lemon@gmail.com Cc: bpf@vger.kernel.org References: <1599032164-25684-1-git-send-email-magnus.karlsson@intel.com> From: Daniel Borkmann Message-ID: <0a6ccaa3-3e14-4159-bdee-026923e59474@iogearbox.net> Date: Wed, 2 Sep 2020 23:43:14 +0200 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: <1599032164-25684-1-git-send-email-magnus.karlsson@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.102.4/25918/Wed Sep 2 15:41:14 2020) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 9/2/20 9:36 AM, Magnus Karlsson wrote: > Fix use-after-free when a shared umem bind fails. The code incorrectly > tried to free the allocated buffer pool both in the bind code and then > later also when the socket was released. Fix this by setting the > buffer pool pointer to NULL after the bind code has freed the pool, so > that the socket release code will not try to free the pool. This is > the same solution as the regular, non-shared umem code path has. This > was missing from the shared umem path. > > Signed-off-by: Magnus Karlsson > Reported-by: syzbot+5334f62e4d22804e646a@syzkaller.appspotmail.com > Fixes: b5aea28dca13 ("xsk: Add shared umem support between queue ids") Lgtm, applied, thanks!