Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3599263ybl; Mon, 19 Aug 2019 22:37:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwx3uh8cppXJeTKa6YGNXwzpbksQIABV66LLccdAWJGCY5JogXSwhW96HnXbXB3jdZaKSxa X-Received: by 2002:a17:902:2b8a:: with SMTP id l10mr26446143plb.283.1566279423983; Mon, 19 Aug 2019 22:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566279423; cv=none; d=google.com; s=arc-20160816; b=ule1UL5UebpUecj2KaFaq2n1VF1qEuz0w5LcGjm/jkE2iJtQZ35btKtZiM9AiqABxi jYUnMx1hEY2tgxuZaHbLq4gbRZsIlGl3AKBMTtqb3O3Z+UydF2n0VSp5JPopv6wnOF8N zY8FSA+7k3jyVfbV138vMHZUcuUepCIzgDvwD53R/7Kyhmts7JxKwUDoRl3BXtW9vIy2 q8FkwpBzqb9GsTdgQEkva/MUjOV9Ggm23gRfzCZbdaeG+PsavcBbsioYciDB2oQx5R4S DeSQc8qlu05ZWoTWhS4YD6baBCv79OWj71kr1u4CDyfuQj95lSTVHvEvvvB2bREFAZ9B Ef5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Hzlnui8irzpAd7n5q1N+N9i6R/iOr1I9zEkcRTy9ekw=; b=xXscyjNRxIzRZjfPn48v9TT2sr+bcwUFi+NuFCqvB0n8rgUx8fzVcFjTh2ozcHoHQN T404HDJyscSBOB7OhEKEfcM2pPQqXtcBFsemCO142mCUeNGpMiKQ1qdSUL1wuf27j+I9 IRabJK1kkBC+fzr1weuEjU5iLdTbiPBTeFJ3x72EEBeiiYEt+b29DVNIUPv68lgSg54k +vcn3eZFSky6g49AHG9gubYJxZKp3EV19Cr6kowToKYTAXwbiEjozUGLPhRgAYtyW/m8 t1lLhXjnXKWNzz13I09lS1PUOJiq73H7t2WTc2C7LpficEHDlm4bbcRwy/ButUfbaCzL 21cA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v41si11421305pgn.481.2019.08.19.22.36.48; Mon, 19 Aug 2019 22:37:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729207AbfHTFeA (ORCPT + 99 others); Tue, 20 Aug 2019 01:34:00 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:37692 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729024AbfHTFd7 (ORCPT ); Tue, 20 Aug 2019 01:33:59 -0400 Received: by mail-yw1-f66.google.com with SMTP id u141so1925456ywe.4; Mon, 19 Aug 2019 22:33:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Hzlnui8irzpAd7n5q1N+N9i6R/iOr1I9zEkcRTy9ekw=; b=H1lerrhJAMcepNDgsKddyJQWXa65/IsvRVNr5XxEWlZnz1KBaymCzQbhFqT74MxkfN GYh9AuZ4QkQGF2/D5xe93v6tcP5dPPgKjA8awjuWO8gOLFaz4KTbvKxOZwO4XjvoaeLy kx+MwElB9Fgc1aHpsKqDvG0Un38IUj1ZTr1GPQWyvOTTFtOqtFLjdvluCA8ZdbOq8VZl Xm79/DhWxU+Mucdn0BW/O/W3g18mZAs0hLVoFgHy7xFiVNag93fOADXqnYpF+goN7bmB QPHko54Ts90h/MXgbCHGbDaX59uX6S6neCeKdbi5zeU/xVEI0vrwZdhVWtbqoUkEiwNf oDuQ== X-Gm-Message-State: APjAAAX+T50gimJKdLd9Lx+o+a11NcWR4UVUh5AZSCPbTFOfVGtam0o2 owxLRK37uQqPUGmzIcHzfBw= X-Received: by 2002:a81:98f:: with SMTP id 137mr20023485ywj.293.1566279238774; Mon, 19 Aug 2019 22:33:58 -0700 (PDT) Received: from localhost.localdomain (24-158-240-219.dhcp.smyr.ga.charter.com. [24.158.240.219]) by smtp.gmail.com with ESMTPSA id q125sm3577917ywh.18.2019.08.19.22.33.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Aug 2019 22:33:58 -0700 (PDT) From: Wenwen Wang To: Wenwen Wang Cc: Tyler Hicks , ecryptfs@vger.kernel.org (open list:ECRYPT FILE SYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] ecryptfs: fix a memory leak bug Date: Tue, 20 Aug 2019 00:33:54 -0500 Message-Id: <1566279234-9634-1-git-send-email-wenwen@cs.uga.edu> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In ecryptfs_init_messaging(), if the allocation for 'ecryptfs_msg_ctx_arr' fails, the previously allocated 'ecryptfs_daemon_hash' is not deallocated, leading to a memory leak bug. To fix this issue, free 'ecryptfs_daemon_hash' before returning the error. Signed-off-by: Wenwen Wang --- fs/ecryptfs/messaging.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c index d668e60..c05ca39 100644 --- a/fs/ecryptfs/messaging.c +++ b/fs/ecryptfs/messaging.c @@ -379,6 +379,7 @@ int __init ecryptfs_init_messaging(void) * ecryptfs_message_buf_len), GFP_KERNEL); if (!ecryptfs_msg_ctx_arr) { + kfree(ecryptfs_daemon_hash); rc = -ENOMEM; goto out; } -- 2.7.4