diff mbox

UBUNTU: [upstream] apparmor: fix long path failure due to disconnected path

Message ID 1337701739-13786-2-git-send-email-john.johansen@canonical.com
State New
Headers show

Commit Message

John Johansen May 22, 2012, 3:48 p.m. UTC
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 <john.johansen@canonical.com>
---
 security/apparmor/path.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Tim Gardner May 22, 2012, 4:01 p.m. UTC | #1

Colin Ian King May 22, 2012, 4:07 p.m. UTC | #2
On 22/05/12 16:48, John Johansen wrote:
> 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 <john.johansen@canonical.com>
> ---
>   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)) {
>
Looks OK to me, does what it says.

Acked-by: Colin Ian King <colin.king@canonical.com>
Tim Gardner May 22, 2012, 4:16 p.m. UTC | #3

diff mbox

Patch

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)) {