Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp226150pxb; Wed, 4 Nov 2020 20:44:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJz9wwnIq6BgqrvOPFCsj3jwwnhvmrtMREvc4kiKo1iSdv2Yswu6OXueu8S+foPKdAqGz0Mr X-Received: by 2002:aa7:d48d:: with SMTP id b13mr716628edr.264.1604551497300; Wed, 04 Nov 2020 20:44:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604551497; cv=none; d=google.com; s=arc-20160816; b=Uy6EJcvJBYniZFhHGIJ61kfbW9OGJT/rywDDB5ADqqWco1YfYRliOA9ChyAzDHY7x9 Xb5u8At8pHJIonlzmLwlM3/jPlIaNFt+dI5loziH2CyplXtUQf+WLyDma04PY8qRkAm9 u5zbFfbI46Kvm+jIiOeayoRrMvatowD8en14XlMFSsF5tiD7yqdFMSEgqC4t0CSERWF2 PH3wNIUsbmwauoO6eRt//hbIlu1iNbKD4oKkbgRu/ZXxmFm7gua32spMuYEWSsQPOYgy Zc57K4pIbRTizLYiZA0DeFy1pZo4VykRREIwxgFAYmOkci6ykGLUZursVwzzZ5EvRapI 1zfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject; bh=MksYM6rDZRYLQPhsdCZtGdus7KZPimi6FaSuC6qXTMQ=; b=mARshZcMAAvniy8Mv7l0pI4Zdgd9xcu9nACIKC36c48AoI6BfI9cDW7/hoZlvfb66p 9OePbYrnPudTE1NeGwFzEecf2xDO/9qI5gAZclqo9RcBDRgkUGfXlpOAA0tHVKqGoFS/ OBEHenFwO11Uuq39v4opeBmYnQNNj1WOAVSyMTcoLJg1A9SvivpUOu9GBcVQVTJ+oycX LZtRS+rqiYWXv4gauE0dthvr1nQlRihmx20i1zd4etjNzPZRUBKdsJqjhWpeaTnIryqw lfzOarmG23WQPhBDO0WuWhblRvI/8cXJmitzVgS4SlUYJWUSSgeWTx0x2F0zV7H4Uttr +ezQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u5si300422edb.608.2020.11.04.20.44.35; Wed, 04 Nov 2020 20:44:57 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733245AbgKECJL (ORCPT + 99 others); Wed, 4 Nov 2020 21:09:11 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:7055 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727736AbgKECJL (ORCPT ); Wed, 4 Nov 2020 21:09:11 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CRRlj0CNRzhdQD; Thu, 5 Nov 2020 10:09:05 +0800 (CST) Received: from [127.0.0.1] (10.174.176.238) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Thu, 5 Nov 2020 10:09:01 +0800 Subject: Re: [PATCH] fuse: check whether fuse_request_alloc returns NULL in fuse_simple_request From: Zhiqiang Liu To: , , Miklos Szeredi CC: , , linfeilong , lihaotian References: Message-ID: Date: Thu, 5 Nov 2020 10:09:00 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.176.238] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sorry for ignoring __GFP_NOFAIL flag. Please ignore this patch. On 2020/11/5 9:33, Zhiqiang Liu wrote: > ping ... > > On 2020/10/22 21:13, Zhiqiang Liu wrote: >> >> In fuse_simple_request func, we will call fuse_request_alloc func to alloc >> one request from fuse_req_cachep when args->force is true. However, the >> return value of fuse_request_alloc func is not checked whether it is NULL. >> If allocating request fails, access-NULL-pointer problem will occur. >> >> Here, we check the return value of fuse_request_alloc func. >> >> Fixes: 7213394c4e18 ("fuse: simplify request allocation") >> Signed-off-by: Zhiqiang Liu >> Signed-off-by: Haotian Li >> --- >> fs/fuse/dev.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c >> index 02b3c36b3676..f7dd33ae8e31 100644 >> --- a/fs/fuse/dev.c >> +++ b/fs/fuse/dev.c >> @@ -481,6 +481,8 @@ ssize_t fuse_simple_request(struct fuse_conn *fc, struct fuse_args *args) >> if (args->force) { >> atomic_inc(&fc->num_waiting); >> req = fuse_request_alloc(GFP_KERNEL | __GFP_NOFAIL); >> + if (!req) >> + return -ENOMEM; >> >> if (!args->nocreds) >> fuse_force_creds(fc, req); >> > > > . >