]> www.infradead.org Git - users/jedix/linux-maple.git/commit
afs: Fix the maximum cell name length
authorDavid Howells <dhowells@redhat.com>
Mon, 6 Jan 2025 16:21:00 +0000 (16:21 +0000)
committerChristian Brauner <brauner@kernel.org>
Tue, 7 Jan 2025 14:55:25 +0000 (15:55 +0100)
commit8fd56ad6e7c90ac2bddb0741c6b248c8c5d56ac8
treea77e45feef43e63b373e8b8efeafbbcb2f060da5
parent3ff93c5935610f1f53f4b730d9b7b76a9559968a
afs: Fix the maximum cell name length

The kafs filesystem limits the maximum length of a cell to 256 bytes, but a
problem occurs if someone actually does that: kafs tries to create a
directory under /proc/net/afs/ with the name of the cell, but that fails
with a warning:

        WARNING: CPU: 0 PID: 9 at fs/proc/generic.c:405

because procfs limits the maximum filename length to 255.

However, the DNS limits the maximum lookup length and, by extension, the
maximum cell name, to 255 less two (length count and trailing NUL).

Fix this by limiting the maximum acceptable cellname length to 253.  This
also allows us to be sure we can create the "/afs/.<cell>/" mountpoint too.

Further, split the YFS VL record cell name maximum to be the 256 allowed by
the protocol and ignore the record retrieved by YFSVL.GetCellName if it
exceeds 253.

Fixes: c3e9f888263b ("afs: Implement client support for the YFSVL.GetCellName RPC op")
Reported-by: syzbot+7848fee1f1e5c53f912b@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/6776d25d.050a0220.3a8527.0048.GAE@google.com/
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/376236.1736180460@warthog.procyon.org.uk
Tested-by: syzbot+7848fee1f1e5c53f912b@syzkaller.appspotmail.com
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/afs/afs.h
fs/afs/afs_vl.h
fs/afs/vl_alias.c
fs/afs/vlclient.c