All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: Steve French <sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org
Subject: [patch] cifs: accidentally creating empty files
Date: Wed, 28 Sep 2011 00:28:10 +0300	[thread overview]
Message-ID: <20110927212810.GA12900@elgon.mountain> (raw)

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

             reply	other threads:[~2011-09-27 21:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27 21:28 Dan Carpenter [this message]
2011-10-13 14:00 ` [patch] cifs: accidentally creating empty files 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110927212810.GA12900@elgon.mountain \
    --to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org \
    --cc=sfrench-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.