Skip to content

Commit

Permalink
scripts: ensure the cocci script for miiphy_register does not leak th…
Browse files Browse the repository at this point in the history
…e MDIO bus

When mdio_register fails, mdio_free should be called on the mdiodev that
was previously allocated with mdio_alloc.

Signed-off-by: Vladimir Oltean <[email protected]>
  • Loading branch information
vladimiroltean authored and mellowcandle committed Sep 28, 2021
1 parent 19ef59f commit 4df9f5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/coccinelle/net/mdio_register.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ identifier readfunc, writefunc;
+ mdiodev->write = writefunc;
+
+ retval = mdio_register(mdiodev);
+ if (retval < 0) return retval;
+ if (retval < 0) { mdio_free(mdiodev); return retval; }

@ update_read_sig @
identifier mii_reg.readfunc;
Expand Down

0 comments on commit 4df9f5e

Please sign in to comment.