Messages in this thread | | | Subject | Re: [PATCH] clk: vc5: Fix use after free in vc5_probe | From | Stephen Boyd <> | Date | Tue, 21 Jul 2020 02:17:52 -0700 |
| |
Quoting trix@redhat.com (2020-07-19 07:33:24) > From: Tom Rix <trix@redhat.com> > > clang static analysis reports this error > > clk-versaclock5.c:887:3: warning: Use of memory after it is freed > [unix.Malloc] > dev_err(&client->dev, "unable to register %s\n", init.name); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > A representative problem block of code is > > ret = devm_clk_hw_register(&client->dev, &vc5->clk_mux); > kfree(init.name); /* clock framework made a copy of the name */ > if (ret) { > dev_err(&client->dev, "unable to register %s\n", init.name); > goto err_clk; > } > > init.name is freed and then used. > > So reorder the free. > > Fixes: f491276a5168 ("clk: vc5: Allow Versaclock driver to support multiple instances") > > Signed-off-by: Tom Rix <trix@redhat.com> > ---
There's another patch on the mailing list for this.
| |