diff mbox series

[-next] audit: remove out-of-date comment in auditd_reset()

Message ID 20230804094155.283766-1-xiujianfeng@huaweicloud.com (mailing list archive)
State Rejected
Delegated to: Paul Moore
Headers show
Series [-next] audit: remove out-of-date comment in auditd_reset() | expand

Commit Message

Xiu Jianfeng Aug. 4, 2023, 9:41 a.m. UTC
From: Xiu Jianfeng <xiujianfeng@huawei.com>

Since commit 48d0e023af97 ("audit: fix the RCU locking for the
auditd_connection structure"), auditd_conn is changed to a global
pointor protected by RCU, and doesn't call auditd_set() here, which
makes the comment don't match the code, so remove it.

Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
 kernel/audit.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Paul Moore Aug. 7, 2023, 6:20 p.m. UTC | #1
On Fri, Aug 4, 2023 at 5:43 AM Xiu Jianfeng <xiujianfeng@huaweicloud.com> wrote:
>
> From: Xiu Jianfeng <xiujianfeng@huawei.com>
>
> Since commit 48d0e023af97 ("audit: fix the RCU locking for the
> auditd_connection structure"), auditd_conn is changed to a global
> pointor protected by RCU, and doesn't call auditd_set() here, which
> makes the comment don't match the code, so remove it.
>
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
> ---
>  kernel/audit.c | 1 -
>  1 file changed, 1 deletion(-)

The comment is still relevant, look at the
`rcu_assign_pointer(auditd_conn, NULL)` call in the auditd_reset()
function immediately before the spinlock is unlocked.

> diff --git a/kernel/audit.c b/kernel/audit.c
> index 45b2fb1e45af..0905750779a4 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -640,7 +640,6 @@ static void auditd_reset(const struct auditd_connection *ac)
>         struct sk_buff *skb;
>         struct auditd_connection *ac_old;
>
> -       /* if it isn't already broken, break the connection */
>         spin_lock_irqsave(&auditd_conn_lock, flags);
>         ac_old = rcu_dereference_protected(auditd_conn,
>                                            lockdep_is_held(&auditd_conn_lock));
> --
> 2.34.1
xiujianfeng Aug. 8, 2023, 12:56 a.m. UTC | #2
Hi,

On 2023/8/8 2:20, Paul Moore wrote:
> On Fri, Aug 4, 2023 at 5:43 AM Xiu Jianfeng <xiujianfeng@huaweicloud.com> wrote:
>>
>> From: Xiu Jianfeng <xiujianfeng@huawei.com>
>>
>> Since commit 48d0e023af97 ("audit: fix the RCU locking for the
>> auditd_connection structure"), auditd_conn is changed to a global
>> pointor protected by RCU, and doesn't call auditd_set() here, which
>> makes the comment don't match the code, so remove it.
>>
>> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
>> ---
>>  kernel/audit.c | 1 -
>>  1 file changed, 1 deletion(-)
> 
> The comment is still relevant, look at the
> `rcu_assign_pointer(auditd_conn, NULL)` call in the auditd_reset()
> function immediately before the spinlock is unlocked.

Thanks for your feedback, please ignore this patch.

> 
>> diff --git a/kernel/audit.c b/kernel/audit.c
>> index 45b2fb1e45af..0905750779a4 100644
>> --- a/kernel/audit.c
>> +++ b/kernel/audit.c
>> @@ -640,7 +640,6 @@ static void auditd_reset(const struct auditd_connection *ac)
>>         struct sk_buff *skb;
>>         struct auditd_connection *ac_old;
>>
>> -       /* if it isn't already broken, break the connection */
>>         spin_lock_irqsave(&auditd_conn_lock, flags);
>>         ac_old = rcu_dereference_protected(auditd_conn,
>>                                            lockdep_is_held(&auditd_conn_lock));
>> --
>> 2.34.1
>
diff mbox series

Patch

diff --git a/kernel/audit.c b/kernel/audit.c
index 45b2fb1e45af..0905750779a4 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -640,7 +640,6 @@  static void auditd_reset(const struct auditd_connection *ac)
 	struct sk_buff *skb;
 	struct auditd_connection *ac_old;
 
-	/* if it isn't already broken, break the connection */
 	spin_lock_irqsave(&auditd_conn_lock, flags);
 	ac_old = rcu_dereference_protected(auditd_conn,
 					   lockdep_is_held(&auditd_conn_lock));