]> Git Repo - linux.git/commitdiff
drivers: watchdog: exar_wdt.c fix use after free
authorManank Patel <[email protected]>
Thu, 13 Oct 2022 09:52:58 +0000 (15:22 +0530)
committerWim Van Sebroeck <[email protected]>
Wed, 19 Oct 2022 17:49:47 +0000 (19:49 +0200)
fix use after free by storing the result of PTR_ERR(n->pdev)
to a local variable before returning.

Signed-off-by: Manank Patel <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Wim Van Sebroeck <[email protected]>
drivers/watchdog/exar_wdt.c

index 35058d8b21bc71334822bd9491b0a9f327835a53..7c61ff3432711623aa4f6992f41c94f2664a5372 100644 (file)
@@ -355,8 +355,10 @@ static int __init exar_wdt_register(struct wdt_priv *priv, const int idx)
                                                    &priv->wdt_res, 1,
                                                    priv, sizeof(*priv));
        if (IS_ERR(n->pdev)) {
+               int err = PTR_ERR(n->pdev);
+
                kfree(n);
-               return PTR_ERR(n->pdev);
+               return err;
        }
 
        list_add_tail(&n->list, &pdev_list);
This page took 0.086282 seconds and 4 git commands to generate.