From patchwork Wed May 4 02:54:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel J Blueman X-Patchwork-Id: 752472 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p442tJMO015374 for ; Wed, 4 May 2011 02:55:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754801Ab1EDCy7 (ORCPT ); Tue, 3 May 2011 22:54:59 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:38890 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754753Ab1EDCy7 (ORCPT ); Tue, 3 May 2011 22:54:59 -0400 Received: by pvg12 with SMTP id 12so307534pvg.19 for ; Tue, 03 May 2011 19:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=ufv5fcXmV0BYhab7Op61levi9TtJKmpwVC921S9Aoy8=; b=SZ2INKTTKJf4vOIzREWm4EBag6T4DacQ5X3FvbI3QcDZQuHibaWKIzfWjYyRdJaFEh LmisKkjxmjrlrj//rzTQi22D/Y8Lhnr57gMAS3pFGTkofNuhVvTk758865BOXcN6ZEGK Mss8WvNsmnpm0ZHQMV81GPSEZtEch1FaKNgKs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=k/g/GLezwbP4Lwvq9kqwJHnJ4GeiL/ReEi1rdsa5f2zh8G6IcwRVX8tGUJHDAL/ph+ wRwWN1DlsmLrMLgMJPmJJP8/+lMGQA5hI/ANAiwBeLYtBzsyHO9CN8iKB6lz/jfPKRk/ oLle0cj/ulJd9CRZwIEwn1fGR7JDs/Rf1khHo= Received: by 10.68.41.9 with SMTP id b9mr832469pbl.436.1304477698460; Tue, 03 May 2011 19:54:58 -0700 (PDT) Received: from localhost.localdomain ([119.75.36.222]) by mx.google.com with ESMTPS id q10sm430710pbk.39.2011.05.03.19.54.54 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 May 2011 19:54:57 -0700 (PDT) From: Daniel J Blueman To: Chris Mason Cc: Daniel J Blueman , Christian Brunner , Josef Bacik , linux-btrfs@vger.kernel.org Subject: [PATCH, fixed] Prevent oopsing in posix_acl_valid() Date: Wed, 4 May 2011 10:54:08 +0800 Message-Id: <1304477648-14952-1-git-send-email-daniel.blueman@gmail.com> X-Mailer: git-send-email 1.7.4.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 04 May 2011 02:55:20 +0000 (UTC) If posix_acl_from_xattr() returns an error code, a negative address is dereferenced causing an oops; fix by checking for an error code first. Typo fixed; too much late-night coding. Signed-off-by: Daniel J Blueman Reviewed-by: Josef Bacik --- fs/btrfs/acl.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 5d505aa..44ea5b9 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c @@ -178,12 +178,13 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name, if (value) { acl = posix_acl_from_xattr(value, size); + if (IS_ERR(acl)) + return PTR_ERR(acl); + if (acl) { ret = posix_acl_valid(acl); if (ret) goto out; - } else if (IS_ERR(acl)) { - return PTR_ERR(acl); } }