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 96BA9C636CC for ; Wed, 1 Feb 2023 03:11:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229819AbjBADLA (ORCPT ); Tue, 31 Jan 2023 22:11:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229754AbjBADK6 (ORCPT ); Tue, 31 Jan 2023 22:10:58 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DCDFCC04 for ; Tue, 31 Jan 2023 19:10:58 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id m2so12132922plg.4 for ; Tue, 31 Jan 2023 19:10:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=dNwmbpoUgpK9RVRkp7WNwRkV3sDOdGK+t1bOk0Us3Hk=; b=uG73jEp1pU2t8G6JHpz8OVvf+yA+gdH9PWjp2kRgjfrsq8czTp9COZCbTrUx//NYbM daMPid1pjogAgV30y1s4yxAiTlW+nRiftfnOeA1RF2tRhMFjA/hawNexXC7jquDXmYSU DvtJzueJqGTs75yE5BaAxl8SHthb5ZcI/Ajyf0UO4t4kBfDHfMKd/KlQF9w1aGFur1g6 2HBO5F9vUH/rcu+ybeOVyP91fK1t1XZ7QzGf9yYEjybGgRpx6ziGy3QyWZTt7LhKbKGj ybSEIuhqSPxmjLKxFkqzN4YLTmjll9JKHv57g+ZOkRM2wglcO8at+9mCl/RO7bCsG0cp sdfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dNwmbpoUgpK9RVRkp7WNwRkV3sDOdGK+t1bOk0Us3Hk=; b=bzAFZFJPg5cMtvdwNLcjpCFGYCaH1AVc1nPeK03xhSqR4O6ZAV6rPb1xdUu0035pPy TrQNLnCX/g+I8Zp0Fgyk4YN8v7Bay0imDbmo8TAqcaaDTt2680rfDZSmq3vjjqSTvL9T thqyMhAZgU6FfcRYjiqGXO/WWazw3A0N47x/GP7y0PUxa0bg28DQNehdoyP+eJiIE2Kk w9mx/H+9xCwZ4lavOtbTJ/awVrIW7y3eusvi+Q20WfdPw5RS2fb1/tGV+Sv6Q+UQ9pV/ 7LFzcFDxBo8B3hGuXGPdXBu5Q1tXQ9ikLC1K2wi4YUcURn04PAzh0LV++IkSR1ylCFlE 2ebA== X-Gm-Message-State: AO0yUKVtHye34ITXs8fBH52bcf1Y/ofnPZqyp3eHxB8Qz1UT0U+fM9aD Qp9T/MhIUiwPXcXIXH49FQRBIzdvp0bx4E1XoRw= X-Google-Smtp-Source: AK7set9DGBNGEDhGrSL+h9Vf4nUXZLRGNhzNmVbfvX3VyTGxttxQ7Wg3L8E5XC0X+7fM+r9ZhpFOSQ== X-Received: by 2002:a17:902:e1d2:b0:194:9de0:bed1 with SMTP id t18-20020a170902e1d200b001949de0bed1mr964856pla.32.1675221057642; Tue, 31 Jan 2023 19:10:57 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id g17-20020a170902869100b00189c62eac37sm10518521plo.32.2023.01.31.19.10.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 19:10:57 -0800 (PST) Date: Tue, 31 Jan 2023 19:10:55 -0800 From: Stephen Hemminger To: Pietro Borrello Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lorenzo Colitti , Cristiano Giuffrida , "Bos, H.J." , Jakob Koschel , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 1/2] tun: tun_chr_open(): correctly initialize socket uid Message-ID: <20230131191055.45bb4ab7@hermes.local> In-Reply-To: <20230131-tuntap-sk-uid-v1-1-af4f9f40979d@diag.uniroma1.it> References: <20230131-tuntap-sk-uid-v1-0-af4f9f40979d@diag.uniroma1.it> <20230131-tuntap-sk-uid-v1-1-af4f9f40979d@diag.uniroma1.it> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 01 Feb 2023 00:35:45 +0000 Pietro Borrello wrote: > diff --git a/drivers/net/tun.c b/drivers/net/tun.c > index a7d17c680f4a..6713fffb1488 100644 > --- a/drivers/net/tun.c > +++ b/drivers/net/tun.c > @@ -3450,6 +3450,11 @@ static int tun_chr_open(struct inode *inode, struct file * file) > > sock_init_data(&tfile->socket, &tfile->sk); > > + // sock_init_data initializes sk.sk_uid assuming tfile->socket is embedded > + // in a struct socket_alloc and reading its corresponding inode. Since we > + // pass a socket contained in a struct tun_file we have to fix this manually > + tfile->sk.sk_uid = inode->i_uid; > + Do not use C++ style comments in the kernel. Rule #1 of code maintenance. Bug fixes should not stand out.