Re: [PATCH net-next] strparser: Return if socket does not have required number of bytes
From: David Miller <davem@davemloft.net>
Date: 2019-01-31 05:59:53
From: David Miller <davem@davemloft.net>
Date: 2019-01-31 05:59:53
From: Vakul Garg <redacted> Date: Wed, 30 Jan 2019 07:31:44 +0000
Function strp_data_ready() should peek the associated socket to check whether it has the required number of bytes available before queueing work or initiating socket read via strp_read_sock(). This saves cpu cycles because strp_read_sock() is called only when required amount of data is available. Signed-off-by: Vakul Garg <redacted>
You can't do this, I think. It's racy and the user socket owned check is absolutely necessary before you do the need bytes check.