[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_B8EEF56ECDCC8EE7EA46DFD2DC0646C98A06@qq.com>
Date: Tue, 31 Oct 2023 04:59:00 +0800
From: Edward Adam Davis <eadavis@...com>
To: richardcochran@...il.com
Cc: davem@...emloft.net,
eadavis@...com,
linux-kernel@...r.kernel.org,
netdev@...r.kernel.org,
reibax@...il.com,
syzbot+df3f3ef31f60781fa911@...kaller.appspotmail.com,
syzkaller-bugs@...glegroups.com
Subject: Re: [PATCH-net-next] ptp: fix corrupted list in ptp_open
On Sun, 29 Oct 2023 12:49:00 -0700 Richard Cochran wrote:
>> There is no lock protection when writing ptp->tsevqs in ptp_open(), ptp_read(),
>> ptp_release(), which can cause data corruption and increase mutual exclusion
>> to avoid this issue.
>
>-ENOPARSE
>
>How can lack of lock protection increase mutual exclusion?
Use mutex lock to avoid this issue.
>
>> Moreover, the queue should not be released in ptp_read() and should be deleted
>> together.
>
>The queue should be deleted togther? Huh?
No.
ptp_release() should not be used to release the queue in ptp_read(),
and it should be deleted together.
>
>> @@ -543,6 +552,8 @@ ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags,
>> cnt = EXTTS_BUFSIZE;
>>
>> cnt = cnt / sizeof(struct ptp_extts_event);
>> + if (mutex_lock_interruptible(&ptp->tsevq_mux))
>> + return -ERESTARTSYS;
>
>This is not needed because the spin lock (timestamp_event_queue::lock)
>already protects the event queue.
Yes, you are right, I will remove it.
Thanks,
edward
Powered by blists - more mailing lists