Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp527734imw; Fri, 15 Jul 2022 07:59:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sgHhpoariCliWHipy1zpcWvPMftGssCb+rn1vNQHL1p3Zy3onaVTKEeor22gLiAsQ1F2x3 X-Received: by 2002:a17:907:2710:b0:72b:7f52:75da with SMTP id w16-20020a170907271000b0072b7f5275damr13233268ejk.26.1657897163535; Fri, 15 Jul 2022 07:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657897163; cv=none; d=google.com; s=arc-20160816; b=dzhcYLbeqkUL59nSXlKV10Y5Es+uL8CQhAUCYoZHFQVTlO3GDh/ltdD3dTPsVzHuxM /EzlyJYaDE8hNxwModSAB36DnfYI15/6n9x1AOmXr+1DODeoweKd5am1RtEEsb1eJBX3 FNpyuSZyy5Wn2px4WdIS27rgECvQmkjYem/J1hMASYMjbtWYT2g7cFxWsWi526fpqdSJ SfiffdU5u4LqxXk73v2eIog5a7EOeDaQkfXK/zSIs+FVIpGQMYOL8njSRncjvqSNO6Nv HjgHvxLhl5arpVcvYXRpXhqv+y3FcoRJ+Gv+2ZtCXhso53Xj7DG31PLGnjHGf5HQbMpF XMfA== 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=tG8UwfM9XgsU2gpK8iZAI5QuO4Taq8sY6XWqWuLovpU=; b=qd+QR9KejM/Rfv7k6MhgDuryu/0iuBxm1XntX5vbMoHpD/QrwaoaRSoJTw8BKem7q7 qPtWKdc8yPX2AIo0smgc23leb2LU1mOAGLpUzloxZZGM2XrePnVoJVyI8xQXCS4AcKPA VBW49hx6ZrKTM4C+T6E+/fo+jzEseVZyAgAvGzayaU3lQV0J55q81s0bfGv6fSDizPNX 29KScwNQxEvSnDAxJYUK2UyRGGxT9WHk3w5A6gd+/vbx6QTpVhQPCUqhx7IMm451A9S+ F75+7P3ut7kYkunQ4rRd6axsKEaVZzWQ4gst+lF+/ec1DYmvkNFi6/oQQQ3hMpumFlZ2 QjPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=M3X5Tr7F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb37-20020a1709071ca500b00715849159c7si4402297ejc.56.2022.07.15.07.58.57; Fri, 15 Jul 2022 07:59:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=M3X5Tr7F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232308AbiGOOHI (ORCPT + 99 others); Fri, 15 Jul 2022 10:07:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230301AbiGOOHG (ORCPT ); Fri, 15 Jul 2022 10:07:06 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E1341261C for ; Fri, 15 Jul 2022 07:07:05 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id g1so6411520edb.12 for ; Fri, 15 Jul 2022 07:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tG8UwfM9XgsU2gpK8iZAI5QuO4Taq8sY6XWqWuLovpU=; b=M3X5Tr7FPZHC+7bkRn7RRykQVi/wfaS3ybPSNR/xzd4iJZkrgXYUWFxjI5HWMhxv0M 9BOv9pkEYqlbio5/KLX6bt/3ju9AEDpu2LsiZi3WrH5mHJVk/gCyouJ67m2pt6ZPEPt6 VxGKJlEFF6Hsk/vkwoPwefkk0ZgwGzZzL7tME= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tG8UwfM9XgsU2gpK8iZAI5QuO4Taq8sY6XWqWuLovpU=; b=t8hZEbdXzHSo4ZGoTM2iStWmWGTFE3iNxEZ/HudWLujHrhpTchaxodDHVZRcg5MRJ7 FzLg0KtTZydQgUQTwSELxR6mEzcU/Ae65E/nAHuxjKHAJWT7eg8V3F8REXxyCgyeMAkn bSN6p1YjHxqUhSB1boh9YO+hL3mEn6zMYhxXwgzW7eCevL92uS0bRToACI9QBIICor9+ H3CUG1yR6RYDD4pzqnfXqeKplbb68vg+0YYxrRjL52ZlmJtTKmOgdZJYproXJ+Snturf wM1vMHU8+XyjS8hUHBYY0RN728OTiiIPv4Ozg9tnvx48bHza0B+vNtAnDSZ4kEXY+JOd dkPw== X-Gm-Message-State: AJIora8pf3eF6g1vsVB6XRXsMbNgcysiQQriCRNQMuURgZmzo1htQHnc F1QrBEIakYrY3OLxqrEr2eUXUPGGffRbBWkOhY8gUw== X-Received: by 2002:a05:6402:270d:b0:43a:d1e8:460b with SMTP id y13-20020a056402270d00b0043ad1e8460bmr18857128edd.40.1657894022967; Fri, 15 Jul 2022 07:07:02 -0700 (PDT) MIME-Version: 1.0 References: <20220715075343.2730026-1-williamsukatube@163.com> In-Reply-To: <20220715075343.2730026-1-williamsukatube@163.com> From: Miklos Szeredi Date: Fri, 15 Jul 2022 16:06:52 +0200 Message-ID: Subject: Re: [PATCH] fuse: Fix a potential memory leak for kstrdup() To: williamsukatube@163.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, William Dean , Hacash Robot Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 15 Jul 2022 at 09:54, wrote: > > From: William Dean > > kfree() is missing on an error path to free the memory allocated by > kstrdup(): > > sb->s_subtype = kstrdup(parent_sb->s_subtype, GFP_KERNEL); > > So it is better to free it via kfree(sb->s_subtype). Not needed. s_subtype will be freed in __put_super(). Thanks, Miklos