nfsd: Remove write permission from file content
Subsystems (3)
PATCH 1/1 nfsd: Remove write permission from file content
From: Yanchuan Nian <[email protected]>
The write function doesn't be implemented in file content, and it's meaningless to write data into this file directly. Remove write permission from it.
--- net/sunrpc/cache.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/sunrpc/cache.c +1 -1
@@ -1614,7 +1614,7 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) goto out_nomem; }if (cd->cache_show) { - p =proc_create_data ("content" ,S_IFREG |S_IRUSR |S_IWUSR , + p =proc_create_data ("content" ,S_IFREG |S_IRUSR , cd->u.procfs.proc_ent, &content_file_operations_procfs, cd); cd->u.procfs.content_ent = p;
Signature · 1 line
1.7.4.4
Quoted 4 lines · On Fri, Jan 04, 2013 at 07:45:35PM +0800, [email protected] wrote:
From: Yanchuan Nian <[email protected]>
The write function doesn't be implemented in file content, and it's meaningless to write data into this file directly. Remove write permission from it.
So does it really matter either way?
OK, applying, but I wonder.
--b.
Quoted 22 lines
Signed-off-by Yanchuan Nian <[email protected]>--- net/sunrpc/cache.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)net/sunrpc/cache.c +1
-1@@ -1614,7 +1614,7 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) goto out_nomem; }if (cd->cache_show) { - p =proc_create_data ("content" ,S_IFREG |S_IRUSR |S_IWUSR , + p =proc_create_data ("content" ,S_IFREG |S_IRUSR , cd->u.procfs.proc_ent, &content_file_operations_procfs, cd); cd->u.procfs.content_ent = p;Signature · 1 line
1.7.4.4
A message that is not in the archive (sent off-list or not yet received): CAC5OsZPR88SktqjTKsqJVaxKZ1LkPnvPcT2gPSFq_oPDZ1FZpw@mail.gmail.com
Quoted 11 lines · Yanchuan Nian
2013/1/5 J. Bruce Fields <[email protected]>
Quoted 9 lines · On Fri, Jan 04, 2013 at 07:45:35PM +0800, [email protected] wrote:
Quoted 3 lines
From: Yanchuan Nian <[email protected]>
The write function doesn't be implemented in file content, and it's
meaningless
Quoted 1 line
to write data into this file directly. Remove write permission from it.
So does it really matter either way?
Quoted 7 lines
No, it doesn't matter. I saw that nfs-utils communicates with nfsd through proc fs, so I tried to update the cache by writing data to proc fs directly. I found the format of "channel" and "flush" in nfs-utils, but I couldn't find the format of "content", so I read the sunrpc source code, and found that the write function doesn't be implemented, but the write permission is set when registering into proc fs. I also found that "content" in pipe fs doesn't have write permission.
OK, so if it had been read-only it might have saved you a little confusion. Fair enough.
--b.
Quoted 30 lines
Quoted 30 lines
OK, applying, but I wonder.
--b.
net/sunrpc/cache.c static int create_cache_proc_entries(struct
Quoted 11 lines
Signed-off-by Yanchuan Nian <[email protected]>--- net/sunrpc/cache.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)net/sunrpc/cache.c +0
-0@@ -1614,7 +1614,7 @@ static int create_cache_proc_entries(struct
cache_detail*cd, struct net *net)Quoted 11 lines
net/sunrpc/cache.c +1
-2goto out_nomem; }if (cd->cache_show) { - p =proc_create_data ("content" ,S_IFREG |S_IRUSR |S_IWUSR , + p =proc_create_data ("content" ,S_IFREG |S_IRUSR , cd->u.procfs.proc_ent, &content_file_operations_procfs, cd); cd->u.procfs.content_ent = p; --1.7.4.4