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=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,PDS_TONAME_EQ_TOLOCAL_SHORT,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 219C5C433E0 for ; Wed, 24 Mar 2021 13:59:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC15C619BF for ; Wed, 24 Mar 2021 13:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235756AbhCXN6w (ORCPT ); Wed, 24 Mar 2021 09:58:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30733 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235838AbhCXN6f (ORCPT ); Wed, 24 Mar 2021 09:58:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616594312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/C5hrHviblBlz6qOuCjmxQmp+MydE/HY6zib4cOG+CM=; b=T9zC9YfCgG4kwHAUFBAoK/QXaEgrr+LPoSusmkvtTP9i0hOcY9C7/kqgo6X+uxBpt+k1RD 03YdDbCsvE5l3jpLtv5TDRzqb/NAkpFmCNzG3+ub8IMiWFLHvdJoz4h6D1D6XPn1mRXXj6 04Ip7/KP0WJyCw9QvVDsP+LED8DRCI4= Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-355-FZ5ARaN3P-GHy8z2E3Wp0Q-1; Wed, 24 Mar 2021 09:58:29 -0400 X-MC-Unique: FZ5ARaN3P-GHy8z2E3Wp0Q-1 Received: by mail-oo1-f70.google.com with SMTP id a8so1325014ooo.14 for ; Wed, 24 Mar 2021 06:58:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/C5hrHviblBlz6qOuCjmxQmp+MydE/HY6zib4cOG+CM=; b=c+tgOHKR+KpJj7HHVSF6NO7etKpiy28VqNfAyxJ0Cvf/oP5lSCaYcVwUOCd9goJ+gD DWl0+zfhPGN2gutP3KQSwPvdUUXbDH01YrIZkYm+hI3pr6l0f7QIAfPxU+iSvYrJh8xi nOb4EBBw6pTpc+bVOipe0in3IRO9pKM7iHJ8B5wBQsyU5nCk+YvaI0gFp6jHH13lBCr0 Dstbj/jX/GGD0PrzrTqTJ2YO+MFeHL0JIFoD+S1E9W34Spynh/L55AdnSgdY3aOpCCTR prL07RXV6u7SxuAV1RWpc+fZe9HEBN4Bee/O2EOhpadNsAmylvdfQwzQRYWAbhBrbi5x Nc5g== X-Gm-Message-State: AOAM532pFzj6QZ8qrPUf+9b4juMM0CvdQpFBuR2SkidkYv304XOptNVa hwswNkfnP4oJFmcjXVYuRTKAzvrrAUM+WnXtx2AwN14KMi/JgA/sdvEI1M5xC+HG+tiDAqgw2Fp hZspqOo4GroOKRo3cI30aaGJCNTi21jDym7XqgcIo0awfVkfi0cB9lOMLMl66Rt9/2iZms+TcTA == X-Received: by 2002:aca:2418:: with SMTP id n24mr2426478oic.103.1616594308297; Wed, 24 Mar 2021 06:58:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUzpwRYGx/Gf/SW6R+ymtcIvEm7PSV63CIFAnOYbgbfamQmwZBNs2xw4TBchd0MKmqjjledg== X-Received: by 2002:aca:2418:: with SMTP id n24mr2426458oic.103.1616594308072; Wed, 24 Mar 2021 06:58:28 -0700 (PDT) Received: from [192.168.0.173] (ip68-103-222-6.ks.ok.cox.net. [68.103.222.6]) by smtp.gmail.com with ESMTPSA id a6sm400144oiw.44.2021.03.24.06.58.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Mar 2021 06:58:27 -0700 (PDT) Subject: Re: [PATCH] fs/fuse/virtio_fs: Fix a potential memory allocation failure To: zhouchuangao , Vivek Goyal , Stefan Hajnoczi , Miklos Szeredi , virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <1616589523-32024-1-git-send-email-zhouchuangao@vivo.com> From: Connor Kuehl Message-ID: <7dbe66b5-344b-2008-ca8f-559a271a061f@redhat.com> Date: Wed, 24 Mar 2021 08:58:26 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <1616589523-32024-1-git-send-email-zhouchuangao@vivo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/24/21 7:38 AM, zhouchuangao wrote: > Allocate memory for struct fuse_conn may fail, we should not jump to > out_err to kfree(fc). Why not? If fc's allocation fails then it is NULL and calling kfree() on a NULL pointer is a noop[1]. Connor [1] https://www.kernel.org/doc/html/latest/core-api/mm-api.html?highlight=kfree#c.kfree