Re: [PATCH net-next 1/3] net-timestamp: add strict check when setting tx flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30/09/2024 10:24, Jason Xing wrote:
From: Jason Xing <kernelxing@xxxxxxxxxxx>

Even though this case is unlikely to happen, we have to avoid such
a case occurring at an earlier point: the sk_rmem_alloc could get
increased because of inserting more and more skbs into the errqueue
when calling __skb_complete_tx_timestamp(). This bad case would stop
the socket transmitting soon.

Signed-off-by: Jason Xing <kernelxing@xxxxxxxxxxx>
---
  net/core/sock.c | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/net/core/sock.c b/net/core/sock.c
index fe87f9bd8f16..4bddd6f62e4f 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -905,6 +905,10 @@ int sock_set_timestamping(struct sock *sk, int optname,
  	if (val & ~SOF_TIMESTAMPING_MASK)
  		return -EINVAL;
+ if (val & SOF_TIMESTAMPING_TX_RECORD_MASK &&
+	    !(val & SOF_TIMESTAMPING_SOFTWARE))
+		return -EINVAL;

SOF_TIMESTAMPING_TX_RECORD_MASK contains SOF_TIMESTAMPING_TX_HARDWARE.
That means that there will be no option to enable HW TX timestamping
without enabling software timestamping. I believe this is wrong
restriction.

+
  	if (val & SOF_TIMESTAMPING_OPT_ID_TCP &&
  	    !(val & SOF_TIMESTAMPING_OPT_ID))
  		return -EINVAL;





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux