Article View: linux.kernel.netdev
Article #15744Re: [PATCH RFC 39/41] usb: gadget: f_mass_storage: refuse files on pseudo filesystems
From: Alexander Mikhalitsyn
Date: Fri, 13 Nov 2026 12:36
Date: Fri, 13 Nov 2026 12:36
37 lines
13356 bytes
13356 bytes
On Tue, 2026-11-10 at 10:14 +0100, Christian Brauner wrote:
> fsg_lun_open() takes any regular file as the backing file of a LUN.
> The
> file-storage kthread then reads and writes it with kernel_read() and
> kernel_write() on behalf of the USB host. With a procfs or sysfs file
> behind a LUN the host gets to read and write kernel interfaces with
> kernel credentials. Refuse files on pseudo filesystems just like loop
> does.
>
> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Reviewed-by: Alexander Mikhalitsyn <alex@amutable.com>
> ---
> drivers/usb/gadget/function/storage_common.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/usb/gadget/function/storage_common.c
> b/drivers/usb/gadget/function/storage_common.c
> index 75831f2c7abe..83683ade20c2 100644
> --- a/drivers/usb/gadget/function/storage_common.c
> +++ b/drivers/usb/gadget/function/storage_common.c
> @@ -211,6 +211,11 @@ int fsg_lun_open(struct fsg_lun *curlun, const
> char *filename)
> goto out;
> }
>
> + if (file_is_pseudo(filp)) {
> + LINFO(curlun, "file on a pseudo filesystem: %s\n",
> filename);
> + goto out;
> + }
> +
> /*
> * If we can't read the file, it's no good.
> * If we can't write the file, use it read-only.
Technical Details
Message-ID:
<f12140be54ffc4d1e8e4026f80c41c75cf5727e0.camel@amutable.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362638-linux-kernel-netdev=dewy.ruReferences:
<20261110-work-loop-pseudo-v1-0-4c998976c6c7@kernel.org> <20261110-work-loop-pseudo-v1-39-4c998976c6c7@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362638-linux-kernel-netdev=dewy.ru
From: alex@amutable.com (Alexander Mikhalitsyn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH RFC 39/41] usb: gadget: f_mass_storage: refuse files on
pseudo filesystems
Date: Fri, 13 Nov 2026 13:36:59 +0100
Organization: Usenet Network
Message-ID: <f12140be54ffc4d1e8e4026f80c41c75cf5727e0.camel@amutable.com>
References: <20261110-work-loop-pseudo-v1-0-4c998976c6c7@kernel.org>
<20261110-work-loop-pseudo-v1-39-4c998976c6c7@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="1350578"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:QSi043ASO1izqWcSsV9JCtsv/bM= sha256:iQmadWxn4/LhmXPUb1PnVbdSWNuRWPVin09H0/c70UI=
sha1:d7TZnr4jDBMy/FuNBiYvE9z7prk= sha256:nbAWIkaLmNYGQR0H9xS4k82lCYIPVZUwnXEYjiugeYM=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 5FFA2114542; Fri, 13 Nov 2026 16:29:55 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=amutable-com.20260707.gappssmtp.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 2G3t4s07PCnP;
Fri, 13 Nov 2026 16:29:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-362638-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=amutable.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 3E2BA114538; Fri, 13 Nov 2026 16:29:42 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 646901C50D0; Fri, 13 Nov 2026 12:37:22 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794573427;
b=TrmOhuTDn4WbpZLuqs9K98HTmyuBxlwr9JoXLEk+dVlfzyNmqFTR2vy/7EavhU8eZxCL
qZwXxLI0Iy3kFQoLLq+ubkk9aJF/f9FknOucBICW0Rk+dsJYKkBXjZ+h9vDdCn1LJWr50
A0puvQvnyP5PINpsJGvrUTCPArG4oUyRz+poo0bbv78AwtmlZVHzXSoYDvTeX0Tv8bOvP
Roj+xKx3GXauJjLEEwEYp7SDa+pZyneE92twrpAWuTxgqpfR+uFmFOgJereAFKGcijTSM
fveTvyWnxDuv6Q5K/Ioqj+qGNsPM7VtKWiZw4VIXjB0ufXD5xDN1ueU7R7Y6RF/UjWA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794573427;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Message-ID:Subject:From:To:Cc:Date:
In-Reply-To:References:Content-Type:Content-Transfer-Encoding:
User-Agent:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version;
bh=87/Ge5NhXdmtGpcXCLUvnqWpWEAxiW5M6eWOW+m4zUs=;
b=giD6MlROyczw0xRc+AL2w3Ug6cywc4+5PQsYfp7OaQKvx97aHzwIkzCl1zwMEwqU5+i7
cu3rtgDeP4ZjWDlb9n0hmXRgWQqTCDLnGUUUuIMY60CmDlxRNEhs/8M5KkwyBAraDC9sr
VdPoYyvH1TPKEVskagVUmrZPS5SCP/i5lnWwjfc/erdYrxf8HPYv+WIiz/moVbIa3GKoz
W6zTHbGrYZsE6LO0iI2/79KiEzena37UYux6R0FeZsoFhrEMs0mXeugp3rmv489M2DlWJ
t+YT2XgBnj3uEQysMnQTEGGRpGZ0qAL36JMFWaPORAiz+pAIosNZ3mrCvAMsYn4vw1Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=amutable-com.20260707.gappssmtp.com header.i=@amutable-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=n2XPHptJ;
dmarc=none header.from=amutable.com;
spf=pass smtp.mailfrom=amutable.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 0CCF3606A338;
Fri, 13 Nov 2026 12:37:07 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=amutable-com.20260707.gappssmtp.com header.i=@amutable-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=n2XPHptJ
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.225.138
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794573426;
b=v7Us6ppBdKSsyDL+0FGIXfub9oYES8T1aXOiKxZZYtKTgNsd5kxquqdw0mfn03VPzwS3
s7AmFXDfYjfp9lUvKmfKKJYPQGbL+TvuVTbw/383zA6/oSaiV/HvvtYefFegqueksIQoT
3nGKX/p/2Wx8/3/h8Y8RG+Pxi8XD+GW293qNqf4HG8vD+tNiR8y5lMQedhz7AdSSpSFm0
UB1Y2I0YkclAmqOfkDdkOWrJ0VrdHnLQj9vDkiDR9P6SKvBlRrYH1haNXUTGyPGBRa4SK
Udm6L6vBHMoGUfNE706osa4e+O+jIjX/KpXizLWZkKn5zRHDlC90VgNBt/Siwgrf1bw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794573426;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:
Content-Type:Content-Transfer-Encoding:User-Agent:MIME-Version;
bh=87/Ge5NhXdmtGpcXCLUvnqWpWEAxiW5M6eWOW+m4zUs=;
b=UQvfU55WQGHFIrc9RmlLUpBWnQeadcp/I5Fnb6YRINvh5kBHzzyGKfK5RBA7hJPhNN18
p1Xa7MDl24YwAiVA6Js7UztKF/AMylW77PtOl1z+l1Fsir8IN7pUUyK0dByZOR2vfyh+B
W/q7NktImS3Uue9d5Vn63qtKYvXux4KZBSO9X6aaloAnA6BaJc7rPfr59dFtrbsswQFsr
jNN8EeP+Y9/V1j01vTPTzLeeHVy49bsafeQwkMk4TjpLlJ34rCwZXx6ZXdZSWGjyLXIqf
Um0TjtIvJV63/PvFx06QvydcUKV897ZuYTaJO4gHp+Wq9g7WV7rjb8xjR75qZa0WLgg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none header.from=amutable.com;
spf=pass smtp.mailfrom=amutable.com;
dkim=pass header.d=amutable-com.20260707.gappssmtp.com header.i=@amutable-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=n2XPHptJ;
arc=none smtp.remote-ip=74.125.225.138
X-Received: from mail-wm2-f10.google.com (mail-wm2-f10.google.com [74.125.225.138])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF6E0606A339
for <netdev@vger.kernel.org>; Fri, 13 Nov 2026 12:37:04 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DF6E0606A339
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=amutable.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amutable.com
X-Received: by mail-wm2-f10.google.com with SMTP id 5b1f17b1804b1-4b886ebe069so3303865e9.1
for <netdev@vger.kernel.org>; Fri, 13 Nov 2026 04:37:04 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=amutable-com.20260707.gappssmtp.com; s=20260707; t=1794573423; x=1795178223; darn=vger.kernel.org;
h=mime-version:user-agent:content-transfer-encoding:content-type
:references:in-reply-to:date:cc:to:from:subject:message-id:from:to
:cc:subject:date:message-id:reply-to:content-type;
bh=87/Ge5NhXdmtGpcXCLUvnqWpWEAxiW5M6eWOW+m4zUs=;
b=n2XPHptJWAiGnWBjuWK6g5NkFljgiKFcabC8Vn0J/U7Rs5oCxIs8ae//bm8icbKFtW
GhaGag1Xoi7ZyXwdHESo4gzqQGVIFHJ4SWyDVffZrMrzihrR6J8Y41NroO1pUm4S3UEM
GevRMV87lpSFNCzDE68IInZGbL5X+gYDk7IApotAPKeUo9xOfBbHGBSC5mcggp0KJBcK
Nc+e1mR1SmgmgC0Frha4Bk72pKDTzd14yUseYASwtvG8qZfbG+gNn4GmoQhA8ODET64L
X6SskqZIriPJvj35d5mhI8G8hobVKdLKjnxeG6bMHAYcCPTjUD9dRkaaJK3nWVTXV/IA
bDIw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794573423; x=1795178223;
h=mime-version:user-agent:content-transfer-encoding:content-type
:references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=87/Ge5NhXdmtGpcXCLUvnqWpWEAxiW5M6eWOW+m4zUs=;
b=DJcN3V36dDV5M58Yo90DYRrkHki9HZxQ6P1uJsQVRY8Tf/gxVptyv/m0Ox7gDsWbOJ
0NRN9QXT402BJnYXdZfvlGjM5yIz3xStO6KSaWnQantRKXTVqpHo9ty98fo5NzwyaMWN
YWO+n9H7COuuEHvuqQ5zAPh2Xltt4LdwoCImqJxQVKjl22asUQfVlWpm91L494nesjOd
0qdXUcKN8bLg7VV9OnLYsJ3TzoeBbKOLQ8SjPZRdmpK5wgdll7tSp/aEv41XFWqa6FZu
KaXXy6XBclMP9p5ZcmcaE9lQwphDGSpwG3/PNlkXa7t8rPMXI1m/cT3zNdc26rcEuJLW
ZZKQ==
X-Forwarded-Encrypted: i=1; AL+hErFGyctwOVCzsaGeb5DhUh6l3F6lsSg0/WWwro5ihHhSsCb7+MZcSylGnfIRkzvUr3GDC0ddS1k=@vger.kernel.org
X-Gm-Message-State: APuU4Z/RwuS81jlvImZLZ1wDZyfwwwJKeYwEx55edfHYUPRfSKAiDTCb
s3PLHQXz3Kw5L2YyKWZJs0IIunBdmf+JGxXMwj78a42sSJeFazZZe0Z3g0m+fKMjXJ1U
X-Gm-Gg: AYBFou1s9Zy996lYIXKPbpZRcBClE4LHo82+a0YbY4/BLuBFWdHxX6CiV5/acdol5M6
CKyG+sn0GZZxxmnyuaAYGtxc1j44fCjuu31cT7ouiJy2QBISJok97aqzqfiPopKayb4I8UNRKzx
525gwH/APqNuLnRBd7opsfBClKjD5RAzrktKPx+JeBV5JzRG7SNiotN7MQERGrHwAsglxooMotV
1EZGAnFsMPtwTLyhNleCH+iXBzzCrpiTLUcM6J9lGLBQkGhKmxL5L8WawynB+g8uiJ7i7cHPh+N
nOc6xVIEHJLhBKuKAPFYwmn6p9e+M7QzQihiFAENnKbAzUIY/SLnAFu4SL3pJ0Kg027eU7oUp7k
QIZIE4w69wUsQZTntyc9vPK3+mS0UDRFGixwsitRgHlG/HhNJeN4MbDk4AHi45wCs9g7zVBguGM
MdGUF2QBME9WvqJqG71DHjZnTBNGeHf4kQ8lTfb1UEPJUYXJAvzOtbPyo9Ac02aTWnfLTc6y7V7
ViW58AGn+mz+d28DDkRsUoCZyedZ1fXxM8ZU+Qg5/K7h+0orN6DzTdD1P/1wEjN2r2KD1CJD/YD
G3bMB5M16k08PfEo+4pYQjC5Pa0F+qbdAmwcOYRUQNelfSE8PCQl5I2nHOh11wa3DRw8bI3rkJL
rVsoXgmDz
X-Received: by 2002:a05:600c:b86:b0:4b5:d95c:2378 with SMTP id 5b1f17b1804b1-4bb55ac4030mr49782945e9.34.1794573423157;
Fri, 13 Nov 2026 04:37:03 -0800 (PST)
X-Received: from [10.0.0.233] (tmo-086-54.customers.d1-online.com. [80.187.86.54])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb55af2901sm57437255e9.13.2026.11.13.04.37.00
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 13 Nov 2026 04:37:02 -0800 (PST)
X-Cc: Jann Horn <jannh@google.com>, Chris Mason <mason@kernel.org>, Josef
Bacik <josef@toxicpanda.com>, Christoph Hellwig <hch@lst.de>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, Alexander Viro <viro@zeniv.linux.org.uk>,
Jan Kara <jack@suse.cz>, linux-scsi@vger.kernel.org,
target-devel@vger.kernel.org, driver-core@lists.linux.dev,
linux-mm@kvack.org, bpf@vger.kernel.org,
linux-security-module@vger.kernel.org, selinux@vger.kernel.org,
apparmor@lists.ubuntu.com, linux-nfs@vger.kernel.org,
netdev@vger.kernel.org, fuse-devel@lists.linux.dev,
linux-efi@vger.kernel.org, xen-devel@lists.xenproject.org,
ocfs2-devel@lists.linux.dev, linux-s390@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-usb@vger.kernel.org, Amir Goldstein
<amir73il@gmail.com>, linux-erofs@lists.ozlabs.org,
linux-kselftest@vger.kernel.org
X-In-Reply-To: <20261110-work-loop-pseudo-v1-39-4c998976c6c7@kernel.org>
X-User-Agent: Evolution 3.56.2-0+deb13u1
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list