Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1500863

[PATCH 4.4 19/21] ima: use file_dentry()

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.4 19/21] ima: use file_dentry()
Date 2016-10-14 13:50 +0200
Message-ID <ss99V-JJ-71@gated-at.bofh.it> (permalink)
References <ss99T-JJ-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Miklos Szeredi <mszeredi@redhat.com>

commit e71b9dff0634edb127f449e076e883ef24a8c76c upstream.

Ima tries to call ->setxattr() on overlayfs dentry after having locked
underlying inode, which results in a deadlock.

Reported-by: Krisztian Litkey <kli@iki.fi>
Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay and f_inode to the underlay")
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 security/integrity/ima/ima_api.c      |    2 +-
 security/integrity/ima/ima_appraise.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

--- a/security/integrity/ima/ima_api.c
+++ b/security/integrity/ima/ima_api.c
@@ -202,7 +202,7 @@ int ima_collect_measurement(struct integ
 	} hash;
 
 	if (xattr_value)
-		*xattr_len = ima_read_xattr(file->f_path.dentry, xattr_value);
+		*xattr_len = ima_read_xattr(file_dentry(file), xattr_value);
 
 	if (!(iint->flags & IMA_COLLECTED)) {
 		u64 i_version = file_inode(file)->i_version;
--- a/security/integrity/ima/ima_appraise.c
+++ b/security/integrity/ima/ima_appraise.c
@@ -189,7 +189,7 @@ int ima_appraise_measurement(int func, s
 {
 	static const char op[] = "appraise_data";
 	char *cause = "unknown";
-	struct dentry *dentry = file->f_path.dentry;
+	struct dentry *dentry = file_dentry(file);
 	struct inode *inode = d_backing_inode(dentry);
 	enum integrity_status status = INTEGRITY_UNKNOWN;
 	int rc = xattr_len, hash_start = 0;
@@ -289,7 +289,7 @@ out:
  */
 void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file)
 {
-	struct dentry *dentry = file->f_path.dentry;
+	struct dentry *dentry = file_dentry(file);
 	int rc = 0;
 
 	/* do not collect and update hash for digital signatures */

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.4 00/21] 4.4.25-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 13:50 +0200
  [PATCH 4.4 19/21] ima: use file_dentry() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 13:50 +0200
  [PATCH 4.4 04/21] ALSA: usb-audio: Extend DragonFly dB scale quirk to cover other variants Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 13:50 +0200
  [PATCH 4.4 20/21] tpm: fix a race condition in tpm2_unseal_trusted() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 13:50 +0200
  [PATCH 4.4 14/21] x86/irq: Prevent force migration of irqs which are not in the vector domain Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 13:50 +0200
  [PATCH 4.4 03/21] ALSA: ali5451: Fix out-of-bound position reporting Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-10-14 13:50 +0200
  Re: [PATCH 4.4 00/21] 4.4.25-stable review Shuah Khan <shuah.kh@samsung.com> - 2016-10-14 20:50 +0200
  Re: [PATCH 4.4 00/21] 4.4.25-stable review Guenter Roeck <linux@roeck-us.net> - 2016-10-14 21:20 +0200

csiph-web