lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri,  2 Dec 2016 19:53:18 -0500
From:   James Simmons <jsimmons@...radead.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        devel@...verdev.osuosl.org,
        Andreas Dilger <andreas.dilger@...el.com>,
        Oleg Drokin <oleg.drokin@...el.com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Lustre Development List <lustre-devel@...ts.lustre.org>,
        Li Dongyang <dongyang.li@....edu.au>,
        James Simmons <jsimmons@...radead.org>
Subject: [PATCH 11/22] staging: lustre: mdt: fail FMODE_WRITE open if the client is read only

From: Li Dongyang <dongyang.li@....edu.au>

O_WRONLY/O_RDWR open on a file will get EROFS on a read only client,
but the rpc gets sent to the mdt anyway.
mdt will increase the mot_write_count of the mdt object, blocking
subsequent FMODE_EXEC open to the same file.

This patch makes sure we fail the FMODE_WRITE open with EROFS on the
client straight away without sending the rpc to mdt.

Signed-off-by: Li Dongyang <dongyang.li@....edu.au>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7727
Reviewed-on: http://review.whamcloud.com/18242
Reviewed-by: Ian Costello <icostello@....com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@...el.com>
Reviewed-by: Yang Sheng <yang.sheng@...el.com>
Reviewed-by: Oleg Drokin <oleg.drokin@...el.com>
Signed-off-by: James Simmons <jsimmons@...radead.org>
---
 drivers/staging/lustre/lustre/llite/namei.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
index b07079c..9426759 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -572,6 +572,10 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request,
 		}
 	}
 
+	if (it->it_op & IT_OPEN && it->it_flags & FMODE_WRITE &&
+	    dentry->d_sb->s_flags & MS_RDONLY)
+		return ERR_PTR(-EROFS);
+
 	if (it->it_op & IT_CREAT)
 		opc = LUSTRE_OPC_CREATE;
 	else
-- 
1.7.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ