Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp652298pxb; Wed, 20 Jan 2021 17:21:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJw3Q3WbrQNVRdBqQCmQPfVxzjzLLCWOFu7yLDjR9LBh+OAWhDMrIi1yLI3aTiQi0h74+hgv X-Received: by 2002:a17:906:fa85:: with SMTP id lt5mr7788984ejb.344.1611192110478; Wed, 20 Jan 2021 17:21:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611192110; cv=none; d=google.com; s=arc-20160816; b=Pvc0Ddnh8ar4PFWqxnK/Q/L41aZj/aCNeoI2POtjE8E6HZeIriawViW3aVjiP5j4bX q2f/FWCdI59XyHvB9ODgb+ArZZZy5wu8eX6OItjJueiopfNTGiRCrizkKHz9TSPWS0OA /iJBuifA1C/QA6aeaLg6HHvMmG/SNVvFqOC1wHYLHxYemkyO8xiYbiurIccdocIQ3XXA dT5VIbHPs+AkJIGsT9ebwzahxWE5Jui3/uz5ZC1Q1DW+VOJDjHMmHnweZIscU280UemG r3YqLI9abf4EnYGePClkGVOORevRnzmDEKu+ZsT3RG4b4Y1Oup4OdXCLF4x2dhZzmXp2 uBjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=DBPF/bhtwHkPuSdPk7h5DKeSbFZyuCmYPyPdIaV6CyA=; b=Bc/rxwSPYkErR303eHk/ROFThFHusR8/gpRSA8zkLlna5MAxo4lX9PCEK+Ute91sBh oaXNRxABM4MeImtv6utfMn806/uzgA18WXdVrlhst/8NQROjjruH2KQWBtOG+mMQeV4M 2yjURuo9CIKtKQsynnsAMOcRkY5f+zQPL/+H+Mq+8cpcI/flaO1Oo02AZlSH7IJW1p8f FjJtoJNMx57Z6ZLQFuvtiqyjOMos8NcCD/64euD6/5VUVw58Un8FX7/IneG0v5T7nxMV KXUZ2/OstzFUKDqUO+ubcpHnK1RNT87qkeQsGAkWMk7WDRaEKGMvMIT7Rd+AYUs1LwVX HZMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JTVYDh5z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si1242594ejx.118.2021.01.20.17.21.27; Wed, 20 Jan 2021 17:21:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JTVYDh5z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390181AbhATVgO (ORCPT + 99 others); Wed, 20 Jan 2021 16:36:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:51134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387684AbhATVLS (ORCPT ); Wed, 20 Jan 2021 16:11:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EF4F72360D for ; Wed, 20 Jan 2021 21:10:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611177037; bh=FdjJoQjlwlPK5YeYe9dhzVIDHP27es9c4+ZmKd/gF8c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=JTVYDh5zoSaxansiwcolBVdoVFJOmHopFrvLTluv5dsQK0S27YASPL17iXikx+QFS ISRSio64Kd9SuPniJgNOei+BV04cDz6ZCwUyZzr16M1/ApLJAVBqh30NE0e96Vu9PY kp1Gz38wYwHRaTwiIqJcqrzwlx+ZY9TTVlh6DTSQVaqSn5K/+3l39y/V1A0mYM+k+U ebXmrtd0PHMHuwHvTGjC40UhLVFtJcdRPOzlV5t6xR14RUa/CqIGjM7BhJfOzNVNL6 NVvNoBx2hHhjBqFJBJAtzL7RFaf8ttXcSnJ7RURaEbZd/W+e1B9rWc6lW72naYPuQe 4F64l/OLP8gjg== Received: by mail-lj1-f171.google.com with SMTP id b10so93395ljp.6 for ; Wed, 20 Jan 2021 13:10:36 -0800 (PST) X-Gm-Message-State: AOAM533UulrAQnbR6FzapahmyQ+hLmor4yDI6Z/7XZAAVsA5lzJd7Nuq v60QDVqbgpFQJV68hmR/cf17K0wu3w4Y7HzGquNggg== X-Received: by 2002:a2e:a377:: with SMTP id i23mr5652583ljn.103.1611177035079; Wed, 20 Jan 2021 13:10:35 -0800 (PST) MIME-Version: 1.0 References: <20210119114624.60400-1-bianpan2016@163.com> In-Reply-To: From: KP Singh Date: Wed, 20 Jan 2021 22:10:24 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] bpf: put file handler if no storage found To: Alexei Starovoitov Cc: Pan Bian , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , Network Development , bpf , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 20, 2021 at 8:23 PM Alexei Starovoitov wrote: > > On Tue, Jan 19, 2021 at 4:03 AM Pan Bian wrote: > > > > Put file f if inode_storage_ptr() returns NULL. > > > > Signed-off-by: Pan Bian Thanks for fixing this! (You can add my ack with the fixes tag when you resubmit) Fixes: 8ea636848aca ("bpf: Implement bpf_local_storage for inodes") Acked-by: KP Singh > > --- > > kernel/bpf/bpf_inode_storage.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/bpf/bpf_inode_storage.c b/kernel/bpf/bpf_inode_storage.c > > index 6edff97ad594..089d5071d4fc 100644 > > --- a/kernel/bpf/bpf_inode_storage.c > > +++ b/kernel/bpf/bpf_inode_storage.c > > @@ -125,8 +125,12 @@ static int bpf_fd_inode_storage_update_elem(struct bpf_map *map, void *key, > > > > fd = *(int *)key; > > f = fget_raw(fd); > > - if (!f || !inode_storage_ptr(f->f_inode)) > > + if (!f) > > + return -EBADF; > > + if (!inode_storage_ptr(f->f_inode)) { > > + fput(f); > > return -EBADF; > > + } > > Good catch. > Somehow the patch is not in patchwork. > Could you please resubmit with Fixes tag and reduce cc list? > I guess it's hitting some spam filters in vger.