Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs: set root to null in btrfs_search_path_in_tree_user
@ 2020-02-27 15:07 Josef Bacik
  2020-02-28 15:59 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Josef Bacik @ 2020-02-27 15:07 UTC (permalink / raw)
  To: linux-btrfs, kernel-team; +Cc: Dan Carpenter

We could potentially have root uninitialized in some cases, so this will
cause problems with btrfs_put_root.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
- Dave, this can be folded into "btrfs: hold a ref on the root in
  btrfs_search_path_in_tree_user"

 fs/btrfs/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 0bd691055e51..92cb38c9889a 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2388,7 +2388,7 @@ static int btrfs_search_path_in_tree_user(struct inode *inode,
 	unsigned long item_len;
 	struct btrfs_inode_ref *iref;
 	struct btrfs_root_ref *rref;
-	struct btrfs_root *root;
+	struct btrfs_root *root = NULL;
 	struct btrfs_path *path;
 	struct btrfs_key key, key2;
 	struct extent_buffer *leaf;
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs: set root to null in btrfs_search_path_in_tree_user
  2020-02-27 15:07 [PATCH] btrfs: set root to null in btrfs_search_path_in_tree_user Josef Bacik
@ 2020-02-28 15:59 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2020-02-28 15:59 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-btrfs, kernel-team, Dan Carpenter

On Thu, Feb 27, 2020 at 10:07:08AM -0500, Josef Bacik wrote:
> We could potentially have root uninitialized in some cases, so this will
> cause problems with btrfs_put_root.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
> - Dave, this can be folded into "btrfs: hold a ref on the root in
>   btrfs_search_path_in_tree_user"

Folded, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-28 15:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-27 15:07 [PATCH] btrfs: set root to null in btrfs_search_path_in_tree_user Josef Bacik
2020-02-28 15:59 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox