diff options
author | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2009-06-26 14:05:27 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-06-28 18:59:10 -0400 |
commit | 94e5d714f604d4cb4cb13163f01ede278e69258b (patch) | |
tree | 1f7f50f5eddf74e6930eaf0384538549f263b8fe /fs | |
parent | 79b854c549c62c54fa27f87e04465c01db889f8d (diff) |
integrity: add ima_counts_put (updated)
This patch fixes an imbalance message as reported by J.R. Okajima.
The IMA file counters are incremented in ima_path_check. If the
actual open fails, such as ETXTBSY, decrement the counters to
prevent unnecessary imbalance messages.
Reported-by: J.R. Okajima <hooanon05@yahoo.co.jp>
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namei.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c index 5b961eb71cbf..f3c5b278895a 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1761,6 +1761,10 @@ do_last: | |||
1761 | goto exit; | 1761 | goto exit; |
1762 | } | 1762 | } |
1763 | filp = nameidata_to_filp(&nd, open_flag); | 1763 | filp = nameidata_to_filp(&nd, open_flag); |
1764 | if (IS_ERR(filp)) | ||
1765 | ima_counts_put(&nd.path, | ||
1766 | acc_mode & (MAY_READ | MAY_WRITE | | ||
1767 | MAY_EXEC)); | ||
1764 | mnt_drop_write(nd.path.mnt); | 1768 | mnt_drop_write(nd.path.mnt); |
1765 | if (nd.root.mnt) | 1769 | if (nd.root.mnt) |
1766 | path_put(&nd.root); | 1770 | path_put(&nd.root); |
@@ -1817,6 +1821,9 @@ ok: | |||
1817 | goto exit; | 1821 | goto exit; |
1818 | } | 1822 | } |
1819 | filp = nameidata_to_filp(&nd, open_flag); | 1823 | filp = nameidata_to_filp(&nd, open_flag); |
1824 | if (IS_ERR(filp)) | ||
1825 | ima_counts_put(&nd.path, | ||
1826 | acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC)); | ||
1820 | /* | 1827 | /* |
1821 | * It is now safe to drop the mnt write | 1828 | * It is now safe to drop the mnt write |
1822 | * because the filp has had a write taken | 1829 | * because the filp has had a write taken |