All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fixes for CIDs 86750 and 396931
@ 2022-10-17 14:04 Jagannathan Raman
  2022-10-17 14:04 ` [PATCH 1/2] zfs: dnode_get_path(): update dangling dn_new pointer Jagannathan Raman
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jagannathan Raman @ 2022-10-17 14:04 UTC (permalink / raw)
  To: grub-devel; +Cc: daniel.kiper, darren.kenny, ross.philipson, alec.r.brown

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(-)

-- 
2.20.1



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

* [PATCH 1/2] zfs: dnode_get_path(): update dangling dn_new pointer
  2022-10-17 14:04 [PATCH 0/2] Fixes for CIDs 86750 and 396931 Jagannathan Raman
@ 2022-10-17 14:04 ` Jagannathan Raman
  2022-10-17 14:04 ` [PATCH 2/2] kern/buffer: grub_buffer_free: handle NULL input pointer Jagannathan Raman
  2022-10-17 14:37 ` [PATCH 0/2] Fixes for CIDs 86750 and 396931 Ross Philipson
  2 siblings, 0 replies; 5+ messages in thread
From: Jagannathan Raman @ 2022-10-17 14:04 UTC (permalink / raw)
  To: grub-devel; +Cc: daniel.kiper, darren.kenny, ross.philipson, alec.r.brown

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



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

* [PATCH 2/2] kern/buffer: grub_buffer_free: handle NULL input pointer
  2022-10-17 14:04 [PATCH 0/2] Fixes for CIDs 86750 and 396931 Jagannathan Raman
  2022-10-17 14:04 ` [PATCH 1/2] zfs: dnode_get_path(): update dangling dn_new pointer Jagannathan Raman
@ 2022-10-17 14:04 ` Jagannathan Raman
  2022-10-17 14:37 ` [PATCH 0/2] Fixes for CIDs 86750 and 396931 Ross Philipson
  2 siblings, 0 replies; 5+ messages in thread
From: Jagannathan Raman @ 2022-10-17 14:04 UTC (permalink / raw)
  To: grub-devel; +Cc: daniel.kiper, darren.kenny, ross.philipson, alec.r.brown

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

Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
---
 grub-core/kern/buffer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/grub-core/kern/buffer.c b/grub-core/kern/buffer.c
index 9f5f8b867..a2587729c 100644
--- a/grub-core/kern/buffer.c
+++ b/grub-core/kern/buffer.c
@@ -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
-- 
2.20.1



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

* Re: [PATCH 0/2] Fixes for CIDs 86750 and 396931
  2022-10-17 14:04 [PATCH 0/2] Fixes for CIDs 86750 and 396931 Jagannathan Raman
  2022-10-17 14:04 ` [PATCH 1/2] zfs: dnode_get_path(): update dangling dn_new pointer Jagannathan Raman
  2022-10-17 14:04 ` [PATCH 2/2] kern/buffer: grub_buffer_free: handle NULL input pointer Jagannathan Raman
@ 2022-10-17 14:37 ` Ross Philipson
  2022-10-17 15:34   ` Daniel Kiper
  2 siblings, 1 reply; 5+ messages in thread
From: Ross Philipson @ 2022-10-17 14:37 UTC (permalink / raw)
  To: Jagannathan Raman, grub-devel; +Cc: daniel.kiper, darren.kenny, alec.r.brown

On 10/17/22 10:04, Jagannathan Raman wrote:
> Hi,
> 
> This series provides fixes for CIDs 86750 and 396931.
> 
> Kindly share your feedback.
> 
> Thank you very much!

These LGTM

Reviewed-by: Ross Philipson <ross.philipson@oracle.com>

> --
> 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(-)
> 



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

* Re: [PATCH 0/2] Fixes for CIDs 86750 and 396931
  2022-10-17 14:37 ` [PATCH 0/2] Fixes for CIDs 86750 and 396931 Ross Philipson
@ 2022-10-17 15:34   ` Daniel Kiper
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Kiper @ 2022-10-17 15:34 UTC (permalink / raw)
  To: Ross Philipson
  Cc: Jagannathan Raman, grub-devel, daniel.kiper, darren.kenny, alec.r.brown

On Mon, Oct 17, 2022 at 10:37:08AM -0400, Ross Philipson wrote:
> On 10/17/22 10:04, Jagannathan Raman wrote:
> > Hi,
> >
> > This series provides fixes for CIDs 86750 and 396931.
> >
> > Kindly share your feedback.
> >
> > Thank you very much!
>
> These LGTM
>
> Reviewed-by: Ross Philipson <ross.philipson@oracle.com>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel


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

end of thread, other threads:[~2022-10-17 15:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-17 14:04 [PATCH 0/2] Fixes for CIDs 86750 and 396931 Jagannathan Raman
2022-10-17 14:04 ` [PATCH 1/2] zfs: dnode_get_path(): update dangling dn_new pointer Jagannathan Raman
2022-10-17 14:04 ` [PATCH 2/2] kern/buffer: grub_buffer_free: handle NULL input pointer Jagannathan Raman
2022-10-17 14:37 ` [PATCH 0/2] Fixes for CIDs 86750 and 396931 Ross Philipson
2022-10-17 15:34   ` Daniel Kiper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.