From patchwork Mon Feb 9 05:45:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 5798311 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F2C5BBF440 for ; Mon, 9 Feb 2015 05:46:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1C4D820117 for ; Mon, 9 Feb 2015 05:46:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A253420115 for ; Mon, 9 Feb 2015 05:46:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752008AbbBIFqZ (ORCPT ); Mon, 9 Feb 2015 00:46:25 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:34761 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750947AbbBIFqY (ORCPT ); Mon, 9 Feb 2015 00:46:24 -0500 Received: by mail-pa0-f53.google.com with SMTP id lf10so23873614pab.12 for ; Sun, 08 Feb 2015 21:46:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iUDOKSxypyVIeF8R5nRVh3Y3/3LjjoF3YBQviYQXaAo=; b=aO3mInM+8t3uNIbH9R0NvDDyHHRUFzc9Wsm/8o8bW/CerY2pkqCvYykz47i2xDB7+K 3+VJFvXJRJGp/K47S96yAPCc+1pGzJDOYzmHiQRcsoDvnHtzB6epr3zCeWghMLsar8yi 0lVWU0WMh5hJXbX7Q1Mw7jz/3aNIqtqINtH9MS1GTU7iieJY8wvg5h3IVxSVo5gxMPj1 wXJWlrVbr3HIFL1iQR/FQ9KIM/zgfzWWLwax6I7fxh8idT6nkZui3+yICsTbZe+wazmN quWflw709gIilbmL+DiKzWyh1stuWeQXFcFxt/536CsogqlaZn5tBnMx8VZyO51+Vk64 Ni6g== X-Gm-Message-State: ALoCoQkmzXBx/CcVEJQ2/UXMSwleeulLJCOy+mPwAbsk3awHRZ0X+D7HdpyTct4AMkP+FZGHt5Cc X-Received: by 10.66.217.164 with SMTP id oz4mr26114676pac.155.1423460783841; Sun, 08 Feb 2015 21:46:23 -0800 (PST) Received: from mew.localdomain (c-76-104-211-44.hsd1.wa.comcast.net. [76.104.211.44]) by mx.google.com with ESMTPSA id qj3sm12592353pac.31.2015.02.08.21.46.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Feb 2015 21:46:22 -0800 (PST) From: Omar Sandoval To: Alexander Viro , Christoph Hellwig Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Omar Sandoval Subject: [PATCH v2] posix_acl: fix reference leaks in posix_acl_create Date: Sun, 8 Feb 2015 21:45:25 -0800 Message-Id: X-Mailer: git-send-email 2.3.0 In-Reply-To: <20150202141942.GA17447@lst.de> References: <20150202141942.GA17447@lst.de> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP get_acl gets a reference which we must release in the error cases. Reviewed-by: Christoph Hellwig Signed-off-by: Omar Sandoval --- Hi, Al, I'm guessing you're the one to take this one? Just a resend with the proper format and Christoph's Reviewed-by. Thanks! fs/posix_acl.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 0855f77..515d315 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -564,13 +564,11 @@ posix_acl_create(struct inode *dir, umode_t *mode, *acl = posix_acl_clone(p, GFP_NOFS); if (!*acl) - return -ENOMEM; + goto no_mem; ret = posix_acl_create_masq(*acl, mode); - if (ret < 0) { - posix_acl_release(*acl); - return -ENOMEM; - } + if (ret < 0) + goto no_mem_clone; if (ret == 0) { posix_acl_release(*acl); @@ -591,6 +589,12 @@ no_acl: *default_acl = NULL; *acl = NULL; return 0; + +no_mem_clone: + posix_acl_release(*acl); +no_mem: + posix_acl_release(p); + return -ENOMEM; } EXPORT_SYMBOL_GPL(posix_acl_create);