]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gve: Return error for unknown admin queue command
authorAlok Tiwari <alok.a.tiwari@oracle.com>
Mon, 16 Jun 2025 05:45:01 +0000 (22:45 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 18 Jun 2025 01:02:29 +0000 (18:02 -0700)
In gve_adminq_issue_cmd(), return -EINVAL instead of 0 when an unknown
admin queue command opcode is encountered.

This prevents the function from silently succeeding on invalid input
and prevents undefined behavior by ensuring the function fails gracefully
when an unrecognized opcode is provided.

These changes improve error handling.

Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Link: https://patch.msgid.link/20250616054504.1644770-2-alok.a.tiwari@oracle.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/google/gve/gve_adminq.c

index 1ec223383a36166dd8697ec485e806d726186b6a..4f33d094a2ef4006d7e47c778bcd59d279c6ec9c 100644 (file)
@@ -589,6 +589,7 @@ static int gve_adminq_issue_cmd(struct gve_priv *priv,
                break;
        default:
                dev_err(&priv->pdev->dev, "unknown AQ command opcode %d\n", opcode);
+               return -EINVAL;
        }
 
        return 0;