device/linux-huawei-y530: fix lookup of symbolic links (!856)
This commit is contained in:
parent
ddb185b677
commit
ef4a30d29c
2 changed files with 84 additions and 2 deletions
|
@ -0,0 +1,80 @@
|
|||
From 562eac4226c2cf8718b8d87fc947545ccbb6dd20 Mon Sep 17 00:00:00 2001
|
||||
From: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Date: Mon, 4 Jun 2012 11:00:45 -0700
|
||||
Subject: [PATCH] vfs: Fix /proc/<tid>/fdinfo/<fd> file handling
|
||||
|
||||
Cyrill Gorcunov reports that I broke the fdinfo files with commit
|
||||
30a08bf2d31d ("proc: move fd symlink i_mode calculations into
|
||||
tid_fd_revalidate()"), and he's quite right.
|
||||
|
||||
The tid_fd_revalidate() function is not just used for the <tid>/fd
|
||||
symlinks, it's also used for the <tid>/fdinfo/<fd> files, and the
|
||||
permission model for those are different.
|
||||
|
||||
So do the dynamic symlink permission handling just for symlinks, making
|
||||
the fdinfo files once more appear as the proper regular files they are.
|
||||
|
||||
Of course, Al Viro argued (probably correctly) that we shouldn't do the
|
||||
symlink permission games at all, and make the symlinks always just be
|
||||
the normal 'lrwxrwxrwx'. That would have avoided this issue too, but
|
||||
since somebody noticed that the permissions had changed (which was the
|
||||
reason for that original commit 30a08bf2d31d in the first place), people
|
||||
do apparently use this feature.
|
||||
|
||||
[ Basically, you can use the symlink permission data as a cheap "fdinfo"
|
||||
replacement, since you see whether the file is open for reading and/or
|
||||
writing by just looking at st_mode of the symlink. So the feature
|
||||
does make sense, even if the pain it has caused means we probably
|
||||
shouldn't have done it to begin with. ]
|
||||
|
||||
Reported-and-tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
|
||||
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
---
|
||||
fs/proc/base.c | 17 ++++++++++-------
|
||||
1 file changed, 10 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/fs/proc/base.c b/fs/proc/base.c
|
||||
index 2f198dad..c8cb15dc 100644
|
||||
--- a/fs/proc/base.c
|
||||
+++ b/fs/proc/base.c
|
||||
@@ -1838,7 +1838,7 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
rcu_read_lock();
|
||||
file = fcheck_files(files, fd);
|
||||
if (file) {
|
||||
- unsigned i_mode, f_mode = file->f_mode;
|
||||
+ unsigned f_mode = file->f_mode;
|
||||
|
||||
rcu_read_unlock();
|
||||
put_files_struct(files);
|
||||
@@ -1854,12 +1854,14 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
inode->i_gid = 0;
|
||||
}
|
||||
|
||||
- i_mode = S_IFLNK;
|
||||
- if (f_mode & FMODE_READ)
|
||||
- i_mode |= S_IRUSR | S_IXUSR;
|
||||
- if (f_mode & FMODE_WRITE)
|
||||
- i_mode |= S_IWUSR | S_IXUSR;
|
||||
- inode->i_mode = i_mode;
|
||||
+ if (S_ISLNK(inode->i_mode)) {
|
||||
+ unsigned i_mode = S_IFLNK;
|
||||
+ if (f_mode & FMODE_READ)
|
||||
+ i_mode |= S_IRUSR | S_IXUSR;
|
||||
+ if (f_mode & FMODE_WRITE)
|
||||
+ i_mode |= S_IWUSR | S_IXUSR;
|
||||
+ inode->i_mode = i_mode;
|
||||
+ }
|
||||
|
||||
security_task_to_inode(task, inode);
|
||||
put_task_struct(task);
|
||||
@@ -1894,6 +1896,7 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
|
||||
ei = PROC_I(inode);
|
||||
ei->fd = fd;
|
||||
|
||||
+ inode->i_mode = S_IFLNK;
|
||||
inode->i_op = &proc_pid_link_inode_operations;
|
||||
inode->i_size = 64;
|
||||
ei->op.proc_get_link = proc_fd_link;
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
pkgname="linux-huawei-y530"
|
||||
pkgver=3.4.0
|
||||
pkgrel=7
|
||||
pkgrel=8
|
||||
pkgdesc="Kernel for Huawei MSM8x1x devices"
|
||||
arch="armv7"
|
||||
_carch="arm"
|
||||
|
@ -39,6 +39,7 @@ source="
|
|||
07_fix_mdss_fb_refresh_rate.patch
|
||||
08_fix_touchscreen.patch
|
||||
09_fix_various_include_directives.patch
|
||||
10_vfs-fix-proc-tid-fdinfo-fd-file-handling.patch
|
||||
"
|
||||
builddir="$srcdir/${_repository}-${_commit}"
|
||||
|
||||
|
@ -121,4 +122,5 @@ fbc61e379403990167853f4c4fbdfa22d7e9661a7eedecf2a75eec2a8008991a82d0a61be844ab4b
|
|||
384ae0bf2f5d7e15b0b60655693fd600b52c0f5bfcaa4ba7336d0ebeb224e84b99b597f77d26a1249e14a4e7bbc1629be00556b393bb9dd2266cb4bd67c3cfea 06_fix_mdss_fb_rgb_mode.patch
|
||||
1f743d3e7f4ac7401167ea35edc7d7e113bd80824c4d53631d7500f33557ff486163f8244786c16506b2e21db6ccbcd8a0f7b26fcf4937efee50b62c074f9a22 07_fix_mdss_fb_refresh_rate.patch
|
||||
f83e9b6549155a2f32c89dffbab3ad6fba7b8d93976dfccb1232833244ed6e064e28105a321eaa934c5bb326384730d03f3d3141227a7258a30045fa12573268 08_fix_touchscreen.patch
|
||||
c9831aa037d4cb26fa349c44a27111daf8f7a84a9527d0221ecc4f01839b195243c178838663ff7592bb1d5c3cdc9872b449254beb7b9dffa67c365c3d8e042c 09_fix_various_include_directives.patch"
|
||||
c9831aa037d4cb26fa349c44a27111daf8f7a84a9527d0221ecc4f01839b195243c178838663ff7592bb1d5c3cdc9872b449254beb7b9dffa67c365c3d8e042c 09_fix_various_include_directives.patch
|
||||
b0b9bcea00ca4a79ea6d6a9e0b153559161a102b0856193c7d775318beeb1d4ffb194127bf8f94f006930dd7cd330c3185f9bd205fef39e9856ffe9019fc2a34 10_vfs-fix-proc-tid-fdinfo-fd-file-handling.patch"
|
||||
|
|
Loading…
Reference in a new issue