Skip to contentSkip to conversation

Fixes for CIDs 86750 and 396931

PATCH In review Jagannathan Raman 3 participants 5 messages Oct 17, 2022

lore
Share & tools
lore
#0 lore raw

cover Fixes for CIDs 86750 and 396931

Hi,

This series provides fixes for CIDs 86750 and 396931.

Kindly share your feedback.

Thank you very much!
--
Jag

Jagannathan Raman (2):
zfs: dnode_get_path(): update dangling dn_new pointer kern/buffer: grub_buffer_free: handle NULL input pointer

 grub-core/fs/zfs/zfs.c  | 6 ++++++
 grub-core/kern/buffer.c | 7 +++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

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

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
---
 grub-core/fs/zfs/zfs.c | 6 ++++++
 1 file changed, 6 insertions(+)
grub-core/fs/zfs/zfs.c +6 -0
index 24b6533dd..90156d98b 100644
@@ -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;
 	    }
 	}
     }
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/2 kern/buffer: grub_buffer_free: handle NULL input pointer

In reply to Jagannathan Raman

grub_buffer_free() can handle NULL input pointer, similar to grub_free(). If the pointer is not referencing any memory location, grub_buffer_free() need not perform any function.

Fixes CID 396931
---
 grub-core/kern/buffer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
grub-core/kern/buffer.c +5 -2
index 9f5f8b867..a2587729c 100644
@@ -49,8 +49,11 @@ grub_buffer_new (grub_size_t sz)
 void
 grub_buffer_free (grub_buffer_t buf)
 {
-  grub_free (buf->data);
-  grub_free (buf);
+  if (buf != NULL)
+    {
+	grub_free (buf->data);
+	grub_free (buf);
+    }
 }
 
 grub_err_t
Signature · 1 line
2.20.1
Reviewed-by on the v1 series
#3 lore raw
In reply to Jagannathan Raman
Quoted 7 lines · Jagannathan Raman

Hi,

This series provides fixes for CIDs 86750 and 396931.

Kindly share your feedback.

Thank you very much!

These LGTM

Quoted 11 lines

--
Jag

Jagannathan Raman (2):
zfs: dnode_get_path(): update dangling dn_new pointer kern/buffer: grub_buffer_free: handle NULL input pointer

  grub-core/fs/zfs/zfs.c  | 6 ++++++
  grub-core/kern/buffer.c | 7 +++++--
  2 files changed, 11 insertions(+), 2 deletions(-)