All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep()
@ 2023-03-10  1:31 Joel Fernandes (Google)
  2023-03-16 16:36 ` Stefan Schmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Fernandes (Google) @ 2023-03-10  1:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Joel Fernandes (Google),
	Alexander Aring, David S. Miller, Eric Dumazet, Jakub Kicinski,
	linux-wpan, Miquel Raynal, netdev, Paolo Abeni, Stefan Schmidt,
	boqun.feng, paulmck, urezki

The k[v]free_rcu() macro's single-argument form is deprecated.
Therefore switch to the new k[v]free_rcu_mightsleep() variant. The goal
is to avoid accidental use of the single-argument forms, which can
introduce functionality bugs in atomic contexts and latency bugs in
non-atomic contexts.

The callers are holding a mutex so the context allows blocking. Hence
using the API with a single argument will be fine, but use its new name.

There is no functionality change with this patch.

Fixes: 57588c71177f ("mac802154: Handle passive scanning")
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
Please Ack the patch but we can carry it through the RCU tree as well if
needed, as it is not a bug per-se and we are not dropping the old API before
the next release.

 net/mac802154/scan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mac802154/scan.c b/net/mac802154/scan.c
index 9b0933a185eb..5c191bedd72c 100644
--- a/net/mac802154/scan.c
+++ b/net/mac802154/scan.c
@@ -52,7 +52,7 @@ static int mac802154_scan_cleanup_locked(struct ieee802154_local *local,
 	request = rcu_replace_pointer(local->scan_req, NULL, 1);
 	if (!request)
 		return 0;
-	kfree_rcu(request);
+	kvfree_rcu_mightsleep(request);
 
 	/* Advertize first, while we know the devices cannot be removed */
 	if (aborted)
@@ -403,7 +403,7 @@ int mac802154_stop_beacons_locked(struct ieee802154_local *local,
 	request = rcu_replace_pointer(local->beacon_req, NULL, 1);
 	if (!request)
 		return 0;
-	kfree_rcu(request);
+	kvfree_rcu_mightsleep(request);
 
 	nl802154_beaconing_done(wpan_dev);
 
-- 
2.40.0.rc1.284.g88254d51c5-goog

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-10  1:31 [PATCH] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
@ 2023-03-16 16:36 ` Stefan Schmidt
  2023-03-16 17:58   ` Joel Fernandes
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Schmidt @ 2023-03-16 16:36 UTC (permalink / raw)
  To: Joel Fernandes (Google), linux-kernel
  Cc: Alexander Aring, David S. Miller, Eric Dumazet, Jakub Kicinski,
	linux-wpan, Miquel Raynal, netdev, Paolo Abeni, boqun.feng,
	paulmck, urezki

Hello Joel.

On 10.03.23 02:31, Joel Fernandes (Google) wrote:
> The k[v]free_rcu() macro's single-argument form is deprecated.
> Therefore switch to the new k[v]free_rcu_mightsleep() variant. The goal
> is to avoid accidental use of the single-argument forms, which can
> introduce functionality bugs in atomic contexts and latency bugs in
> non-atomic contexts.
> 
> The callers are holding a mutex so the context allows blocking. Hence
> using the API with a single argument will be fine, but use its new name.
> 
> There is no functionality change with this patch.
> 
> Fixes: 57588c71177f ("mac802154: Handle passive scanning")
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
> Please Ack the patch but we can carry it through the RCU tree as well if
> needed, as it is not a bug per-se and we are not dropping the old API before
> the next release.

The "but we can carry it" part throws me off here. Not sure if you want 
this through the RCU tree (I suppose). In that case see my ack below.

If you want me to take it through my wpan tree instead let me know.

>   net/mac802154/scan.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/mac802154/scan.c b/net/mac802154/scan.c
> index 9b0933a185eb..5c191bedd72c 100644
> --- a/net/mac802154/scan.c
> +++ b/net/mac802154/scan.c
> @@ -52,7 +52,7 @@ static int mac802154_scan_cleanup_locked(struct ieee802154_local *local,
>   	request = rcu_replace_pointer(local->scan_req, NULL, 1);
>   	if (!request)
>   		return 0;
> -	kfree_rcu(request);
> +	kvfree_rcu_mightsleep(request);
>   
>   	/* Advertize first, while we know the devices cannot be removed */
>   	if (aborted)
> @@ -403,7 +403,7 @@ int mac802154_stop_beacons_locked(struct ieee802154_local *local,
>   	request = rcu_replace_pointer(local->beacon_req, NULL, 1);
>   	if (!request)
>   		return 0;
> -	kfree_rcu(request);
> +	kvfree_rcu_mightsleep(request);
>   
>   	nl802154_beaconing_done(wpan_dev);
>   


Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>

regards
Stefan Schmidt

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep()
  2023-03-16 16:36 ` Stefan Schmidt
@ 2023-03-16 17:58   ` Joel Fernandes
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Fernandes @ 2023-03-16 17:58 UTC (permalink / raw)
  To: Stefan Schmidt
  Cc: linux-kernel, Alexander Aring, David S. Miller, Eric Dumazet,
	Jakub Kicinski, linux-wpan, Miquel Raynal, netdev, Paolo Abeni,
	boqun.feng, paulmck, urezki



> On Mar 16, 2023, at 12:36 PM, Stefan Schmidt <stefan@datenfreihafen.org> wrote:
> 
> Hello Joel.
> 
>> On 10.03.23 02:31, Joel Fernandes (Google) wrote:
>> The k[v]free_rcu() macro's single-argument form is deprecated.
>> Therefore switch to the new k[v]free_rcu_mightsleep() variant. The goal
>> is to avoid accidental use of the single-argument forms, which can
>> introduce functionality bugs in atomic contexts and latency bugs in
>> non-atomic contexts.
>> The callers are holding a mutex so the context allows blocking. Hence
>> using the API with a single argument will be fine, but use its new name.
>> There is no functionality change with this patch.
>> Fixes: 57588c71177f ("mac802154: Handle passive scanning")
>> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
>> ---
>> Please Ack the patch but we can carry it through the RCU tree as well if
>> needed, as it is not a bug per-se and we are not dropping the old API before
>> the next release.
> 
> The "but we can carry it" part throws me off here. Not sure if you want this through the RCU tree (I suppose). In that case see my ack below.
> 
> If you want me to take it through my wpan tree instead let me know.

We will take this with your Ack below, thank you!

 - Joel


>>  net/mac802154/scan.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> diff --git a/net/mac802154/scan.c b/net/mac802154/scan.c
>> index 9b0933a185eb..5c191bedd72c 100644
>> --- a/net/mac802154/scan.c
>> +++ b/net/mac802154/scan.c
>> @@ -52,7 +52,7 @@ static int mac802154_scan_cleanup_locked(struct ieee802154_local *local,
>>      request = rcu_replace_pointer(local->scan_req, NULL, 1);
>>      if (!request)
>>          return 0;
>> -    kfree_rcu(request);
>> +    kvfree_rcu_mightsleep(request);
>>        /* Advertize first, while we know the devices cannot be removed */
>>      if (aborted)
>> @@ -403,7 +403,7 @@ int mac802154_stop_beacons_locked(struct ieee802154_local *local,
>>      request = rcu_replace_pointer(local->beacon_req, NULL, 1);
>>      if (!request)
>>          return 0;
>> -    kfree_rcu(request);
>> +    kvfree_rcu_mightsleep(request);
>>        nl802154_beaconing_done(wpan_dev);
>>  
> 
> 
> Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
> 
> regards
> Stefan Schmidt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-16 17:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10  1:31 [PATCH] mac802154: Rename kfree_rcu() to kvfree_rcu_mightsleep() Joel Fernandes (Google)
2023-03-16 16:36 ` Stefan Schmidt
2023-03-16 17:58   ` Joel Fernandes

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.