lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 30 Sep 2023 14:57:24 -0700
From: Richard Cochran <richardcochran@...il.com>
To: Xabier Marquiegui <reibax@...il.com>
Cc: netdev@...r.kernel.org, horms@...nel.org,
	chrony-dev@...ony.tuxfamily.org, mlichvar@...hat.com,
	ntp-lists@...tcorallo.com, vinicius.gomes@...el.com,
	alex.maftei@....com, davem@...emloft.net, rrameshbabu@...dia.com,
	shuah@...nel.org
Subject: Re: [PATCH net-next v3 2/3] ptp: support multiple timestamp event
 readers

On Thu, Sep 28, 2023 at 03:35:43PM +0200, Xabier Marquiegui wrote:

> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index 197edf1179f1..65e7acaa40a9 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -101,14 +101,74 @@ int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin,
>  	return 0;
>  }
>  
> -int ptp_open(struct posix_clock *pc, fmode_t fmode)
> +int ptp_open(struct posix_clock_user *pcuser, fmode_t fmode)
>  {
> +	struct ptp_clock *ptp =
> +		container_of(pcuser->clk, struct ptp_clock, clock);
> +	struct ida *ida = ptp_get_tsevq_ida(ptp);

No need for IDA or ...

> +	struct timestamp_event_queue *queue;
> +
> +	if (!ida)
> +		return -EINVAL;
> +	queue = kzalloc(sizeof(*queue), GFP_KERNEL);
> +	if (!queue)
> +		return -EINVAL;
> +	queue->close_req = false;
> +	queue->reader_pid = task_pid_nr(current);

... PIDs.  Just allocate the queue and set:

> +	pcuser->private_clkdata = queue;

> +void ptp_flush_users(struct posix_clock *pc)

I can't see any need for "flush users".

open/release are per-user anyhow.

> @@ -184,11 +216,11 @@ static void ptp_clock_release(struct device *dev)
>  
>  	ptp_cleanup_pin_groups(ptp);
>  	kfree(ptp->vclock_index);
> -	mutex_destroy(&ptp->tsevq_mux);
>  	mutex_destroy(&ptp->pincfg_mux);
>  	mutex_destroy(&ptp->n_vclocks_mux);
>  	ptp_clean_queue_list(ptp);

You don't need this ^^^

Keep it simple:

- allocate queue on open()
- free the queue on release()

Hm?

>  	ida_free(&ptp_clocks_map, ptp->index);
> +	mutex_destroy(&ptp->close_mux);
>  	kfree(ptp);
>  }
>  

Thanks,
Richard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ