[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87seurd057.ffs@tglx>
Date: Mon, 26 Aug 2024 12:55:00 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Jeff Xie <jeff.xie@...ux.dev>
Cc: linux-kernel@...r.kernel.org, xiehuan09@...il.com, Jeff Xie
<jeff.xie@...ux.dev>
Subject: Re: [PATCH v2] genirq: procfs: Make smp_affinity read-only for
interrupts that userspace can't set
On Sun, Aug 25 2024 at 21:19, Jeff Xie wrote:
> The kernel already knows at the time of interrupt allocation that the
> affinity cannot be controlled by userspace and therefore creating the
> file with write permissions is wrong.
>
> Therefore set the file permissions to read-only for such interrupts.
>
> Signed-off-by: Jeff Xie <jeff.xie@...ux.dev>
> ---
> v2:
> - Updated the description suggested by tglx
> - Corrected the return value from -EIO to -EPERM when the userspace can't set the affinity
>
> kernel/irq/proc.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
> index 8cccdf40725a..7b3a4c92d148 100644
> --- a/kernel/irq/proc.c
> +++ b/kernel/irq/proc.c
> @@ -142,7 +142,7 @@ static ssize_t write_irq_affinity(int type, struct file *file,
> int err;
>
> if (!irq_can_set_affinity_usr(irq) || no_irq_affinity)
> - return -EIO;
> + return -EPERM;
I drop this hunk as it is unrelated to $subject. That want's to be a
separate patch. Documentation/process clearly states:
Solve only one problem per patch.
Thanks,
tglx
Powered by blists - more mailing lists