Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [patch] cifs: accidentally creating empty files
@ 2011-09-27 21:28 Dan Carpenter
  2011-10-13 14:00 ` Dan Carpenter
  2011-10-13 17:27 ` Jeff Layton
  0 siblings, 2 replies; 15+ messages in thread
From: Dan Carpenter @ 2011-09-27 21:28 UTC (permalink / raw)
  To: Steve French
  Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ

This solves a problem for where a user without write permissions
was creating empty files.  This function was supposed to do a lookup
only, the create happens later.

Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 72d448b..8515afe 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -566,11 +566,13 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 		if (nd && !(nd->flags & LOOKUP_DIRECTORY) &&
 		     (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open &&
 		     (nd->intent.open.file->f_flags & O_CREAT)) {
+			unsigned int f_flags;
+
+			f_flags = (nd->intent.open.file->f_flags & ~O_CREAT);
 			rc = cifs_posix_open(full_path, &newInode,
 					parent_dir_inode->i_sb,
 					nd->intent.open.create_mode,
-					nd->intent.open.file->f_flags, &oplock,
-					&fileHandle, xid);
+					f_flags, &oplock, &fileHandle, xid);
 			/*
 			 * The check below works around a bug in POSIX
 			 * open in samba versions 3.3.1 and earlier where

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

end of thread, other threads:[~2011-10-30  5:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-27 21:28 [patch] cifs: accidentally creating empty files Dan Carpenter
2011-10-13 14:00 ` Dan Carpenter
2011-10-13 15:45   ` Steve French
2011-10-13 17:27 ` Jeff Layton
     [not found]   ` <20111013132755.6c5db87e-xSBYVWDuneFaJnirhKH9O4GKTjYczspe@public.gmane.org>
2011-10-13 18:09     ` Steve French
2011-10-20  2:14     ` Steve French
2011-10-28  7:20       ` Dan Carpenter
     [not found]         ` <20111028072019.GA14900-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
2011-10-28 15:27           ` Steve French
     [not found]             ` <CAH2r5msb_+tenSg1kWCn_0xi2EZu6vboqvmbQ17vRBYoqHp2Eg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-29  3:44               ` Jeff Layton
     [not found]                 ` <20111028234406.01fd23ba-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2011-10-29  5:07                   ` Steve French
     [not found]                     ` <CAH2r5mvHF0X6PQ8FyBfVEpQeyWgd7RGkawJykapkKt0K84QTHw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-29  5:48                       ` Jeff Layton
2011-10-29 22:03                         ` Steve French
     [not found]                           ` <CAH2r5muq4n34Liy_=CQQX-PeTinJFDAPi81fA-eqsTcXw5remQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-30  2:48                             ` Jeff Layton
     [not found]                               ` <20111029224852.15ee6302-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2011-10-30  2:53                                 ` Steve French
     [not found]                                   ` <CAH2r5msVoEuxo8vGj6sYjjNqjPeo9wxa-r7bAq6Or1_xS9EWFg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-30  5:36                                     ` Jeff Layton

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