From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jason@zx2c4.com
Cc: bpf@vger.kernel.org
Subject: [bug report] net: WireGuard secure network tunnel
Date: Mon, 24 Aug 2020 17:15:19 +0300 [thread overview]
Message-ID: <20200824141519.GA223008@mwanda> (raw)
Hello Jason A. Donenfeld,
The patch e7096c131e51: "net: WireGuard secure network tunnel" from
Dec 9, 2019, leads to the following static checker warning:
net/core/dev.c:10103 netdev_run_todo()
warn: 'dev->_tx' double freed
net/core/dev.c
10071 /* Wait for rcu callbacks to finish before next phase */
10072 if (!list_empty(&list))
10073 rcu_barrier();
10074
10075 while (!list_empty(&list)) {
10076 struct net_device *dev
10077 = list_first_entry(&list, struct net_device, todo_list);
10078 list_del(&dev->todo_list);
10079
10080 if (unlikely(dev->reg_state != NETREG_UNREGISTERING)) {
10081 pr_err("network todo '%s' but state %d\n",
10082 dev->name, dev->reg_state);
10083 dump_stack();
10084 continue;
10085 }
10086
10087 dev->reg_state = NETREG_UNREGISTERED;
10088
10089 netdev_wait_allrefs(dev);
10090
10091 /* paranoia */
10092 BUG_ON(netdev_refcnt_read(dev));
10093 BUG_ON(!list_empty(&dev->ptype_all));
10094 BUG_ON(!list_empty(&dev->ptype_specific));
10095 WARN_ON(rcu_access_pointer(dev->ip_ptr));
10096 WARN_ON(rcu_access_pointer(dev->ip6_ptr));
10097 #if IS_ENABLED(CONFIG_DECNET)
10098 WARN_ON(dev->dn_ptr);
10099 #endif
10100 if (dev->priv_destructor)
10101 dev->priv_destructor(dev);
^^^^^^^^^^^^^^^^^^^^^^^^^
The wg_destruct() functions frees "dev".
10102 if (dev->needs_free_netdev)
^^^^^
Use after free.
10103 free_netdev(dev);
10104
10105 /* Report a network device has been unregistered */
10106 rtnl_lock();
10107 dev_net(dev)->dev_unreg_count--;
10108 __rtnl_unlock();
10109 wake_up(&netdev_unregistering_wq);
10110
10111 /* Free network device */
10112 kobject_put(&dev->dev.kobj);
10113 }
10114 }
regards,
dan carpenter
next reply other threads:[~2020-08-24 14:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-24 14:15 Dan Carpenter [this message]
2020-08-24 19:52 ` [bug report] net: WireGuard secure network tunnel Jason A. Donenfeld
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=20200824141519.GA223008@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Jason@zx2c4.com \
--cc=bpf@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