RE: [PATCH] ptp: ptp_read should not release queue

From: Drewek, Wojciech
Date: Mon Oct 23 2023 - 05:01:57 EST




> -----Original Message-----
> From: Edward AD <twuufnxlz@xxxxxxxxx>
> Sent: Monday, October 23, 2023 4:46 AM
> To: syzbot+9704e6f099d952508943@xxxxxxxxxxxxxxxxxxxxxxxxx
> Cc: davem@xxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; reibax@xxxxxxxxx; richardcochran@xxxxxxxxx;
> syzkaller-bugs@xxxxxxxxxxxxxxxx
> Subject: [PATCH] ptp: ptp_read should not release queue
>
> Firstly, queue is not the memory allocated in ptp_read;
> Secondly, other processes may block at ptp_read and wait for conditions to be
> met to perform read operations.
>
> Reported-and-tested-by: syzbot+9704e6f099d952508943@xxxxxxxxxxxxxxxxxxxxxxxxx
> Fixes: 8f5de6fb2453 ("ptp: support multiple timestamp event readers")
> Signed-off-by: Edward AD <twuufnxlz@xxxxxxxxx>

Hi Edward,

Consider adding a target to the subject: [PATCH net] in this case

> ---
> drivers/ptp/ptp_chardev.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index 282cd7d24077..27c1ef493617 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -585,7 +585,5 @@ ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags,
> free_event:
> kfree(event);
> exit:
> - if (result < 0)
> - ptp_release(pccontext);
> return result;
> }
> --
> 2.25.1
>