diff options
author | Kuniyuki Iwashima <kuniyu@amazon.co.jp> | 2021-01-29 00:02:17 +0900 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-01-29 20:57:25 -0800 |
commit | df610cd9163b90adc3b5c23868089a0349580551 (patch) | |
tree | d896b3733a684a6b3e1036de5de3ef8780b9407c /net/ipv4 | |
parent | 77609b1db2107b1ac416b60aad361163ff7ca409 (diff) | |
download | linux-df610cd9163b90adc3b5c23868089a0349580551.tar.bz2 |
net: Remove redundant calls of sk_tx_queue_clear().
The commit 41b14fb8724d ("net: Do not clear the sock TX queue in
sk_set_socket()") removes sk_tx_queue_clear() from sk_set_socket() and adds
it instead in sk_alloc() and sk_clone_lock() to fix an issue introduced in
the commit e022f0b4a03f ("net: Introduce sk_tx_queue_mapping"). On the
other hand, the original commit had already put sk_tx_queue_clear() in
sk_prot_alloc(): the callee of sk_alloc() and sk_clone_lock(). Thus
sk_tx_queue_clear() is called twice in each path.
If we remove sk_tx_queue_clear() in sk_alloc() and sk_clone_lock(), it
currently works well because (i) sk_tx_queue_mapping is defined between
sk_dontcopy_begin and sk_dontcopy_end, and (ii) sock_copy() called after
sk_prot_alloc() in sk_clone_lock() does not overwrite sk_tx_queue_mapping.
However, if we move sk_tx_queue_mapping out of the no copy area, it
introduces a bug unintentionally.
Therefore, this patch adds a compile-time check to take care of the order
of sock_copy() and sk_tx_queue_clear() and removes sk_tx_queue_clear() from
sk_prot_alloc() so that it does the only allocation and its callers
initialize fields.
CC: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
Acked-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://lore.kernel.org/r/20210128150217.6060-1-kuniyu@amazon.co.jp
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ipv4')
0 files changed, 0 insertions, 0 deletions