BACKPORT: FROMGIT: ANDROID: xt_qtaguid: Remove tag_entry from process list on untag

A sock_tag_entry can only be part of one process's
pqd_entry->sock_tag_list. Retagging the socket only updates
sock_tag_entry->tag, and does not add the tag entry to the current
process's pqd_entry list, nor update sock_tag_entry->pid.
So the sock_tag_entry is only ever present in the
pqd_entry list of the process that initially tagged the socket.

A sock_tag_entry can also get created and not be added to any process's
pqd_entry list. This happens if the process that initially tags the
socket has not opened /dev/xt_qtaguid.

ctrl_cmd_untag() supports untagging from a context other than the
process that initially tagged the socket. Currently, the sock_tag_entry is
only removed from its containing pqd_entry->sock_tag_list if the
process that does the untagging has opened /dev/xt_qtaguid. However, the
tag entry should always be deleted from its pqd entry list (if present).

Bug: 176919394
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
(cherry picked from commit c2ab93b45b5cdc426868fb8793ada2cac20568ef)

Disallow-Recycled-Builds: test-failures
(cherry picked from commit 2bd81ced0685922df12f4be3338ea632805624e9
 https://android.googlesource.com/kernel/common android-4.14-p)

Conflicts:
   net/netfilter/xt_qtaguid.c

BUG=b:178425172
TEST=Run ARC++

Change-Id: Ia8d9ece0d0152f90e925a65116911cec5c48dcea
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2654306
Reviewed-by: Hugo Benichi <hugobenichi@google.com>
1 file changed