Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp302732imn; Wed, 27 Jul 2022 06:45:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uizEbg0PQ5c8qBr/0jmvgMyHGEJDZxBeqvYjfIbqXvndIvPOnNbsrjlYNXB9GViy+V1Kh9 X-Received: by 2002:a17:90b:4f44:b0:1f2:a900:a1e8 with SMTP id pj4-20020a17090b4f4400b001f2a900a1e8mr4932948pjb.32.1658929537774; Wed, 27 Jul 2022 06:45:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658929537; cv=none; d=google.com; s=arc-20160816; b=ioA95AuybnPjwosZdHfKh66ZEQtyPcAwYisA2tIVoIoXSn3/FFGsRi3blPqEwAxQeA R2BNooGnweuZXA0+lg0oM96WYLIJ4s22QE3HFSCOGVS1mA+0lyEPzcY9B5Na3yWlx0SL 2z5Fxj/RTE2j7hGsQwJe4mABiZvG/yQl340ee693gaelBslImISBlZ06gEe+eE01qhmp ZbulcmXctUNDZuaBzAs6erN4gs53Izp1hH4fg8W41j6NlTWUqBCuIpMZ9ADBKYiHtuaz SFNm0pHT8hJw4SA75O19JFVriNkhb4JyCJzItOQjGtGN/sEQk/jURSIFM89U6YGDbCvK 4jPw== 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=IZC9NEhf05++/nyq+KA7I22wmZBHbNz5U6HDcm4S/Gg=; b=irLLJRd2tDxX7JlvM6kVdnGei7yu5xfgRbjAqikhvbCMn2/6csbsSuXxSbHfBhcpPn 0QkMkm/RAn0D9v5fDo/RWu5RbxroLkb/P3nvpE7gefrOoWmQv0hxC1z//cYYQYXf5kJx bOSATx3yDz7Bgzdl+En78Lf4ZeNvUiP34G/EQo2F9dPgDEvmcY0ZLdHr5bUtcg2f9fH7 V0kSJjtBnLzPm2vFoCaEATN4LQrjOOyFJVrWoI9G15KzugvBOv2pGoGprKtbTttbt8l8 huiHORDpD5pQMqCgGO4eWB+hx5ISJzp947qy1ROANFuBvmQVfJz9UUywKAxwvgUu292h ogzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=QUUOmuOP; 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 x13-20020a17090abc8d00b001f1e92ae948si5170212pjr.1.2022.07.27.06.45.22; Wed, 27 Jul 2022 06:45:37 -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=QUUOmuOP; 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 S232692AbiG0N31 (ORCPT + 99 others); Wed, 27 Jul 2022 09:29:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233358AbiG0N3V (ORCPT ); Wed, 27 Jul 2022 09:29:21 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D29724BD0 for ; Wed, 27 Jul 2022 06:29:20 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id z18so9052297edb.10 for ; Wed, 27 Jul 2022 06:29:20 -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=IZC9NEhf05++/nyq+KA7I22wmZBHbNz5U6HDcm4S/Gg=; b=QUUOmuOPdKZaVDwP46yrsLjlhkNgx236+kyN/pzXLVNcxS/NNPOaK65eDooxwLXVTM 7xZlGcil5YXcGY2dQxkP9AOJCuJWaniWL+0O0w4JQqZv26KEttY1pQEwaUdLFlj5+rET zt8oSojN1OGpy+0kYuNE3JOp1opZbgdI5BdAQ= 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=IZC9NEhf05++/nyq+KA7I22wmZBHbNz5U6HDcm4S/Gg=; b=HcGlENP/vd7Lsaiy9v3e7bD0IfE7fKFWu9D+ujnt4/iIGOitNke4s90w3y6xmHS0qs VZS9enxv9NSTKE19z4CBVnYHUpsAyrlx623kaqLYizIqoX+MtTcv6yjgxahMioQ5TNT8 lL356+Ev1e6qPz/GDJOjS0mMVDA5qUfm5THid/I1C0z4vPwVnQaatjiqzhHrNoH+/tmI NiaRTzW73wlWGFn9IGuyowQxoWuKRWAs7bhEem/ia/e5l9eMG4n8Ao5CyXGaYvNc3HAa mkieVwTsPh8AKJpQCmwrR+xtYt9+PV3Y/zKWV3OynxMPqm+HCvL2KXo0PJH61igGfdwB yNwg== X-Gm-Message-State: AJIora8kgFhDsrArLJNem9nDKpcgO0D+7xpLOVac/7M3uhRbnnt6724f EOPvWCLH4jhLod9hGlnFHiJI79KDRvUU0AeUiDy9Sa2YbbtulQ== X-Received: by 2002:a05:6402:4247:b0:43c:12a7:6bf4 with SMTP id g7-20020a056402424700b0043c12a76bf4mr13170002edb.374.1658928559169; Wed, 27 Jul 2022 06:29:19 -0700 (PDT) MIME-Version: 1.0 References: <20220713073217.2663078-1-williamsukatube@163.com> In-Reply-To: <20220713073217.2663078-1-williamsukatube@163.com> From: Miklos Szeredi Date: Wed, 27 Jul 2022 15:29:07 +0200 Message-ID: Subject: Re: [PATCH] ovl: Fix a potential memory leak for kstrdup() To: williamsukatube@163.com Cc: overlayfs , 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 Wed, 13 Jul 2022 at 09:33, wrote: > > From: William Dean > > kfree() is missing on an error path to free the memory > allocated by kstrdup(): > > config->redirect_mode = kstrdup(ovl_redirect_mode_def(), GFP_KERNEL); > > So it is better to free it via kfree(config->redirect_mode). Will be freed in ovl_free_fs(). Thanks, Miklos