public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: caihuoqing@baidu.com
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] net: arc_emac: Make use of the helper function dev_err_probe()
Date: Mon, 20 Sep 2021 10:48:22 +0300	[thread overview]
Message-ID: <20210920074822.GA21488@kili> (raw)

Hello Cai Huoqing,

The patch 95b5fc03c189: "net: arc_emac: Make use of the helper
function dev_err_probe()" from Sep 15, 2021, leads to the following
Smatch static checker warning:

	drivers/net/ethernet/arc/emac_mdio.c:170 arc_mdio_probe()
	error: dereferencing freed memory 'bus'

drivers/net/ethernet/arc/emac_mdio.c
    164         snprintf(bus->id, MII_BUS_ID_SIZE, "%s", bus->name);
    165 
    166         error = of_mdiobus_register(bus, priv->dev->of_node);
    167         if (error) {
    168                 mdiobus_free(bus);
                                     ^^^
Freed

    169                 return dev_err_probe(priv->dev, error,
--> 170                                      "cannot register MDIO bus %s\n", bus->name);
                                                                              ^^^^^
Use after free.

    171         }
    172 
    173         return 0;
    174 }

regards,
dan carpenter

                 reply	other threads:[~2021-09-20  7:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210920074822.GA21488@kili \
    --to=dan.carpenter@oracle.com \
    --cc=caihuoqing@baidu.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox