diff mbox

btrfs: Check error of btrfs_iget() in btrfs_search_path_in_tree_user()

Message ID c88f81e3-1dff-35a8-89ce-d9d3050be101@jp.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Misono Tomohiro June 4, 2018, 7:41 a.m. UTC
Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
---

Hi david,

It seems that v8 patch I sent last week is missed and commit in misc-next
tree is also a bit updated from v7, so I resend the fix as a separate patch.

Please fold this patch to current misc-next (head is the commit to be fixed:
"btrfs: Add unprivileged version of ino_lookup ioctl").

Thanks,
Tomohiro Misono

 fs/btrfs/ioctl.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

David Sterba June 5, 2018, 2:10 p.m. UTC | #1
On Mon, Jun 04, 2018 at 04:41:07PM +0900, Misono Tomohiro wrote:
> Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
> ---
> 
> Hi david,
> 
> It seems that v8 patch I sent last week is missed and commit in misc-next
> tree is also a bit updated from v7, so I resend the fix as a separate patch.
> 
> Please fold this patch to current misc-next (head is the commit to be fixed:
> "btrfs: Add unprivileged version of ino_lookup ioctl").

Somehow it got lost on the way to the pull request branch, there were
several other things to fix in the patch so I forgot that one. This also
means I cannot fold it so it needs to be separate, based on this patch.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index d29992f7dc63..5556e9ea2a4b 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2438,6 +2438,10 @@  static int btrfs_search_path_in_tree_user(struct inode *inode,
 			}
 
 			temp_inode = btrfs_iget(sb, &key2, root, NULL);
+			if (IS_ERR(temp_inode)) {
+				ret = PTR_ERR(temp_inode);
+				goto out;
+			}
 			ret = inode_permission(temp_inode, MAY_READ | MAY_EXEC);
 			iput(temp_inode);
 			if (ret) {