Skip to content

Commit e71b9df

Browse files
author
Miklos Szeredi
committed
ima: use file_dentry()
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: 4bacc9c ("overlayfs: Make f_path always point to the overlay and f_inode to the underlay") Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Cc: <stable@vger.kernel.org> # v4.2 Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
1 parent 9395452 commit e71b9df

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎security/integrity/ima/ima_appraise.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ int ima_appraise_measurement(enum ima_hooks func,
190190
{
191191
static const char op[] = "appraise_data";
192192
char *cause = "unknown";
193-
struct dentry *dentry = file->f_path.dentry;
193+
struct dentry *dentry = file_dentry(file);
194194
struct inode *inode = d_backing_inode(dentry);
195195
enum integrity_status status = INTEGRITY_UNKNOWN;
196196
int rc = xattr_len, hash_start = 0;
@@ -295,7 +295,7 @@ int ima_appraise_measurement(enum ima_hooks func,
295295
*/
296296
void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file)
297297
{
298-
struct dentry *dentry = file->f_path.dentry;
298+
struct dentry *dentry = file_dentry(file);
299299
int rc = 0;
300300

301301
/* do not collect and update hash for digital signatures */

‎security/integrity/ima/ima_main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static int process_measurement(struct file *file, char *buf, loff_t size,
228228
if ((action & IMA_APPRAISE_SUBMASK) ||
229229
strcmp(template_desc->name, IMA_TEMPLATE_IMA_NAME) != 0)
230230
/* read 'security.ima' */
231-
xattr_len = ima_read_xattr(file->f_path.dentry, &xattr_value);
231+
xattr_len = ima_read_xattr(file_dentry(file), &xattr_value);
232232

233233
hash_algo = ima_get_hash_algo(xattr_value, xattr_len);
234234

0 commit comments

Comments
 (0)