From patchwork Wed May 29 23:30:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1941493 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=K29ZAA7L; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-cifs+bounces-2128-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VqQc23mPjz20Pc for ; Thu, 30 May 2024 09:30:42 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4AEE21C214C1 for ; Wed, 29 May 2024 23:30:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F5F616EBF9; Wed, 29 May 2024 23:30:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="K29ZAA7L" X-Original-To: linux-cifs@vger.kernel.org Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9467D6AB8 for ; Wed, 29 May 2024 23:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717025437; cv=none; b=kZql+/rgrgssegZVhoRc9VNtIGz3fooqJkQe2MLcGCU/WNj5UkgbfhNbKjMNZbCT7AQBafthmuDiwWAVEozL6Lli751+usqyRFNH8SSzAjmqqv9E/yYJIqseTIDeWKSHkNn8IuqhDE7wgsYDEoevxpDs9c6EPrFpV7vqAbV2eL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717025437; c=relaxed/simple; bh=be3xYegWtREqlZXf54qmLIYyJKDlfD3/Q7TvzRdPLwc=; h=MIME-Version:From:Date:Message-ID:Subject:To:Content-Type; b=a6gSh4cxEeqThTGY8DRXE5YfKHhJcyfWw/EqwZyv08ytYb+jUd24g/Aj9WQPdF4dUxnyikEw0phdI8xX4LP5KLBHNz//icdpOqC3G8Zj/24KXyNheCY8Sn/O3Zf6LXq8wH4ZaNXex6MbyxdKe0v4e3TG5PZAVxTULDWrnUoOb6k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=K29ZAA7L; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-52961b77655so338043e87.2 for ; Wed, 29 May 2024 16:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717025433; x=1717630233; darn=vger.kernel.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=U4wy0G0NxHEn49dyt0bFP6nspNhe6kcAzngHd8yws04=; b=K29ZAA7L9RbrsikIG3MS0fDfAndL2KPKDYSNOrwV44zKHItARelZz/4Wpteg0bkyx9 PojcDfx+jXZmtDyhBrbUvBoy5TKMqX/6axxQ3GVSbABnnHAYULCCkJR0+yZZDcdNT3wg tQYrAt45TQbDKOFofAiFidA8RoC4aBJDt2cpIaS3Xv/Ppiw/INjWdMei0HIKlFu9gJA+ g8VpbM67FYyq2sB932heOVCRCfvcOGnjy8M721pASZw+CJrMkMjLyrsWpR5E8HShwOuI u+ONNC63pvbQ9C7YGpfMdHRwPHSv7x/bfm4p7RFMCAW+Tvoi6o4CIOsk9vImP6aW4I1b g2LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717025433; x=1717630233; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=U4wy0G0NxHEn49dyt0bFP6nspNhe6kcAzngHd8yws04=; b=nkzT3u+vDE9metjc0va7oQqBbDBEet43NIeIFg681ngo4FbOO+P/T8QidUha1hyRCn Ak4p8z4JY28UFdLnu4pJoMBiWBH5ln+Sr8I/RPNCWIKZlU65qcCA5/wQJVtTB9EXYxVi oTa0Ua0IjhPk/c5MjKUTADZJQi2gJ0/LBC4v0oiVxsjcWUX1q1N+4iwtRux3VaKMPsp2 W5QkWyOZNyPby6e/AOkbgsZ/Bh1rqgnLomDVZfNIe0QllCxv7+1aPsJacrMUkLxncIHg 5e8+X+aM63eFtzLdVeXZ1CNPxLQ0qGaMZwQ72wHJqMsfQ69waPnIzPccBJGqvzQLLkl1 +FVA== X-Gm-Message-State: AOJu0YzQmtm9yDucUDPO9aXHTmtpQ0SA9J8PCscmHf7V23w+udyXbcEj 9RaRcpazjwtZk4bCxfTOyrR4sSF30wcX95tb7eq05joHDJrFf2ABjBbguHkPR+y4ptzbAeXxafF 3Km9j81hAWGIYAFSTNcH1WWmDKcUZUtpi X-Google-Smtp-Source: AGHT+IHmVpSCcBlWadWmrRrbVNx0kZ7AoAPtAzH7V+NipPSEGVB09fzAIg3NmSbpGqeqormnecbRaOzx8HSSRrhAx34= X-Received: by 2002:ac2:5923:0:b0:529:b1be:8fe1 with SMTP id 2adb3069b0e04-52b7d490d07mr258219e87.63.1717025433224; Wed, 29 May 2024 16:30:33 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Steve French Date: Wed, 29 May 2024 18:30:20 -0500 Message-ID: Subject: [PATCH][SMB3 client] fix creating sockets when using sfu mount options To: CIFS cifs: fix creating sockets when using sfu mount options When running fstest generic/423 with sfu mount option, it was being skipped due to inability to create sockets: generic/423 [not run] cifs does not support mknod/mkfifo which can also be easily reproduced with their af_unix tool: ./src/af_unix /mnt1/socket-two bind: Operation not permitted Fix sfu mount option to allow creating and reporting sockets. See attached From 7e476a83fc35f825759d079f4a0ce349bd927ca9 Mon Sep 17 00:00:00 2001 From: Steve French Date: Wed, 29 May 2024 18:16:56 -0500 Subject: [PATCH] cifs: fix creating sockets when using sfu mount options When running fstest generic/423 with sfu mount option, it was being skipped due to inability to create sockets: generic/423 [not run] cifs does not support mknod/mkfifo which can also be easily reproduced with their af_unix tool: ./src/af_unix /mnt1/socket-two bind: Operation not permitted Fix sfu mount option to allow creating and reporting sockets. Cc: stable@vger.kernel.org Signed-off-by: Steve French --- fs/smb/client/cifspdu.h | 2 +- fs/smb/client/inode.c | 13 +++++++++++++ fs/smb/client/smb2ops.c | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/fs/smb/client/cifspdu.h b/fs/smb/client/cifspdu.h index c46d418c1c0c..a2072ab9e586 100644 --- a/fs/smb/client/cifspdu.h +++ b/fs/smb/client/cifspdu.h @@ -2574,7 +2574,7 @@ typedef struct { struct win_dev { - unsigned char type[8]; /* IntxCHR or IntxBLK or LnxFIFO*/ + unsigned char type[8]; /* IntxCHR or IntxBLK or LnxFIFO or LnxSOCK */ __le64 major; __le64 minor; } __attribute__((packed)); diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c index 262576573eb5..6e4fac5f64bc 100644 --- a/fs/smb/client/inode.c +++ b/fs/smb/client/inode.c @@ -602,6 +602,19 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path, /* we have enough to decode dev num */ __u64 mjr; /* major */ __u64 mnr; /* minor */ + mjr = le64_to_cpu(*(__le64 *)(pbuf+8)); + mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); + fattr->cf_rdev = MKDEV(mjr, mnr); + } + } else if (memcmp("LnxSOCK", pbuf, 8) == 0) { + cifs_dbg(FYI, "Socket\n"); + fattr->cf_mode |= S_IFSOCK; + fattr->cf_dtype = DT_SOCK; + if (bytes_read == 24) { + /* we have enough to decode dev num */ + __u64 mjr; /* major */ + __u64 mnr; /* minor */ + mjr = le64_to_cpu(*(__le64 *)(pbuf+8)); mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); fattr->cf_rdev = MKDEV(mjr, mnr); diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index 4ce6c3121a7e..477d594c2fc3 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -4997,6 +4997,11 @@ static int __cifs_sfu_make_node(unsigned int xid, struct inode *inode, pdev.major = cpu_to_le64(MAJOR(dev)); pdev.minor = cpu_to_le64(MINOR(dev)); break; + case S_IFSOCK: + strscpy(pdev.type, "LnxSOCK"); + pdev.major = cpu_to_le64(MAJOR(dev)); + pdev.minor = cpu_to_le64(MINOR(dev)); + break; case S_IFIFO: strscpy(pdev.type, "LnxFIFO"); break; -- 2.43.0