* [PATCH v3 11/23] counter: stm32-lptimer-cnt: Convert to counter_priv() wrapper
2021-12-29 15:44 [PATCH v3 00/23] counter: cleanups and device lifetime fixes Uwe Kleine-König
@ 2021-12-29 15:44 ` Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 12/23] counter: stm32-timer-cnt: " Uwe Kleine-König
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2021-12-29 15:44 UTC (permalink / raw)
To: William Breathitt Gray
Cc: linux-iio, kernel, Jonathan Cameron, Greg Kroah-Hartman,
linux-kernel, Fabrice Gasnier, Maxime Coquelin, Alexandre Torgue,
linux-stm32, linux-arm-kernel
This is a straight forward conversion to the new counter_priv() wrapper.
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/counter/stm32-lptimer-cnt.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lptimer-cnt.c
index 5168833b1fdf..9cf00e929cc0 100644
--- a/drivers/counter/stm32-lptimer-cnt.c
+++ b/drivers/counter/stm32-lptimer-cnt.c
@@ -141,7 +141,7 @@ static const enum counter_synapse_action stm32_lptim_cnt_synapse_actions[] = {
static int stm32_lptim_cnt_read(struct counter_device *counter,
struct counter_count *count, u64 *val)
{
- struct stm32_lptim_cnt *const priv = counter->priv;
+ struct stm32_lptim_cnt *const priv = counter_priv(counter);
u32 cnt;
int ret;
@@ -158,7 +158,7 @@ static int stm32_lptim_cnt_function_read(struct counter_device *counter,
struct counter_count *count,
enum counter_function *function)
{
- struct stm32_lptim_cnt *const priv = counter->priv;
+ struct stm32_lptim_cnt *const priv = counter_priv(counter);
if (!priv->quadrature_mode) {
*function = COUNTER_FUNCTION_INCREASE;
@@ -177,7 +177,7 @@ static int stm32_lptim_cnt_function_write(struct counter_device *counter,
struct counter_count *count,
enum counter_function function)
{
- struct stm32_lptim_cnt *const priv = counter->priv;
+ struct stm32_lptim_cnt *const priv = counter_priv(counter);
if (stm32_lptim_is_enabled(priv))
return -EBUSY;
@@ -200,7 +200,7 @@ static int stm32_lptim_cnt_enable_read(struct counter_device *counter,
struct counter_count *count,
u8 *enable)
{
- struct stm32_lptim_cnt *const priv = counter->priv;
+ struct stm32_lptim_cnt *const priv = counter_priv(counter);
int ret;
ret = stm32_lptim_is_enabled(priv);
@@ -216,7 +216,7 @@ static int stm32_lptim_cnt_enable_write(struct counter_device *counter,
struct counter_count *count,
u8 enable)
{
- struct stm32_lptim_cnt *const priv = counter->priv;
+ struct stm32_lptim_cnt *const priv = counter_priv(counter);
int ret;
/* Check nobody uses the timer, or already disabled/enabled */
@@ -241,7 +241,7 @@ static int stm32_lptim_cnt_ceiling_read(struct counter_device *counter,
struct counter_count *count,
u64 *ceiling)
{
- struct stm32_lptim_cnt *const priv = counter->priv;
+ struct stm32_lptim_cnt *const priv = counter_priv(counter);
*ceiling = priv->ceiling;
@@ -252,7 +252,7 @@ static int stm32_lptim_cnt_ceiling_write(struct counter_device *counter,
struct counter_count *count,
u64 ceiling)
{
- struct stm32_lptim_cnt *const priv = counter->priv;
+ struct stm32_lptim_cnt *const priv = counter_priv(counter);
if (stm32_lptim_is_enabled(priv))
return -EBUSY;
@@ -277,7 +277,7 @@ static int stm32_lptim_cnt_action_read(struct counter_device *counter,
struct counter_synapse *synapse,
enum counter_synapse_action *action)
{
- struct stm32_lptim_cnt *const priv = counter->priv;
+ struct stm32_lptim_cnt *const priv = counter_priv(counter);
enum counter_function function;
int err;
@@ -321,7 +321,7 @@ static int stm32_lptim_cnt_action_write(struct counter_device *counter,
struct counter_synapse *synapse,
enum counter_synapse_action action)
{
- struct stm32_lptim_cnt *const priv = counter->priv;
+ struct stm32_lptim_cnt *const priv = counter_priv(counter);
enum counter_function function;
int err;
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 12/23] counter: stm32-timer-cnt: Convert to counter_priv() wrapper
2021-12-29 15:44 [PATCH v3 00/23] counter: cleanups and device lifetime fixes Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 11/23] counter: stm32-lptimer-cnt: Convert to counter_priv() wrapper Uwe Kleine-König
@ 2021-12-29 15:44 ` Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 20/23] counter: stm32-timer-cnt: Convert to new counter registration Uwe Kleine-König
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2021-12-29 15:44 UTC (permalink / raw)
To: William Breathitt Gray
Cc: linux-iio, kernel, Jonathan Cameron, Greg Kroah-Hartman,
linux-kernel, Fabrice Gasnier, Maxime Coquelin, Alexandre Torgue,
linux-stm32, linux-arm-kernel
This is a straight forward conversion to the new counter_priv() wrapper.
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/counter/stm32-timer-cnt.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
index 0546e932db0c..4b05b198a8d8 100644
--- a/drivers/counter/stm32-timer-cnt.c
+++ b/drivers/counter/stm32-timer-cnt.c
@@ -47,7 +47,7 @@ static const enum counter_function stm32_count_functions[] = {
static int stm32_count_read(struct counter_device *counter,
struct counter_count *count, u64 *val)
{
- struct stm32_timer_cnt *const priv = counter->priv;
+ struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 cnt;
regmap_read(priv->regmap, TIM_CNT, &cnt);
@@ -59,7 +59,7 @@ static int stm32_count_read(struct counter_device *counter,
static int stm32_count_write(struct counter_device *counter,
struct counter_count *count, const u64 val)
{
- struct stm32_timer_cnt *const priv = counter->priv;
+ struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 ceiling;
regmap_read(priv->regmap, TIM_ARR, &ceiling);
@@ -73,7 +73,7 @@ static int stm32_count_function_read(struct counter_device *counter,
struct counter_count *count,
enum counter_function *function)
{
- struct stm32_timer_cnt *const priv = counter->priv;
+ struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 smcr;
regmap_read(priv->regmap, TIM_SMCR, &smcr);
@@ -100,7 +100,7 @@ static int stm32_count_function_write(struct counter_device *counter,
struct counter_count *count,
enum counter_function function)
{
- struct stm32_timer_cnt *const priv = counter->priv;
+ struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 cr1, sms;
switch (function) {
@@ -140,7 +140,7 @@ static int stm32_count_direction_read(struct counter_device *counter,
struct counter_count *count,
enum counter_count_direction *direction)
{
- struct stm32_timer_cnt *const priv = counter->priv;
+ struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 cr1;
regmap_read(priv->regmap, TIM_CR1, &cr1);
@@ -153,7 +153,7 @@ static int stm32_count_direction_read(struct counter_device *counter,
static int stm32_count_ceiling_read(struct counter_device *counter,
struct counter_count *count, u64 *ceiling)
{
- struct stm32_timer_cnt *const priv = counter->priv;
+ struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 arr;
regmap_read(priv->regmap, TIM_ARR, &arr);
@@ -166,7 +166,7 @@ static int stm32_count_ceiling_read(struct counter_device *counter,
static int stm32_count_ceiling_write(struct counter_device *counter,
struct counter_count *count, u64 ceiling)
{
- struct stm32_timer_cnt *const priv = counter->priv;
+ struct stm32_timer_cnt *const priv = counter_priv(counter);
if (ceiling > priv->max_arr)
return -ERANGE;
@@ -181,7 +181,7 @@ static int stm32_count_ceiling_write(struct counter_device *counter,
static int stm32_count_enable_read(struct counter_device *counter,
struct counter_count *count, u8 *enable)
{
- struct stm32_timer_cnt *const priv = counter->priv;
+ struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 cr1;
regmap_read(priv->regmap, TIM_CR1, &cr1);
@@ -194,7 +194,7 @@ static int stm32_count_enable_read(struct counter_device *counter,
static int stm32_count_enable_write(struct counter_device *counter,
struct counter_count *count, u8 enable)
{
- struct stm32_timer_cnt *const priv = counter->priv;
+ struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 cr1;
if (enable) {
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 20/23] counter: stm32-timer-cnt: Convert to new counter registration
2021-12-29 15:44 [PATCH v3 00/23] counter: cleanups and device lifetime fixes Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 11/23] counter: stm32-lptimer-cnt: Convert to counter_priv() wrapper Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 12/23] counter: stm32-timer-cnt: " Uwe Kleine-König
@ 2021-12-29 15:44 ` Uwe Kleine-König
2021-12-29 15:44 ` [PATCH v3 21/23] counter: stm32-lptimer-cnt: " Uwe Kleine-König
2021-12-30 8:53 ` [PATCH v3 00/23] counter: cleanups and device lifetime fixes Uwe Kleine-König
4 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2021-12-29 15:44 UTC (permalink / raw)
To: William Breathitt Gray
Cc: linux-iio, kernel, Jonathan Cameron, Greg Kroah-Hartman,
linux-kernel, Fabrice Gasnier, Maxime Coquelin, Alexandre Torgue,
linux-stm32, linux-arm-kernel
This fixes device lifetime issues where it was possible to free a live
struct device.
Fixes: ad29937e206f ("counter: Add STM32 Timer quadrature encoder")
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/counter/stm32-timer-cnt.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
index 4b05b198a8d8..5779ae7c73cf 100644
--- a/drivers/counter/stm32-timer-cnt.c
+++ b/drivers/counter/stm32-timer-cnt.c
@@ -29,7 +29,6 @@ struct stm32_timer_regs {
};
struct stm32_timer_cnt {
- struct counter_device counter;
struct regmap *regmap;
struct clk *clk;
u32 max_arr;
@@ -317,31 +316,38 @@ static int stm32_timer_cnt_probe(struct platform_device *pdev)
struct stm32_timers *ddata = dev_get_drvdata(pdev->dev.parent);
struct device *dev = &pdev->dev;
struct stm32_timer_cnt *priv;
+ struct counter_device *counter;
+ int ret;
if (IS_ERR_OR_NULL(ddata))
return -EINVAL;
- priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
- if (!priv)
+ counter = devm_counter_alloc(dev, sizeof(*priv));
+ if (!counter)
return -ENOMEM;
+ priv = counter_priv(counter);
+
priv->regmap = ddata->regmap;
priv->clk = ddata->clk;
priv->max_arr = ddata->max_arr;
- priv->counter.name = dev_name(dev);
- priv->counter.parent = dev;
- priv->counter.ops = &stm32_timer_cnt_ops;
- priv->counter.counts = &stm32_counts;
- priv->counter.num_counts = 1;
- priv->counter.signals = stm32_signals;
- priv->counter.num_signals = ARRAY_SIZE(stm32_signals);
- priv->counter.priv = priv;
+ counter->name = dev_name(dev);
+ counter->parent = dev;
+ counter->ops = &stm32_timer_cnt_ops;
+ counter->counts = &stm32_counts;
+ counter->num_counts = 1;
+ counter->signals = stm32_signals;
+ counter->num_signals = ARRAY_SIZE(stm32_signals);
platform_set_drvdata(pdev, priv);
/* Register Counter device */
- return devm_counter_register(dev, &priv->counter);
+ ret = devm_counter_add(dev, counter);
+ if (ret < 0)
+ dev_err_probe(dev, ret, "Failed to add counter\n");
+
+ return ret;
}
static int __maybe_unused stm32_timer_cnt_suspend(struct device *dev)
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 21/23] counter: stm32-lptimer-cnt: Convert to new counter registration
2021-12-29 15:44 [PATCH v3 00/23] counter: cleanups and device lifetime fixes Uwe Kleine-König
` (2 preceding siblings ...)
2021-12-29 15:44 ` [PATCH v3 20/23] counter: stm32-timer-cnt: Convert to new counter registration Uwe Kleine-König
@ 2021-12-29 15:44 ` Uwe Kleine-König
2021-12-30 8:53 ` [PATCH v3 00/23] counter: cleanups and device lifetime fixes Uwe Kleine-König
4 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2021-12-29 15:44 UTC (permalink / raw)
To: William Breathitt Gray
Cc: linux-iio, kernel, Jonathan Cameron, Greg Kroah-Hartman,
linux-kernel, Fabrice Gasnier, Maxime Coquelin, Alexandre Torgue,
linux-stm32, linux-arm-kernel
This fixes device lifetime issues where it was possible to free a live
struct device.
Fixes: 597f55e3f36c ("counter: stm32-lptimer: add counter device")
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/counter/stm32-lptimer-cnt.c | 33 +++++++++++++++++------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lptimer-cnt.c
index 9cf00e929cc0..68031d93ce89 100644
--- a/drivers/counter/stm32-lptimer-cnt.c
+++ b/drivers/counter/stm32-lptimer-cnt.c
@@ -20,7 +20,6 @@
#include <linux/types.h>
struct stm32_lptim_cnt {
- struct counter_device counter;
struct device *dev;
struct regmap *regmap;
struct clk *clk;
@@ -411,14 +410,17 @@ static struct counter_count stm32_lptim_in1_counts = {
static int stm32_lptim_cnt_probe(struct platform_device *pdev)
{
struct stm32_lptimer *ddata = dev_get_drvdata(pdev->dev.parent);
+ struct counter_device *counter;
struct stm32_lptim_cnt *priv;
+ int ret;
if (IS_ERR_OR_NULL(ddata))
return -EINVAL;
- priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
- if (!priv)
+ counter = devm_counter_alloc(&pdev->dev, sizeof(*priv));
+ if (!counter)
return -ENOMEM;
+ priv = counter_priv(counter);
priv->dev = &pdev->dev;
priv->regmap = ddata->regmap;
@@ -426,23 +428,26 @@ static int stm32_lptim_cnt_probe(struct platform_device *pdev)
priv->ceiling = STM32_LPTIM_MAX_ARR;
/* Initialize Counter device */
- priv->counter.name = dev_name(&pdev->dev);
- priv->counter.parent = &pdev->dev;
- priv->counter.ops = &stm32_lptim_cnt_ops;
+ counter->name = dev_name(&pdev->dev);
+ counter->parent = &pdev->dev;
+ counter->ops = &stm32_lptim_cnt_ops;
if (ddata->has_encoder) {
- priv->counter.counts = &stm32_lptim_enc_counts;
- priv->counter.num_signals = ARRAY_SIZE(stm32_lptim_cnt_signals);
+ counter->counts = &stm32_lptim_enc_counts;
+ counter->num_signals = ARRAY_SIZE(stm32_lptim_cnt_signals);
} else {
- priv->counter.counts = &stm32_lptim_in1_counts;
- priv->counter.num_signals = 1;
+ counter->counts = &stm32_lptim_in1_counts;
+ counter->num_signals = 1;
}
- priv->counter.num_counts = 1;
- priv->counter.signals = stm32_lptim_cnt_signals;
- priv->counter.priv = priv;
+ counter->num_counts = 1;
+ counter->signals = stm32_lptim_cnt_signals;
platform_set_drvdata(pdev, priv);
- return devm_counter_register(&pdev->dev, &priv->counter);
+ ret = devm_counter_add(&pdev->dev, counter);
+ if (ret < 0)
+ return dev_err_probe(&pdev->dev, ret, "Failed to add counter\n");
+
+ return 0;
}
#ifdef CONFIG_PM_SLEEP
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 00/23] counter: cleanups and device lifetime fixes
2021-12-29 15:44 [PATCH v3 00/23] counter: cleanups and device lifetime fixes Uwe Kleine-König
` (3 preceding siblings ...)
2021-12-29 15:44 ` [PATCH v3 21/23] counter: stm32-lptimer-cnt: " Uwe Kleine-König
@ 2021-12-30 8:53 ` Uwe Kleine-König
2021-12-30 12:31 ` Greg Kroah-Hartman
2021-12-30 14:58 ` Jonathan Cameron
4 siblings, 2 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2021-12-30 8:53 UTC (permalink / raw)
To: William Breathitt Gray, Greg Kroah-Hartman, Jonathan Cameron
Cc: Kamel Bouhara, Ahmad Fatoum, David Lechner, Jonathan Corbet,
linux-iio, linux-kernel, Oleksij Rempel, Alexandre Torgue,
Fabrice Gasnier, Jarkko Nikula, linux-arm-kernel, kernel,
Patrick Havelange, Syed Nayyar Waris, linux-stm32,
Maxime Coquelin
[-- Attachment #1.1: Type: text/plain, Size: 3391 bytes --]
Hello,
On Wed, Dec 29, 2021 at 04:44:18PM +0100, Uwe Kleine-König wrote:
> this is v3 of my series to fix device lifetime issues in the counter
> framework. This hopefully addresses all things pointed out for v2.
>
> Note this depends on 60f07e74f86b (which is in next) now. Full diffstat
> below.
>
> Things that could be further improved:
>
> [...]
>
> Uwe Kleine-König (23):
> counter: Use container_of instead of drvdata to track counter_device
> counter: ftm-quaddec: Drop unused platform_set_drvdata()
> counter: microchip-tcb-capture: Drop unused platform_set_drvdata()
> counter: Provide a wrapper to access device private data
> counter: 104-quad-8: Convert to counter_priv() wrapper
> counter: interrupt-cnt: Convert to counter_priv() wrapper
> counter: microchip-tcb-capture: Convert to counter_priv() wrapper
> counter: intel-qep: Convert to counter_priv() wrapper
> counter: ftm-quaddec: Convert to counter_priv() wrapper
> counter: ti-eqep: Convert to counter_priv() wrapper
> counter: stm32-lptimer-cnt: Convert to counter_priv() wrapper
> counter: stm32-timer-cnt: Convert to counter_priv() wrapper
> counter: Provide alternative counter registration functions
> counter: Update documentation for new counter registration functions
> counter: 104-quad-8: Convert to new counter registration
> counter: interrupt-cnt: Convert to new counter registration
> counter: intel-qep: Convert to new counter registration
> counter: ftm-quaddec: Convert to new counter registration
> counter: microchip-tcb-capture: Convert to new counter registration
> counter: stm32-timer-cnt: Convert to new counter registration
> counter: stm32-lptimer-cnt: Convert to new counter registration
> counter: ti-eqep: Convert to new counter registration
> counter: remove old and now unused registration API
>
> Documentation/driver-api/generic-counter.rst | 10 +-
> drivers/counter/104-quad-8.c | 93 +++++-----
> drivers/counter/counter-core.c | 186 ++++++++++++++-----
> drivers/counter/ftm-quaddec.c | 36 ++--
> drivers/counter/intel-qep.c | 46 ++---
> drivers/counter/interrupt-cnt.c | 38 ++--
> drivers/counter/microchip-tcb-capture.c | 44 ++---
> drivers/counter/stm32-lptimer-cnt.c | 51 ++---
> drivers/counter/stm32-timer-cnt.c | 48 ++---
> drivers/counter/ti-eqep.c | 31 ++--
> include/linux/counter.h | 15 +-
> 11 files changed, 356 insertions(+), 242 deletions(-)
>
> Range-diff against v2:
> [...]
>
> base-commit: a7904a538933c525096ca2ccde1e60d0ee62c08e
> prerequisite-patch-id: 9459ad8bc78190558df9123f8bebe28ca1c396ea
All patches have a blessing by at least one of William and Jonathan.
The prerequisite commit (60f07e74f86b) is in Greg's char-misc-next branch.
Assuming noone still finds a problem in this series that requires me to
respin I wonder who will pick it up? Greg?
Given that it fixes a possible use-after-free in all counter drivers,
I'd like to see it hit before v5.17-rc1. For 5.16 it's probably too
late.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 00/23] counter: cleanups and device lifetime fixes
2021-12-30 8:53 ` [PATCH v3 00/23] counter: cleanups and device lifetime fixes Uwe Kleine-König
@ 2021-12-30 12:31 ` Greg Kroah-Hartman
2021-12-30 14:58 ` Jonathan Cameron
1 sibling, 0 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2021-12-30 12:31 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: William Breathitt Gray, Jonathan Cameron, Kamel Bouhara,
Ahmad Fatoum, David Lechner, Jonathan Corbet, linux-iio,
linux-kernel, Oleksij Rempel, Alexandre Torgue, Fabrice Gasnier,
Jarkko Nikula, linux-arm-kernel, kernel, Patrick Havelange,
Syed Nayyar Waris, linux-stm32, Maxime Coquelin
On Thu, Dec 30, 2021 at 09:53:51AM +0100, Uwe Kleine-König wrote:
> Hello,
>
> On Wed, Dec 29, 2021 at 04:44:18PM +0100, Uwe Kleine-König wrote:
> > this is v3 of my series to fix device lifetime issues in the counter
> > framework. This hopefully addresses all things pointed out for v2.
> >
> > Note this depends on 60f07e74f86b (which is in next) now. Full diffstat
> > below.
> >
> > Things that could be further improved:
> >
> > [...]
> >
> > Uwe Kleine-König (23):
> > counter: Use container_of instead of drvdata to track counter_device
> > counter: ftm-quaddec: Drop unused platform_set_drvdata()
> > counter: microchip-tcb-capture: Drop unused platform_set_drvdata()
> > counter: Provide a wrapper to access device private data
> > counter: 104-quad-8: Convert to counter_priv() wrapper
> > counter: interrupt-cnt: Convert to counter_priv() wrapper
> > counter: microchip-tcb-capture: Convert to counter_priv() wrapper
> > counter: intel-qep: Convert to counter_priv() wrapper
> > counter: ftm-quaddec: Convert to counter_priv() wrapper
> > counter: ti-eqep: Convert to counter_priv() wrapper
> > counter: stm32-lptimer-cnt: Convert to counter_priv() wrapper
> > counter: stm32-timer-cnt: Convert to counter_priv() wrapper
> > counter: Provide alternative counter registration functions
> > counter: Update documentation for new counter registration functions
> > counter: 104-quad-8: Convert to new counter registration
> > counter: interrupt-cnt: Convert to new counter registration
> > counter: intel-qep: Convert to new counter registration
> > counter: ftm-quaddec: Convert to new counter registration
> > counter: microchip-tcb-capture: Convert to new counter registration
> > counter: stm32-timer-cnt: Convert to new counter registration
> > counter: stm32-lptimer-cnt: Convert to new counter registration
> > counter: ti-eqep: Convert to new counter registration
> > counter: remove old and now unused registration API
> >
> > Documentation/driver-api/generic-counter.rst | 10 +-
> > drivers/counter/104-quad-8.c | 93 +++++-----
> > drivers/counter/counter-core.c | 186 ++++++++++++++-----
> > drivers/counter/ftm-quaddec.c | 36 ++--
> > drivers/counter/intel-qep.c | 46 ++---
> > drivers/counter/interrupt-cnt.c | 38 ++--
> > drivers/counter/microchip-tcb-capture.c | 44 ++---
> > drivers/counter/stm32-lptimer-cnt.c | 51 ++---
> > drivers/counter/stm32-timer-cnt.c | 48 ++---
> > drivers/counter/ti-eqep.c | 31 ++--
> > include/linux/counter.h | 15 +-
> > 11 files changed, 356 insertions(+), 242 deletions(-)
> >
> > Range-diff against v2:
> > [...]
> >
> > base-commit: a7904a538933c525096ca2ccde1e60d0ee62c08e
> > prerequisite-patch-id: 9459ad8bc78190558df9123f8bebe28ca1c396ea
>
> All patches have a blessing by at least one of William and Jonathan.
> The prerequisite commit (60f07e74f86b) is in Greg's char-misc-next branch.
>
> Assuming noone still finds a problem in this series that requires me to
> respin I wonder who will pick it up? Greg?
>
> Given that it fixes a possible use-after-free in all counter drivers,
> I'd like to see it hit before v5.17-rc1. For 5.16 it's probably too
> late.
Of course it is too later for 5.16, sorry.
I'll queue this up to my tree now, for 5.17-rc1, thanks.
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 00/23] counter: cleanups and device lifetime fixes
2021-12-30 8:53 ` [PATCH v3 00/23] counter: cleanups and device lifetime fixes Uwe Kleine-König
2021-12-30 12:31 ` Greg Kroah-Hartman
@ 2021-12-30 14:58 ` Jonathan Cameron
2021-12-30 15:08 ` Uwe Kleine-König
1 sibling, 1 reply; 9+ messages in thread
From: Jonathan Cameron @ 2021-12-30 14:58 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: William Breathitt Gray, Greg Kroah-Hartman, Jonathan Cameron,
Kamel Bouhara, Ahmad Fatoum, David Lechner, Jonathan Corbet,
linux-iio, linux-kernel, Oleksij Rempel, Alexandre Torgue,
Fabrice Gasnier, Jarkko Nikula, linux-arm-kernel, kernel,
Patrick Havelange, Syed Nayyar Waris, linux-stm32,
Maxime Coquelin
On Thu, 30 Dec 2021 09:53:51 +0100
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> Hello,
>
> On Wed, Dec 29, 2021 at 04:44:18PM +0100, Uwe Kleine-König wrote:
> > this is v3 of my series to fix device lifetime issues in the counter
> > framework. This hopefully addresses all things pointed out for v2.
> >
> > Note this depends on 60f07e74f86b (which is in next) now. Full diffstat
> > below.
> >
> > Things that could be further improved:
> >
> > [...]
> >
> > Uwe Kleine-König (23):
> > counter: Use container_of instead of drvdata to track counter_device
> > counter: ftm-quaddec: Drop unused platform_set_drvdata()
> > counter: microchip-tcb-capture: Drop unused platform_set_drvdata()
> > counter: Provide a wrapper to access device private data
> > counter: 104-quad-8: Convert to counter_priv() wrapper
> > counter: interrupt-cnt: Convert to counter_priv() wrapper
> > counter: microchip-tcb-capture: Convert to counter_priv() wrapper
> > counter: intel-qep: Convert to counter_priv() wrapper
> > counter: ftm-quaddec: Convert to counter_priv() wrapper
> > counter: ti-eqep: Convert to counter_priv() wrapper
> > counter: stm32-lptimer-cnt: Convert to counter_priv() wrapper
> > counter: stm32-timer-cnt: Convert to counter_priv() wrapper
> > counter: Provide alternative counter registration functions
> > counter: Update documentation for new counter registration functions
> > counter: 104-quad-8: Convert to new counter registration
> > counter: interrupt-cnt: Convert to new counter registration
> > counter: intel-qep: Convert to new counter registration
> > counter: ftm-quaddec: Convert to new counter registration
> > counter: microchip-tcb-capture: Convert to new counter registration
> > counter: stm32-timer-cnt: Convert to new counter registration
> > counter: stm32-lptimer-cnt: Convert to new counter registration
> > counter: ti-eqep: Convert to new counter registration
> > counter: remove old and now unused registration API
> >
> > Documentation/driver-api/generic-counter.rst | 10 +-
> > drivers/counter/104-quad-8.c | 93 +++++-----
> > drivers/counter/counter-core.c | 186 ++++++++++++++-----
> > drivers/counter/ftm-quaddec.c | 36 ++--
> > drivers/counter/intel-qep.c | 46 ++---
> > drivers/counter/interrupt-cnt.c | 38 ++--
> > drivers/counter/microchip-tcb-capture.c | 44 ++---
> > drivers/counter/stm32-lptimer-cnt.c | 51 ++---
> > drivers/counter/stm32-timer-cnt.c | 48 ++---
> > drivers/counter/ti-eqep.c | 31 ++--
> > include/linux/counter.h | 15 +-
> > 11 files changed, 356 insertions(+), 242 deletions(-)
> >
> > Range-diff against v2:
> > [...]
> >
> > base-commit: a7904a538933c525096ca2ccde1e60d0ee62c08e
> > prerequisite-patch-id: 9459ad8bc78190558df9123f8bebe28ca1c396ea
>
> All patches have a blessing by at least one of William and Jonathan.
For future reference (may be fine this time) William has final say on counter
stuff as the maintainer so treat my input as just another set of eyes.
Anyhow, plenty of time for any necessary fixes during the RCs so shouldn't
be a problem.
Jonathan
> The prerequisite commit (60f07e74f86b) is in Greg's char-misc-next branch.
>
> Assuming noone still finds a problem in this series that requires me to
> respin I wonder who will pick it up? Greg?
>
> Given that it fixes a possible use-after-free in all counter drivers,
> I'd like to see it hit before v5.17-rc1. For 5.16 it's probably too
> late.
>
> Best regards
> Uwe
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 00/23] counter: cleanups and device lifetime fixes
2021-12-30 14:58 ` Jonathan Cameron
@ 2021-12-30 15:08 ` Uwe Kleine-König
0 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2021-12-30 15:08 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Kamel Bouhara, Ahmad Fatoum, David Lechner, Jonathan Corbet,
linux-iio, Greg Kroah-Hartman, William Breathitt Gray,
Maxime Coquelin, linux-kernel, Alexandre Torgue, Fabrice Gasnier,
Jarkko Nikula, kernel, Jonathan Cameron, Syed Nayyar Waris,
Oleksij Rempel, Patrick Havelange, linux-stm32, linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 4105 bytes --]
On Thu, Dec 30, 2021 at 02:58:26PM +0000, Jonathan Cameron wrote:
> On Thu, 30 Dec 2021 09:53:51 +0100
> Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
>
> > Hello,
> >
> > On Wed, Dec 29, 2021 at 04:44:18PM +0100, Uwe Kleine-König wrote:
> > > this is v3 of my series to fix device lifetime issues in the counter
> > > framework. This hopefully addresses all things pointed out for v2.
> > >
> > > Note this depends on 60f07e74f86b (which is in next) now. Full diffstat
> > > below.
> > >
> > > Things that could be further improved:
> > >
> > > [...]
> > >
> > > Uwe Kleine-König (23):
> > > counter: Use container_of instead of drvdata to track counter_device
> > > counter: ftm-quaddec: Drop unused platform_set_drvdata()
> > > counter: microchip-tcb-capture: Drop unused platform_set_drvdata()
> > > counter: Provide a wrapper to access device private data
> > > counter: 104-quad-8: Convert to counter_priv() wrapper
> > > counter: interrupt-cnt: Convert to counter_priv() wrapper
> > > counter: microchip-tcb-capture: Convert to counter_priv() wrapper
> > > counter: intel-qep: Convert to counter_priv() wrapper
> > > counter: ftm-quaddec: Convert to counter_priv() wrapper
> > > counter: ti-eqep: Convert to counter_priv() wrapper
> > > counter: stm32-lptimer-cnt: Convert to counter_priv() wrapper
> > > counter: stm32-timer-cnt: Convert to counter_priv() wrapper
> > > counter: Provide alternative counter registration functions
> > > counter: Update documentation for new counter registration functions
> > > counter: 104-quad-8: Convert to new counter registration
> > > counter: interrupt-cnt: Convert to new counter registration
> > > counter: intel-qep: Convert to new counter registration
> > > counter: ftm-quaddec: Convert to new counter registration
> > > counter: microchip-tcb-capture: Convert to new counter registration
> > > counter: stm32-timer-cnt: Convert to new counter registration
> > > counter: stm32-lptimer-cnt: Convert to new counter registration
> > > counter: ti-eqep: Convert to new counter registration
> > > counter: remove old and now unused registration API
> > >
> > > Documentation/driver-api/generic-counter.rst | 10 +-
> > > drivers/counter/104-quad-8.c | 93 +++++-----
> > > drivers/counter/counter-core.c | 186 ++++++++++++++-----
> > > drivers/counter/ftm-quaddec.c | 36 ++--
> > > drivers/counter/intel-qep.c | 46 ++---
> > > drivers/counter/interrupt-cnt.c | 38 ++--
> > > drivers/counter/microchip-tcb-capture.c | 44 ++---
> > > drivers/counter/stm32-lptimer-cnt.c | 51 ++---
> > > drivers/counter/stm32-timer-cnt.c | 48 ++---
> > > drivers/counter/ti-eqep.c | 31 ++--
> > > include/linux/counter.h | 15 +-
> > > 11 files changed, 356 insertions(+), 242 deletions(-)
> > >
> > > Range-diff against v2:
> > > [...]
> > >
> > > base-commit: a7904a538933c525096ca2ccde1e60d0ee62c08e
> > > prerequisite-patch-id: 9459ad8bc78190558df9123f8bebe28ca1c396ea
> >
> > All patches have a blessing by at least one of William and Jonathan.
>
> For future reference (may be fine this time) William has final say on counter
> stuff as the maintainer so treat my input as just another set of eyes.
Yeah, right. William only didn't ack patch 13 but wrote in reply it in v2:
I agree with the approach taken in this patch, and I don't have much to
add after the suggestions Lars-Peter and Jonathan have already given. So
assuming those are addressed in the next version I expect to Ack this
patch as well.
So I assume it's just that William didn't have the time yet to look into
v3 (or v4 that I just sent out) yet.
Best regards and thanks to all who gave feedback to improve this patch
set,
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread