Commit c1ba3c0
af_packet: fix the SO_SNDTIMEO constraint not effective on tpacked_snd()
Due to the changes in commit 581073f ("af_packet: do not call
packet_read_pending() from tpacket_destruct_skb()"), every time
tpacket_destruct_skb() is executed, the skb_completion is marked as
completed. When wait_for_completion_interruptible_timeout() returns
completed, the pending_refcnt has not yet been reduced to zero.
Therefore, when ph is NULL, the wait function may need to be called
multiple times until packet_read_pending() finally returns zero.
We should call sock_sndtimeo() only once, otherwise the SO_SNDTIMEO
constraint could be way off.
Fixes: 581073f ("af_packet: do not call packet_read_pending() from tpacket_destruct_skb()")
Cc: stable@kernel.org
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Yun Lu <luyun@kylinos.cn>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>1 parent 5e28d5a commit c1ba3c0
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2785 | 2785 | | |
2786 | 2786 | | |
2787 | 2787 | | |
2788 | | - | |
| 2788 | + | |
2789 | 2789 | | |
2790 | 2790 | | |
2791 | 2791 | | |
| |||
2839 | 2839 | | |
2840 | 2840 | | |
2841 | 2841 | | |
| 2842 | + | |
2842 | 2843 | | |
2843 | 2844 | | |
2844 | 2845 | | |
2845 | 2846 | | |
2846 | 2847 | | |
2847 | 2848 | | |
2848 | 2849 | | |
2849 | | - | |
2850 | 2850 | | |
2851 | 2851 | | |
2852 | 2852 | | |
| |||
0 commit comments