* pull-request: can 2014-05-21 @ 2014-05-21 11:15 Marc Kleine-Budde 2014-05-21 11:15 ` [PATCH] can: peak_pci: prevent use after free at netdev removal Marc Kleine-Budde 2014-05-22 19:41 ` pull-request: can 2014-05-21 David Miller 0 siblings, 2 replies; 3+ messages in thread From: Marc Kleine-Budde @ 2014-05-21 11:15 UTC (permalink / raw) To: netdev; +Cc: davem, linux-can, kernel Hello David, this is a pull request for net/master, for the v3.15 release cycle, with a single patch. Christopher R. Baker found a use after free during unloading of the peak_pci driver. This is fixes in a patch by Stephane Grosjean. Marc --- The following changes since commit 78ff4be45a4c51d8fb21ad92e4fabb467c6c3eeb: ip_tunnel: Initialize the fallback device properly (2014-05-21 02:08:32 -0400) are available in the git repository at: git://gitorious.org/linux-can/linux-can.git tags/linux-can-fixes-for-3.15-20140521 for you to fetch changes up to 0b5a958cf4df3a5cd578b861471e62138f55c85e: can: peak_pci: prevent use after free at netdev removal (2014-05-21 08:17:03 +0200) ---------------------------------------------------------------- linux-can-fixes-for-3.15-20140521 ---------------------------------------------------------------- Stephane Grosjean (1): can: peak_pci: prevent use after free at netdev removal drivers/net/can/sja1000/peak_pci.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] can: peak_pci: prevent use after free at netdev removal 2014-05-21 11:15 pull-request: can 2014-05-21 Marc Kleine-Budde @ 2014-05-21 11:15 ` Marc Kleine-Budde 2014-05-22 19:41 ` pull-request: can 2014-05-21 David Miller 1 sibling, 0 replies; 3+ messages in thread From: Marc Kleine-Budde @ 2014-05-21 11:15 UTC (permalink / raw) To: netdev Cc: davem, linux-can, kernel, Stephane Grosjean, linux-stable, Marc Kleine-Budde From: Stephane Grosjean <s.grosjean@peak-system.com> As remarked by Christopher R. Baker in his post at http://marc.info/?l=linux-can&m=139707295706465&w=2 there's a possibility for an use after free condition at device removal. This simplified patch introduces an additional variable to prevent the issue. Thanks for catching this. Cc: linux-stable <stable@vger.kernel.org> Reported-by: Christopher R. Baker <cbaker@rec.ri.cmu.edu> Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- drivers/net/can/sja1000/peak_pci.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c index c540e3d..564933a 100644 --- a/drivers/net/can/sja1000/peak_pci.c +++ b/drivers/net/can/sja1000/peak_pci.c @@ -551,7 +551,7 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { struct sja1000_priv *priv; struct peak_pci_chan *chan; - struct net_device *dev; + struct net_device *dev, *prev_dev; void __iomem *cfg_base, *reg_base; u16 sub_sys_id, icr; int i, err, channels; @@ -688,11 +688,13 @@ failure_remove_channels: writew(0x0, cfg_base + PITA_ICR + 2); chan = NULL; - for (dev = pci_get_drvdata(pdev); dev; dev = chan->prev_dev) { - unregister_sja1000dev(dev); - free_sja1000dev(dev); + for (dev = pci_get_drvdata(pdev); dev; dev = prev_dev) { priv = netdev_priv(dev); chan = priv->priv; + prev_dev = chan->prev_dev; + + unregister_sja1000dev(dev); + free_sja1000dev(dev); } /* free any PCIeC resources too */ @@ -726,10 +728,12 @@ static void peak_pci_remove(struct pci_dev *pdev) /* Loop over all registered devices */ while (1) { + struct net_device *prev_dev = chan->prev_dev; + dev_info(&pdev->dev, "removing device %s\n", dev->name); unregister_sja1000dev(dev); free_sja1000dev(dev); - dev = chan->prev_dev; + dev = prev_dev; if (!dev) { /* do that only for first channel */ -- 2.0.0.rc2 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: pull-request: can 2014-05-21 2014-05-21 11:15 pull-request: can 2014-05-21 Marc Kleine-Budde 2014-05-21 11:15 ` [PATCH] can: peak_pci: prevent use after free at netdev removal Marc Kleine-Budde @ 2014-05-22 19:41 ` David Miller 1 sibling, 0 replies; 3+ messages in thread From: David Miller @ 2014-05-22 19:41 UTC (permalink / raw) To: mkl; +Cc: netdev, linux-can, kernel From: Marc Kleine-Budde <mkl@pengutronix.de> Date: Wed, 21 May 2014 13:15:58 +0200 > this is a pull request for net/master, for the v3.15 release cycle, with a > single patch. Christopher R. Baker found a use after free during unloading of > the peak_pci driver. This is fixes in a patch by Stephane Grosjean. Also pulled, thanks. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-22 19:41 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-05-21 11:15 pull-request: can 2014-05-21 Marc Kleine-Budde 2014-05-21 11:15 ` [PATCH] can: peak_pci: prevent use after free at netdev removal Marc Kleine-Budde 2014-05-22 19:41 ` pull-request: can 2014-05-21 David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).