grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] zfs: dnode_get_path(): update dangling dn_new pointer


From: Jagannathan Raman
Subject: [PATCH 1/2] zfs: dnode_get_path(): update dangling dn_new pointer
Date: Mon, 17 Oct 2022 14:04:38 +0000

dnode_get_path() traverses dnode structures to locate the dnode leaf of
a given path. When the leaf is a symlink to another path, it restarts
the traversal either from root or from a different path. In such cases,
dn_new must be re-initialized

Passes 'make check'

Fixes: CID 86750

Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
---
 grub-core/fs/zfs/zfs.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
index 24b6533dd..90156d98b 100644
--- a/grub-core/fs/zfs/zfs.c
+++ b/grub-core/fs/zfs/zfs.c
@@ -2936,6 +2936,8 @@ dnode_get_path (struct subvolume *subvol, const char 
*path_in, dnode_end_t *dn,
                       grub_strlen (oldpath) + 1);
 
          grub_free (oldpathbuf);
+
+         /* Restart dnode walk using path of symlink */
          if (path[0] != '/')
            {
              dn_new = dnode_path;
@@ -2948,6 +2950,7 @@ dnode_get_path (struct subvolume *subvol, const char 
*path_in, dnode_end_t *dn,
                   dnode_path = dn_new->next;
                   grub_free (dn_new);
                 }
+         dn_new = dnode_path;
        }
       if (dnode_path->dn.dn.dn_bonustype == DMU_OT_SA)
        {
@@ -2999,6 +3002,8 @@ dnode_get_path (struct subvolume *subvol, const char 
*path_in, dnode_end_t *dn,
                           grub_strlen (oldpath) + 1);
 
              grub_free (oldpathbuf);
+
+             /* Restart dnode walk using path of symlink */
              if (path[0] != '/')
                {
                  dn_new = dnode_path;
@@ -3011,6 +3016,7 @@ dnode_get_path (struct subvolume *subvol, const char 
*path_in, dnode_end_t *dn,
                       dnode_path = dn_new->next;
                       grub_free (dn_new);
                     }
+             dn_new = dnode_path;
            }
        }
     }
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]