diff mbox series

[ovs-dev,v1,1/2] lib/actions: Check for tunnel_ofport fn ptr null before calling.

Message ID 20251223152359.3562722-1-numans@ovn.org
State Accepted
Headers show
Series [ovs-dev,v1,1/2] lib/actions: Check for tunnel_ofport fn ptr null before calling. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Numan Siddique Dec. 23, 2025, 3:23 p.m. UTC
From: Numan Siddique <numans@ovn.org>

This check is added to address NULL deference issue reported by
coverity.  br-controller also uses the lib/actions and it sets
the 'tunnel_ofport' in the 'struct ovnact_encode_params' to NULL.
br-controller can crash if a user uses the OVN logical action -
fwd_group() even though it is not supported.

Ideally br-controller should define its own supported OVN actions
as a proper fix.  This patch is just a temporary fix until we add
this support.

Signed-off-by: Numan Siddique <numans@ovn.org>
---
 lib/actions.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ales Musil Jan. 5, 2026, 8:41 a.m. UTC | #1
On Tue, Dec 23, 2025 at 4:24 PM <numans@ovn.org> wrote:

> From: Numan Siddique <numans@ovn.org>
>
> This check is added to address NULL deference issue reported by
> coverity.  br-controller also uses the lib/actions and it sets
> the 'tunnel_ofport' in the 'struct ovnact_encode_params' to NULL.
> br-controller can crash if a user uses the OVN logical action -
> fwd_group() even though it is not supported.
>
> Ideally br-controller should define its own supported OVN actions
> as a proper fix.  This patch is just a temporary fix until we add
> this support.
>
> Signed-off-by: Numan Siddique <numans@ovn.org>
> ---
>  lib/actions.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/actions.c b/lib/actions.c
> index 53f4d20a9f..a2e3897016 100644
> --- a/lib/actions.c
> +++ b/lib/actions.c
> @@ -4212,7 +4212,8 @@ encode_FWD_GROUP(const struct ovnact_fwd_group
> *fwd_group,
>
>          if (fwd_group->liveness) {
>              /* Find the openflow port number of the tunnel port */
> -            if (!ep->tunnel_ofport(ep->aux, port_name, &ofport)) {
> +            if (!ep->tunnel_ofport ||
> +                !ep->tunnel_ofport(ep->aux, port_name, &ofport)) {
>                  ds_destroy(&ds);
>                  return;
>              }
> --
> 2.52.0
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
Thank you Numan,

I went ahead and merged this into main.

Regards,
Ales
diff mbox series

Patch

diff --git a/lib/actions.c b/lib/actions.c
index 53f4d20a9f..a2e3897016 100644
--- a/lib/actions.c
+++ b/lib/actions.c
@@ -4212,7 +4212,8 @@  encode_FWD_GROUP(const struct ovnact_fwd_group *fwd_group,
 
         if (fwd_group->liveness) {
             /* Find the openflow port number of the tunnel port */
-            if (!ep->tunnel_ofport(ep->aux, port_name, &ofport)) {
+            if (!ep->tunnel_ofport ||
+                !ep->tunnel_ofport(ep->aux, port_name, &ofport)) {
                 ds_destroy(&ds);
                 return;
             }