[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024081336-escapable-anemia-87cb@gregkh>
Date: Tue, 13 Aug 2024 11:11:23 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Ma Ke <make24@...as.ac.cn>
Cc: giometti@...eenne.com, christophe.jaillet@...adoo.fr, linux@...blig.org,
sudipm.mukherjee@...il.com, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH] pps: add an error check in parport_attach
On Tue, Aug 13, 2024 at 11:08:00AM +0800, Ma Ke wrote:
> In parport_attach, the return value of ida_alloc is unchecked, witch leads
> to the use of an invalid index value.
>
> To address this issue, index should be checked. When the index value is
> abnormal, the device should be freed.
>
> Found by code review, compile tested only.
>
> Cc: stable@...r.kernel.org
> Fixes: 55dbc5b5174d ("pps: remove usage of the deprecated ida_simple_xx() API")
> Signed-off-by: Ma Ke <make24@...as.ac.cn>
> ---
> drivers/pps/clients/pps_parport.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pps/clients/pps_parport.c b/drivers/pps/clients/pps_parport.c
> index 63d03a0df5cc..9ab7f6961e42 100644
> --- a/drivers/pps/clients/pps_parport.c
> +++ b/drivers/pps/clients/pps_parport.c
> @@ -149,6 +149,11 @@ static void parport_attach(struct parport *port)
> }
>
> index = ida_alloc(&pps_client_index, GFP_KERNEL);
> + if (index < 0) {
> + pr_err("failed to get index\n");
No need to be noisy, right?
thanks,
greg k-h
Powered by blists - more mailing lists