Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp112222pxx; Tue, 27 Oct 2020 23:14:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwL8+gC94bnE2J1Wa0hxhN80b3bNphZ8CXFF9tJ9WNfZUs3ST0qhp0ZoovCm9o5CqFMzFUD X-Received: by 2002:a17:906:d1c3:: with SMTP id bs3mr5752427ejb.246.1603865666988; Tue, 27 Oct 2020 23:14:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603865666; cv=none; d=google.com; s=arc-20160816; b=WjtDWDcamkKBkxo8gBXd1lRQGjaxMlGvdz3COZGmFDv2B9YIb3r/RSY11ulX/mfdEd 275seCp/JiU3Adk3o3/lJzAepQE4nS3OXSYk6YjNcHAe1+xX3qVgAalSa2X09dR5Ry4C y6eKVxIe/P+6ZRmBvMR1VE8GmQUIQxTenuUqF7UJmWwKNApqU6hGkHeIggvMMdKGZPhu MNKLNm/VjWIPoDk20ORiCZM54rA4sraasHSW+GXCuixWz2e1qdZcAXWbYXoZj0Uz8huQ HU+R82323pe8x/MmGRfEJ4530h6svfGSgi7Zk4Bdr9IriDJl2RkJVi115UQi0tEo6Hdy dcAQ== 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=YVbzv5S7ZnTMq5VXyJrA9KTlPUcQyZHhfhfvpx+YNzs=; b=YxQHJlElF8t4Q27N35T5qjmOHcdMTJXre/XluEsupo+nbeswq/uSQI278hRNiZJXR/ Ac2Myy39usUKdOdmDD8lNcKMf0gutBpqPkXvDO0aN4dnwGpMbXocjgq6PLgBUUu/cD2O JgPibFCMLYphukWGlRLUiSyaNxHFuud4cpmJqhZkO7OcmoW69D8ilWygcXn7gmm9Zz/f OvY+YvOusMUtsdL1oG3DLIvgC8UF2gH8exavPsQocSWTaMll0g4pb2tjurG00/iQRc8h enPH8Hskg9w6lQ3J5B/0DGePJAWcQsujy28MNOrbssFCIG/Agp0mIuxYrtQ1oaDUjIkj n3JA== 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 lr11si2627133ejb.116.2020.10.27.23.14.05; Tue, 27 Oct 2020 23:14:26 -0700 (PDT) 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 S2509863AbgJ0JYx (ORCPT + 99 others); Tue, 27 Oct 2020 05:24:53 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5597 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2509857AbgJ0JYx (ORCPT ); Tue, 27 Oct 2020 05:24:53 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CL5rk3YdZzLnhW; Tue, 27 Oct 2020 17:24:54 +0800 (CST) Received: from [127.0.0.1] (10.174.176.238) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Tue, 27 Oct 2020 17:24:41 +0800 Subject: Re: [PATCH] fuse: check whether fuse_request_alloc returns NULL in fuse_simple_request From: Zhiqiang Liu To: CC: , , , linfeilong , lihaotian , , , , References: Message-ID: <5dff2fb8-80aa-11dc-a1d5-3fc64c27ca3d@huawei.com> Date: Tue, 27 Oct 2020 17:24:41 +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 friendly 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); >