Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp885865img; Tue, 26 Feb 2019 10:13:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IZgxLo+HxH06n0Rf6GrHO0SHcUdwHZ/IK7Z6CfaX24ht2FJ+ZVsx6jZntdIQQRz8sF/VhTe X-Received: by 2002:a17:902:1009:: with SMTP id b9mr26539226pla.42.1551204786385; Tue, 26 Feb 2019 10:13:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551204786; cv=none; d=google.com; s=arc-20160816; b=Z+mEyjUQ8Yu1aJOAe04FLgo8jX+7x6rwNSg2rUG09S7dmr2qoLu/N4qpedDRF7KFc7 uhot0yIsqSk87SZjk4++tb0EI7TtoLYWUEFABF2OVnsFZXsGOmh8jwbhO+KXmbttVKxn RiUwZLegv9CVG+7HRFcnqEpb0XMuRJ0vSfapcbr3nHtHGs973vvWZmkWiGW4xuTzhFS1 hWPBhVPKOMznNYBoyb/cS5n1fIjSMOeCGIbUQHk4EZMSPsuVfZcudmZb1Sw5sjql2KvY Kpmk5a7N80KcxmxRXfmPYi62+WAtwgzucleffIPlz0tJFGxQq3VMRUNJ3DA3QPGSqVh/ iIcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=FIYpi+2Ul+I6jk+OdUowMxKvyPu/j/XI0ZKsI+1BPHA=; b=wjykhc103ARj4miduX1G/Q0uAMlW1lVysyDh4HHbQ2UPkNaM/1OoHIUbM/Vm6c7rDo h0nTPtLltP1kyRsuUHvm2CMy8iq2eqb9QyN4j0/aaUzm6lEV6dn9JbMkyJm4e+RGSsAY 4w19lGmcvQ/8eTw+EOf9UcrlIAuyiJRtdyTk3SmkS2lJY9gRKz1IwBki9XvVBuP81THC XYFxNb/OUosWdtW2K2CW0jKpKSn8alirJBGtb8JTf54w/r2jMYo3OagOJxW7htgxOm2Y ijMU6wgns6O1XV/8JVD+pTV4wKxa5fhjQVYPUCGSLWE5lQmhs9qJhSaBH9EBAAfbSW3r cr2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z62si8175997pfz.244.2019.02.26.10.12.51; Tue, 26 Feb 2019 10:13:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728989AbfBZSMY (ORCPT + 99 others); Tue, 26 Feb 2019 13:12:24 -0500 Received: from www62.your-server.de ([213.133.104.62]:55076 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728791AbfBZSMY (ORCPT ); Tue, 26 Feb 2019 13:12:24 -0500 Received: from [78.46.172.2] (helo=sslproxy05.your-server.de) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1gyhDG-0007XY-Ue; Tue, 26 Feb 2019 19:12:19 +0100 Received: from [178.197.249.32] (helo=linux.home) by sslproxy05.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1gyhDG-000LtZ-On; Tue, 26 Feb 2019 19:12:18 +0100 Subject: Re: [PATCH] bpf: decrease usercnt if bpf_map_new_fd() fails in bpf_map_get_fd_by_id() To: Martin Lau , zerons Cc: "ast@kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <1551190537-28694-1-git-send-email-sironhide0null@gmail.com> <20190226173355.chm6gwvwyer57yco@kafai-mbp.dhcp.thefacebook.com> From: Daniel Borkmann Message-ID: Date: Tue, 26 Feb 2019 19:12:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20190226173355.chm6gwvwyer57yco@kafai-mbp.dhcp.thefacebook.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.100.2/25372/Tue Feb 26 11:34:09 2019) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/26/2019 06:33 PM, Martin Lau wrote: > On Tue, Feb 26, 2019 at 10:15:37PM +0800, zerons wrote: >> [ Upstream commit c91951f15978f1a0c6b65f063d30f7ea7bc6fb42 ] >> >> In bpf/syscall.c, bpf_map_get_fd_by_id() use bpf_map_inc_not_zero() to increase >> the refcount, both map->refcnt and map->usercnt. Then, if bpf_map_new_fd() fails, >> should handle map->usercnt too. > Good catch! Thanks for the fix. +1 > Fixes: bd5f5f4ecb78 ("bpf: Add BPF_MAP_GET_FD_BY_ID") > Acked-by: Martin KaFai Lau Applied, thanks!