* pull-request: can 2017-01-18
@ 2017-01-18 12:08 Marc Kleine-Budde
2017-01-18 12:08 ` [PATCH 1/2] can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer Marc Kleine-Budde
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2017-01-18 12:08 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel
Hello David,
this is a pull request for net/master consisting of two patches.
In the first patch Einar Jón fixes a NULL-pointer-deref in the c_can_pci
driver. In the second patch Yegor Yefremov fixes the clock handling in the
ti_hecc driver.
regards,
Marc
---
The following changes since commit 93b43fd137cd8865adf9978ab9870a344365d3af:
net: phy: dp83848: add DP83620 PHY support (2017-01-17 15:47:25 -0500)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-4.10-20170118
for you to fetch changes up to befa60113ce7ea270cb51eada28443ca2756f480:
can: ti_hecc: add missing prepare and unprepare of the clock (2017-01-18 13:03:15 +0100)
----------------------------------------------------------------
linux-can-fixes-for-4.10-20170118
----------------------------------------------------------------
Einar Jón (1):
can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer
Yegor Yefremov (1):
can: ti_hecc: add missing prepare and unprepare of the clock
drivers/net/can/c_can/c_can_pci.c | 1 +
drivers/net/can/ti_hecc.c | 16 ++++++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer
2017-01-18 12:08 pull-request: can 2017-01-18 Marc Kleine-Budde
@ 2017-01-18 12:08 ` Marc Kleine-Budde
2017-01-18 12:08 ` [PATCH 2/2] can: ti_hecc: add missing prepare and unprepare of the clock Marc Kleine-Budde
2017-01-18 16:36 ` pull-request: can 2017-01-18 David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2017-01-18 12:08 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Einar Jón, linux-stable,
Marc Kleine-Budde
From: Einar Jón <tolvupostur@gmail.com>
The priv->device pointer for c_can_pci is never set, but it is used
without a NULL check in c_can_start(). Setting it in c_can_pci_probe()
like c_can_plat_probe() prevents c_can_pci.ko from crashing, with and
without CONFIG_PM.
This might also cause the pm_runtime_*() functions in c_can.c to
actually be executed for c_can_pci devices - they are the only other
place where priv->device is used, but they all contain a null check.
Signed-off-by: Einar Jón <tolvupostur@gmail.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/c_can/c_can_pci.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/can/c_can/c_can_pci.c b/drivers/net/can/c_can/c_can_pci.c
index 7be393c96b1a..cf7c18947189 100644
--- a/drivers/net/can/c_can/c_can_pci.c
+++ b/drivers/net/can/c_can/c_can_pci.c
@@ -161,6 +161,7 @@ static int c_can_pci_probe(struct pci_dev *pdev,
dev->irq = pdev->irq;
priv->base = addr;
+ priv->device = &pdev->dev;
if (!c_can_pci_data->freq) {
dev_err(&pdev->dev, "no clock frequency defined\n");
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] can: ti_hecc: add missing prepare and unprepare of the clock
2017-01-18 12:08 pull-request: can 2017-01-18 Marc Kleine-Budde
2017-01-18 12:08 ` [PATCH 1/2] can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer Marc Kleine-Budde
@ 2017-01-18 12:08 ` Marc Kleine-Budde
2017-01-18 16:36 ` pull-request: can 2017-01-18 David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2017-01-18 12:08 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Yegor Yefremov, linux-stable,
Marc Kleine-Budde
From: Yegor Yefremov <yegorslists@googlemail.com>
In order to make the driver work with the common clock framework, this
patch converts the clk_enable()/clk_disable() to
clk_prepare_enable()/clk_disable_unprepare().
Also add error checking for clk_prepare_enable().
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/ti_hecc.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
index 680d1ff07a55..6749b1829469 100644
--- a/drivers/net/can/ti_hecc.c
+++ b/drivers/net/can/ti_hecc.c
@@ -948,7 +948,12 @@ static int ti_hecc_probe(struct platform_device *pdev)
netif_napi_add(ndev, &priv->napi, ti_hecc_rx_poll,
HECC_DEF_NAPI_WEIGHT);
- clk_enable(priv->clk);
+ err = clk_prepare_enable(priv->clk);
+ if (err) {
+ dev_err(&pdev->dev, "clk_prepare_enable() failed\n");
+ goto probe_exit_clk;
+ }
+
err = register_candev(ndev);
if (err) {
dev_err(&pdev->dev, "register_candev() failed\n");
@@ -981,7 +986,7 @@ static int ti_hecc_remove(struct platform_device *pdev)
struct ti_hecc_priv *priv = netdev_priv(ndev);
unregister_candev(ndev);
- clk_disable(priv->clk);
+ clk_disable_unprepare(priv->clk);
clk_put(priv->clk);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
iounmap(priv->base);
@@ -1006,7 +1011,7 @@ static int ti_hecc_suspend(struct platform_device *pdev, pm_message_t state)
hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
priv->can.state = CAN_STATE_SLEEPING;
- clk_disable(priv->clk);
+ clk_disable_unprepare(priv->clk);
return 0;
}
@@ -1015,8 +1020,11 @@ static int ti_hecc_resume(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);
struct ti_hecc_priv *priv = netdev_priv(dev);
+ int err;
- clk_enable(priv->clk);
+ err = clk_prepare_enable(priv->clk);
+ if (err)
+ return err;
hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_PDR);
priv->can.state = CAN_STATE_ERROR_ACTIVE;
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: pull-request: can 2017-01-18
2017-01-18 12:08 pull-request: can 2017-01-18 Marc Kleine-Budde
2017-01-18 12:08 ` [PATCH 1/2] can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer Marc Kleine-Budde
2017-01-18 12:08 ` [PATCH 2/2] can: ti_hecc: add missing prepare and unprepare of the clock Marc Kleine-Budde
@ 2017-01-18 16:36 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-01-18 16:36 UTC (permalink / raw)
To: mkl; +Cc: netdev, linux-can, kernel
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Wed, 18 Jan 2017 13:08:50 +0100
> this is a pull request for net/master consisting of two patches.
>
> In the first patch Einar Jón fixes a NULL-pointer-deref in the c_can_pci
> driver. In the second patch Yegor Yefremov fixes the clock handling in the
> ti_hecc driver.
Pulled, thanks Marc.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-18 16:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-18 12:08 pull-request: can 2017-01-18 Marc Kleine-Budde
2017-01-18 12:08 ` [PATCH 1/2] can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer Marc Kleine-Budde
2017-01-18 12:08 ` [PATCH 2/2] can: ti_hecc: add missing prepare and unprepare of the clock Marc Kleine-Budde
2017-01-18 16:36 ` pull-request: can 2017-01-18 David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.