From patchwork Fri Jan 31 15:25:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sage Weil X-Patchwork-Id: 3562611 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C242EC02DC for ; Fri, 31 Jan 2014 15:25:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9FECA20114 for ; Fri, 31 Jan 2014 15:25:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A8CBF20107 for ; Fri, 31 Jan 2014 15:25:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932476AbaAaPZ0 (ORCPT ); Fri, 31 Jan 2014 10:25:26 -0500 Received: from cobra.newdream.net ([66.33.216.30]:54322 "EHLO cobra.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932412AbaAaPZ0 (ORCPT ); Fri, 31 Jan 2014 10:25:26 -0500 Received: from cobra.newdream.net (localhost [127.0.0.1]) by cobra.newdream.net (Postfix) with ESMTP id F08498047F; Fri, 31 Jan 2014 07:25:25 -0800 (PST) Received: by cobra.newdream.net (Postfix, from userid 1031) id E722B813FD; Fri, 31 Jan 2014 07:25:25 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by cobra.newdream.net (Postfix) with ESMTP id D43D08047F; Fri, 31 Jan 2014 07:25:25 -0800 (PST) Date: Fri, 31 Jan 2014 07:25:25 -0800 (PST) From: Sage Weil X-X-Sender: sage@cobra.newdream.net To: torvalds@linux-foundation.org cc: ceph-devel@vger.kernel.org, julia.lawall@lip6.fr, fengguang.wu@intel.com Subject: [PATCH] ceph: fix missing dput in ceph_set_acl Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Add matching dput() for d_find_alias(). Move d_find_alias() down a bit at Julia's suggestion. Reported-by: Fengguang Wu Reported-by: Julia Lawall Signed-off-by: Sage Weil Reviewed-by: Ilya Dryomov --- fs/ceph/acl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index 9ab312e..4c2d452 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c @@ -107,7 +107,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) char *value = NULL; struct iattr newattrs; umode_t new_mode = inode->i_mode, old_mode = inode->i_mode; - struct dentry *dentry = d_find_alias(inode); + struct dentry *dentry; if (acl) { ret = posix_acl_valid(acl); @@ -151,12 +151,13 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) goto out_free; } + dentry = d_find_alias(inode); if (new_mode != old_mode) { newattrs.ia_mode = new_mode; newattrs.ia_valid = ATTR_MODE; ret = ceph_setattr(dentry, &newattrs); if (ret) - goto out_free; + goto out_dput; } if (value) @@ -170,11 +171,13 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) newattrs.ia_valid = ATTR_MODE; ceph_setattr(dentry, &newattrs); } - goto out_free; + goto out_dput; } ceph_set_cached_acl(inode, type, acl); +out_dput: + dput(dentry); out_free: kfree(value); out: