From nobody Sat Sep 13 09:18:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDA1CC64EC3 for ; Sat, 4 Feb 2023 17:39:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233093AbjBDRjn (ORCPT ); Sat, 4 Feb 2023 12:39:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232576AbjBDRji (ORCPT ); Sat, 4 Feb 2023 12:39:38 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19706222C4 for ; Sat, 4 Feb 2023 09:39:36 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id dr8so23454624ejc.12 for ; Sat, 04 Feb 2023 09:39:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=diag.uniroma1.it; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=W/eOodguwW0STRp0sOylYiqIEzEkDsRJryvWVBj7Tj0=; b=V2mUDq13aAExtvc8b5Fn1aerouoj1TDWrw6MWGWKI36CiAjmYpwPX1v5ua9F+COX/o oUbGOdGAzGvOaIIv+P9KgA7fKVskKfk+Ov2VYv04DLXSpxNGYP1h4QXxOEWq5QAlIc7q SUQbPV59TYD9pg8OEEDd1cM9bPQPSThnltpUo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W/eOodguwW0STRp0sOylYiqIEzEkDsRJryvWVBj7Tj0=; b=u9w3suekGrVE+fqTEDdYIgQ1LHxR2mlntQYHmAs+hc0cYZBoY9wL+9HKov177Zmozn mHNblXvWkRQmxxRyU/AFFl8vrEaAGEOd4NTMfzpFwOhfNdntvXH2/KHMiB2IAtSxUsOG kyNTVELX6f8TWnRJ9dA/FeBEZrrlxkS7C+ILLN02B15d0xj8K+9PZhMZaTrmEVyuE3j3 XaamuWwG/Jin4welEGVaqvPGxAhHsfwX+/76XLxkukB9e6xNstNtsTB58Js7bhaFzKSG d+CWZxmUykAFJnItNDCBlSNnooIgBMBWwc+enMeheGPQdxuVj3xCzPKjMpg8RfwETjGg HpGw== X-Gm-Message-State: AO0yUKVx9jv/6Grlyc87ChJKBX5/WAhas1IdkX+t4F3B83G+eTBx/ZaQ /+s7/t9u8c6UOhFby7PThbcLB3W5oCHch1c0o2dPag== X-Google-Smtp-Source: AK7set/7vJsPrtgT1EsZ9QiuN+7qj2SltvrccgvnMIL5zDXawx96JnGrdfeOYjmqR/2dvG5S+GUGnA== X-Received: by 2002:a17:906:b4b:b0:878:71fe:2f12 with SMTP id v11-20020a1709060b4b00b0087871fe2f12mr15495013ejg.50.1675532374624; Sat, 04 Feb 2023 09:39:34 -0800 (PST) Received: from [192.168.17.2] (wolkje-127.labs.vu.nl. [130.37.198.127]) by smtp.gmail.com with ESMTPSA id ot1-20020a170906ccc100b008897858bb06sm3039321ejb.119.2023.02.04.09.39.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 09:39:34 -0800 (PST) From: Pietro Borrello Date: Sat, 04 Feb 2023 17:39:20 +0000 Subject: [PATCH net-next v3 1/3] net: add sock_init_data_uid() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230131-tuntap-sk-uid-v3-1-81188b909685@diag.uniroma1.it> References: <20230131-tuntap-sk-uid-v3-0-81188b909685@diag.uniroma1.it> In-Reply-To: <20230131-tuntap-sk-uid-v3-0-81188b909685@diag.uniroma1.it> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lorenzo Colitti Cc: Stephen Hemminger , Cristiano Giuffrida , "Bos, H.J." , Jakob Koschel , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Pietro Borrello X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1675532373; l=2607; i=borrello@diag.uniroma1.it; s=20221223; h=from:subject:message-id; bh=kN6b+mn+Xy5aGO+SctMF63Je9JkYLzu955YoGSa6qrQ=; b=EuajB2ZiGsi241Dg3sGGmG4MCz4SeW5nITQRJ92iQkELJ9FbqSNvModUMQy8iEN3cCVa7bedsfH4 d3G9tlRhBSWpW8JAXyGi9i0oHzvgvyzaSx6eoi8j3vIPK6MCooLC X-Developer-Key: i=borrello@diag.uniroma1.it; a=ed25519; pk=4xRQbiJKehl7dFvrG33o2HpveMrwQiUPKtIlObzKmdY= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add sock_init_data_uid() to explicitly initialize the socket uid. To initialise the socket uid, sock_init_data() assumes a the struct socket* sock is always embedded in a struct socket_alloc, used to access the corresponding inode uid. This may not be true. Examples are sockets created in tun_chr_open() and tap_open(). Fixes: 86741ec25462 ("net: core: Add a UID field to struct sock.") Signed-off-by: Pietro Borrello Reviewed-by: Eric Dumazet --- include/net/sock.h | 7 ++++++- net/core/sock.c | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index dcd72e6285b2..937e842dc930 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1956,7 +1956,12 @@ void sk_common_release(struct sock *sk); * Default socket callbacks and setup code */ =20 -/* Initialise core socket variables */ +/* Initialise core socket variables using an explicit uid. */ +void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid); + +/* Initialise core socket variables. + * Assumes struct socket *sock is embedded in a struct socket_alloc. + */ void sock_init_data(struct socket *sock, struct sock *sk); =20 /* diff --git a/net/core/sock.c b/net/core/sock.c index f954d5893e79..9f51ee851a85 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3379,7 +3379,7 @@ void sk_stop_timer_sync(struct sock *sk, struct timer= _list *timer) } EXPORT_SYMBOL(sk_stop_timer_sync); =20 -void sock_init_data(struct socket *sock, struct sock *sk) +void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid) { sk_init_common(sk); sk->sk_send_head =3D NULL; @@ -3399,11 +3399,10 @@ void sock_init_data(struct socket *sock, struct soc= k *sk) sk->sk_type =3D sock->type; RCU_INIT_POINTER(sk->sk_wq, &sock->wq); sock->sk =3D sk; - sk->sk_uid =3D SOCK_INODE(sock)->i_uid; } else { RCU_INIT_POINTER(sk->sk_wq, NULL); - sk->sk_uid =3D make_kuid(sock_net(sk)->user_ns, 0); } + sk->sk_uid =3D uid; =20 rwlock_init(&sk->sk_callback_lock); if (sk->sk_kern_sock) @@ -3462,6 +3461,16 @@ void sock_init_data(struct socket *sock, struct sock= *sk) refcount_set(&sk->sk_refcnt, 1); atomic_set(&sk->sk_drops, 0); } +EXPORT_SYMBOL(sock_init_data_uid); + +void sock_init_data(struct socket *sock, struct sock *sk) +{ + kuid_t uid =3D sock ? + SOCK_INODE(sock)->i_uid : + make_kuid(sock_net(sk)->user_ns, 0); + + sock_init_data_uid(sock, sk, uid); +} EXPORT_SYMBOL(sock_init_data); =20 void lock_sock_nested(struct sock *sk, int subclass) --=20 2.25.1 From nobody Sat Sep 13 09:18:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E2ECC61DA4 for ; Sat, 4 Feb 2023 17:39:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233126AbjBDRjr (ORCPT ); Sat, 4 Feb 2023 12:39:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232661AbjBDRjj (ORCPT ); Sat, 4 Feb 2023 12:39:39 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A86F227AD for ; Sat, 4 Feb 2023 09:39:36 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id dr8so23454647ejc.12 for ; Sat, 04 Feb 2023 09:39:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=diag.uniroma1.it; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=pxDbwUh++gky5GuA5AqNVx6J2j18/7Ee7MKCicvy88w=; b=buyuf0JdK/ntq47wAkQZkVe3glYX/nPcfJGZlfZ6gBilRd2YcQ3XskdKwjAEFHv/gz XwaEv2Ib123vaz2ZCaJgWMuUD1S7xHdm6mVMQoXYII8+GWnaX6KhrlOeosP3wvuvsfmS Rj7KkTYGuX0pq/mdeIA7TZ1VC3gnBUBFeZYMk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pxDbwUh++gky5GuA5AqNVx6J2j18/7Ee7MKCicvy88w=; b=LzXegPYjImDTWgxYESxswjjO69l6PEsH4ZxhiiGFXEvZP6QjQDMNe2tChcbZXTI7uW 95yAEdiKq90LQaygFuDolcw6FrtxO4i1lBIIacqn+2bXZxS5bmViWYFPYaFjQkxsJQ29 riR/9uAL/B5UOm+Vm+pNnmpX1FgNaJVp/OG23kGV8qDzVQK2DD5uKegzLt/W7BUjGGII DNiN/ufXy6YX2smFH0rCGlwtHZLdD8BvHpDvxi9C81JTE0TpZWpEpgzoTbAU0ieUjiAn D15BUIKv4rHnSTnUwspPqZ4YTrC8eKYZxOJSwTqNXINFO3X6Gx2AHTlsIp1gKMK59vZ/ qYjw== X-Gm-Message-State: AO0yUKXCtSiFuTrzsLnXANKo2e4JiHHu5cPkSgX2PAU+UIZeO2clVnIW +upImC1P9eLFqAEQ3qOAvr8CAw== X-Google-Smtp-Source: AK7set8MZ7HsnYzKKNRu9LHf37zrwD3r79u9pR2bbErX/X3p3zvdmTkIbSQ8r26irG4GjbeIEkBv+Q== X-Received: by 2002:a17:906:135a:b0:881:d1ad:1640 with SMTP id x26-20020a170906135a00b00881d1ad1640mr13755676ejb.57.1675532375103; Sat, 04 Feb 2023 09:39:35 -0800 (PST) Received: from [192.168.17.2] (wolkje-127.labs.vu.nl. [130.37.198.127]) by smtp.gmail.com with ESMTPSA id ot1-20020a170906ccc100b008897858bb06sm3039321ejb.119.2023.02.04.09.39.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 09:39:34 -0800 (PST) From: Pietro Borrello Date: Sat, 04 Feb 2023 17:39:21 +0000 Subject: [PATCH net-next v3 2/3] tun: tun_chr_open(): correctly initialize socket uid MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230131-tuntap-sk-uid-v3-2-81188b909685@diag.uniroma1.it> References: <20230131-tuntap-sk-uid-v3-0-81188b909685@diag.uniroma1.it> In-Reply-To: <20230131-tuntap-sk-uid-v3-0-81188b909685@diag.uniroma1.it> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lorenzo Colitti Cc: Stephen Hemminger , Cristiano Giuffrida , "Bos, H.J." , Jakob Koschel , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Pietro Borrello X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1675532373; l=1432; i=borrello@diag.uniroma1.it; s=20221223; h=from:subject:message-id; bh=RM1ujG+d5gzCRApp5A/JtPOTgjex/btJO1mhhXLZSPY=; b=cmKZ2P1hEmqn8BQf1I1aAoelNXYwPMiZ6KlyR4d7SPR9D+zLPAOwBXGxCVvPEnQh309mRubKW7xK nEss/n0gAsN9bGEiwsNTrDLycsyfxoN9NskJgcZ88Yw59Ygj8OfR X-Developer-Key: i=borrello@diag.uniroma1.it; a=ed25519; pk=4xRQbiJKehl7dFvrG33o2HpveMrwQiUPKtIlObzKmdY= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sock_init_data() assumes that the `struct socket` passed in input is contained in a `struct socket_alloc` allocated with sock_alloc(). However, tun_chr_open() passes a `struct socket` embedded in a `struct tun_file` allocated with sk_alloc(). This causes a type confusion when issuing a container_of() with SOCK_INODE() in sock_init_data() which results in assigning a wrong sk_uid to the `struct sock` in input. On default configuration, the type confused field overlaps with the high 4 bytes of `struct tun_struct __rcu *tun` of `struct tun_file`, NULL at the time of call, which makes the uid of all tun sockets 0, i.e., the root one. Fix the assignment by using sock_init_data_uid(). Fixes: 86741ec25462 ("net: core: Add a UID field to struct sock.") Signed-off-by: Pietro Borrello Reviewed-by: Eric Dumazet --- drivers/net/tun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index a7d17c680f4a..745131b2d6db 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -3448,7 +3448,7 @@ static int tun_chr_open(struct inode *inode, struct f= ile * file) tfile->socket.file =3D file; tfile->socket.ops =3D &tun_socket_ops; =20 - sock_init_data(&tfile->socket, &tfile->sk); + sock_init_data_uid(&tfile->socket, &tfile->sk, inode->i_uid); =20 tfile->sk.sk_write_space =3D tun_sock_write_space; tfile->sk.sk_sndbuf =3D INT_MAX; --=20 2.25.1 From nobody Sat Sep 13 09:18:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C838C636CC for ; Sat, 4 Feb 2023 17:39:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233149AbjBDRjw (ORCPT ); Sat, 4 Feb 2023 12:39:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232957AbjBDRjj (ORCPT ); Sat, 4 Feb 2023 12:39:39 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FBBC23647 for ; Sat, 4 Feb 2023 09:39:37 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id mc11so23472552ejb.10 for ; Sat, 04 Feb 2023 09:39:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=diag.uniroma1.it; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=diRmWeCrr8oLC0zFkxgOTHjfxqbtb56o/4Jn3DMGHrU=; b=a/oiPRLN2voU6osfRxYBgHzhPMEkohEGki/USRxp8t65Yx8iQunogBOKJfJQvdxcvX 4LSUiSE3KbLXZOBx4XsltL9BfdRBITtOuDL8yQxBVJ/LeBZG9BiIjRf8fS0NoerD+6l9 Bn7/3OzE6+3a38BGMraO6zsEJnPFY/eB8TQqo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=diRmWeCrr8oLC0zFkxgOTHjfxqbtb56o/4Jn3DMGHrU=; b=CgYcbe1HZ+7SnZfVsnJZfB8x93Q7lGxDLgMg1xwosvoOr+18DJu6G3LIc3cA5xLq1G aNk7FPR1+JEFFYkx/YWNdDzxMdcU6BcdrvhdRp/eoWp8ogdk2TwoSgpBWrZ0VdFR1UaL KvEb7l4xNRYDNWj9+dANARy5DRQVId1WLsBlsGTf6T1o1AuHgcUeDj+2MMBNHcK9uwpm h4qSCO0FcDwWryPmHmiMf3Z9zrcK6zL/1Yljl3xB0DcWsyDRNc0SwJshFVy9Q9x3FoUn 3XIU+rjg7BMlHYfJ3gq5bD7xCmJTOHTRk7ZUCkTxMtzkDvamufASokgkGQm3CNb3OUfP Oseg== X-Gm-Message-State: AO0yUKUDekQGo7OOiIffPcg1IMnoEtv5AEP9rXj+spMPL3mIm9KQ2cZ/ q+umISiAz46gxi1JMjIC/pej3A== X-Google-Smtp-Source: AK7set+O/fypeP/fHfMs6yS/2lN4ie/RPoXjNSSoCtm/01r+LWVzIvvCDwRptB5+M90D3SqnVRlcZg== X-Received: by 2002:a17:906:c7cf:b0:88f:9445:f8df with SMTP id dc15-20020a170906c7cf00b0088f9445f8dfmr5823499ejb.21.1675532375619; Sat, 04 Feb 2023 09:39:35 -0800 (PST) Received: from [192.168.17.2] (wolkje-127.labs.vu.nl. [130.37.198.127]) by smtp.gmail.com with ESMTPSA id ot1-20020a170906ccc100b008897858bb06sm3039321ejb.119.2023.02.04.09.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 09:39:35 -0800 (PST) From: Pietro Borrello Date: Sat, 04 Feb 2023 17:39:22 +0000 Subject: [PATCH net-next v3 3/3] tap: tap_open(): correctly initialize socket uid MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230131-tuntap-sk-uid-v3-3-81188b909685@diag.uniroma1.it> References: <20230131-tuntap-sk-uid-v3-0-81188b909685@diag.uniroma1.it> In-Reply-To: <20230131-tuntap-sk-uid-v3-0-81188b909685@diag.uniroma1.it> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lorenzo Colitti Cc: Stephen Hemminger , Cristiano Giuffrida , "Bos, H.J." , Jakob Koschel , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Pietro Borrello X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1675532373; l=1467; i=borrello@diag.uniroma1.it; s=20221223; h=from:subject:message-id; bh=BevjpYXm4mBtNUkCZd9Z2Jro8meWCGFZ1iKL7fvrTDc=; b=0Dov0FXUUGwtocqIsuWBgoTVbYiz2+QJmrgCqWd22jBqxy1dSg6L4OFlnsrpIWHw+eSz0cT54C+q Fc0HpllIB+NfovpFMTaTbzjUNzlMI1SrbdYojgGuvi7RNeDA/AN0 X-Developer-Key: i=borrello@diag.uniroma1.it; a=ed25519; pk=4xRQbiJKehl7dFvrG33o2HpveMrwQiUPKtIlObzKmdY= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sock_init_data() assumes that the `struct socket` passed in input is contained in a `struct socket_alloc` allocated with sock_alloc(). However, tap_open() passes a `struct socket` embedded in a `struct tap_queue` allocated with sk_alloc(). This causes a type confusion when issuing a container_of() with SOCK_INODE() in sock_init_data() which results in assigning a wrong sk_uid to the `struct sock` in input. On default configuration, the type confused field overlaps with padding bytes between `int vnet_hdr_sz` and `struct tap_dev __rcu *tap` in `struct tap_queue`, which makes the uid of all tap sockets 0, i.e., the root one. Fix the assignment by using sock_init_data_uid(). Fixes: 86741ec25462 ("net: core: Add a UID field to struct sock.") Signed-off-by: Pietro Borrello Reviewed-by: Eric Dumazet --- drivers/net/tap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/tap.c b/drivers/net/tap.c index a2be1994b389..8941aa199ea3 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -533,7 +533,7 @@ static int tap_open(struct inode *inode, struct file *f= ile) q->sock.state =3D SS_CONNECTED; q->sock.file =3D file; q->sock.ops =3D &tap_socket_ops; - sock_init_data(&q->sock, &q->sk); + sock_init_data_uid(&q->sock, &q->sk, inode->i_uid); q->sk.sk_write_space =3D tap_sock_write_space; q->sk.sk_destruct =3D tap_sock_destruct; q->flags =3D IFF_VNET_HDR | IFF_NO_PI | IFF_TAP; --=20 2.25.1