mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH 7/8] cifs_create() fix
@ 2005-08-24 21:42 Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2005-08-24 21:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: miklos

OK - that fix looks fine and is now in the cifs-2.6.git (I will wait for
2.6.13 to push that and the other 20+ cifs changesets).

Thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 7/8] cifs_create() fix
  2005-08-23 20:43           ` [PATCH 6/8] remove duplicated sys_open32() code from 64bit archs Miklos Szeredi
@ 2005-08-23 20:45             ` Miklos Szeredi
  0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2005-08-23 20:45 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, smfrench

cifs_create() did totally the wrong thing with nd->intent.open.flags:
it interpreted nd->intent.open.flags as the original open flags, not
the one transformed for open_namei().  Also it used the intent data
even if it was not filled in (if called from sys_mknod()).

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>

Index: linux/fs/cifs/dir.c
===================================================================
--- linux.orig/fs/cifs/dir.c	2005-08-23 11:01:58.000000000 +0200
+++ linux/fs/cifs/dir.c	2005-08-23 11:09:03.000000000 +0200
@@ -145,24 +145,23 @@ cifs_create(struct inode *inode, struct 
 		return -ENOMEM;
 	}
 
-	if(nd) {
-		if ((nd->intent.open.flags & O_ACCMODE) == O_RDONLY)
-			desiredAccess = GENERIC_READ;
-		else if ((nd->intent.open.flags & O_ACCMODE) == O_WRONLY) {
-			desiredAccess = GENERIC_WRITE;
-			write_only = TRUE;
-		} else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR) {
-			/* GENERIC_ALL is too much permission to request */
-			/* can cause unnecessary access denied on create */
-			/* desiredAccess = GENERIC_ALL; */
-			desiredAccess = GENERIC_READ | GENERIC_WRITE;
+	if(nd && (nd->flags & LOOKUP_OPEN)) {
+		int oflags = nd->intent.open.flags;
+
+		desiredAccess = 0;		
+		if (oflags & FMODE_READ)
+			desiredAccess |= GENERIC_READ;
+		if (oflags & FMODE_WRITE) {
+			desiredAccess |= GENERIC_WRITE;
+			if (!(oflags & FMODE_READ))
+				write_only = TRUE;
 		}
 
-		if((nd->intent.open.flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
+		if((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
 			disposition = FILE_CREATE;
-		else if((nd->intent.open.flags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC))
+		else if((oflags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC))
 			disposition = FILE_OVERWRITE_IF;
-		else if((nd->intent.open.flags & O_CREAT) == O_CREAT)
+		else if((oflags & O_CREAT) == O_CREAT)
 			disposition = FILE_OPEN_IF;
 		else {
 			cFYI(1,("Create flag not set in create function"));

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-24 21:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-24 21:42 [PATCH 7/8] cifs_create() fix Steve French
  -- strict thread matches above, loose matches on Subject: below --
2005-08-23 20:22 [PATCH 0/8] filesystem related cleanups and fixes Miklos Szeredi
2005-08-23 20:24 ` [PATCH 1/8] remove ia_attr_flags Miklos Szeredi
2005-08-23 20:26   ` [PATCH 2/8] namei cleanup Miklos Szeredi
2005-08-23 20:30     ` [PATCH 3/8] use get_fs_struct() in proc Miklos Szeredi
2005-08-23 20:33       ` [PATCH 4/8] fix enum pid_directory_inos in proc/base.c Miklos Szeredi
2005-08-23 20:36         ` [PATCH 5/8] remove duplicated code from proc and ptrace Miklos Szeredi
2005-08-23 20:43           ` [PATCH 6/8] remove duplicated sys_open32() code from 64bit archs Miklos Szeredi
2005-08-23 20:45             ` [PATCH 7/8] cifs_create() fix Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®