From patchwork Tue May 22 15:22:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Johansen X-Patchwork-Id: 160664 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 3A435B6EEB for ; Wed, 23 May 2012 01:22:57 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SWqvB-0006Jv-Ge; Tue, 22 May 2012 15:22:49 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SWqv9-0006IX-MT for kernel-team@lists.ubuntu.com; Tue, 22 May 2012 15:22:47 +0000 Received: from static-50-53-53-239.bvtn.or.frontiernet.net ([50.53.53.239] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SWqv9-00061G-5W for kernel-team@lists.ubuntu.com; Tue, 22 May 2012 15:22:47 +0000 From: John Johansen To: kernel-team@lists.ubuntu.com Subject: [PATCH 5/5] UBUNTU: [upstream] apparmor: fix long path failure due to disconnected path Date: Tue, 22 May 2012 08:22:21 -0700 Message-Id: <1337700142-13370-6-git-send-email-john.johansen@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1337700142-13370-1-git-send-email-john.johansen@canonical.com> References: <1337700142-13370-1-git-send-email-john.johansen@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com OriginalLocation: security/next cffee16e8b997ab947de661e8820e486b0830c94 BugLink: http://bugs.launchpad.net/bugs/955892 All failures from __d_path where being treated as disconnected paths, however __d_path can also fail when the generated pathname is too long. The initial ENAMETOOLONG error was being lost, and ENAMETOOLONG was only returned if the subsequent dentry_path call resulted in that error. Other wise if the path was split across a mount point such that the dentry_path fit within the buffer when the __d_path did not the failure was treated as a disconnected path. Signed-off-by: John Johansen --- security/apparmor/path.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/apparmor/path.c b/security/apparmor/path.c index 2daeea4..e91ffee 100644 --- a/security/apparmor/path.c +++ b/security/apparmor/path.c @@ -94,6 +94,8 @@ static int d_namespace_path(struct path *path, char *buf, int buflen, * be returned. */ if (!res || IS_ERR(res)) { + if (PTR_ERR(res) == -ENAMETOOLONG) + return -ENAMETOOLONG; connected = 0; res = dentry_path_raw(path->dentry, buf, buflen); if (IS_ERR(res)) {