From patchwork Fri Jun 16 10:37:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Prasad N X-Patchwork-Id: 13282608 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 95E1CEB64D7 for ; Fri, 16 Jun 2023 10:46:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345215AbjFPKqh (ORCPT ); Fri, 16 Jun 2023 06:46:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345248AbjFPKqU (ORCPT ); Fri, 16 Jun 2023 06:46:20 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76A4F22B8B for ; Fri, 16 Jun 2023 03:38:44 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1b51488ad67so3700105ad.3 for ; Fri, 16 Jun 2023 03:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686911875; x=1689503875; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9Jg0fIqgRm3Hj6aRZQCO4c4zMC4DQ1b32OPEHruanOY=; b=dHhOaY74dUH3AiQIALun69hBIQFDRaMDql9hB3nrmIcFrqEpEAsM+aVeuSOxJIA9qS e96ryxF60T6no83/MpVzbT6BSDRR/OM818ccaRUrzL0F4speDcWh2fVkIWVkDS6uTSz/ QFBFxkSKIJpveBppY6yjXUK4tp/g2HmC+63bUOze4fU/Wa/UR1eI4vIFPqdZoix0L7Mu BDd7zv7KeTK/DkkG3vS11SzXEnTXYMw8zXRvEWVTgQI8aAhEBNEl7GAthRM+ir7TUWg1 xsg6A4gjTtEG52Ip3ptGb/gmx8k0EjLE1tqFABWqgoqMM26fJe6IXdmEb8vcsvhXVZsF 16zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686911875; x=1689503875; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9Jg0fIqgRm3Hj6aRZQCO4c4zMC4DQ1b32OPEHruanOY=; b=a5Iaom62IcxyRh8sjfySNIGlbtsyRkXoQIowEPTz/mxtV0AICxLkcbG6WBk9M2/Zvi cogvDAqwM75iu1fBxBFO6HEfV503SEmqIuqxl/K+ftsEZERUuEIljn1hqPNncuMgt9B+ Mb8i3wb9/o34bJIzLuwiKLwcqy8Aga4DcQIIq3llYrmzQQ8nFcww6LgBZR9J0XSZWBSe vCaz6x+yx6JPyf/8JqlsTzG0aOJVoXubGvTydgxtcFJjalRtSHF3TaIpCYwJGStR5h0k MbAz69xuxkstoxvRyJGjVRwZB/QfUpfcZL8VFU25rpdB9aCx+k+zRn9sVEy1KVkBqXp7 MZmQ== X-Gm-Message-State: AC+VfDx0Id7GYWfM0o8FiS2QPfS8gmnFpSo4zd7YpF6+Beh/p+ljGLV8 2PAephJyKiAAG9kmVq8/il3Q1F/ZVaTHhg== X-Google-Smtp-Source: ACHHUZ7yrh4MBzpIQ3jAhRZaICPc1tkK+oIKP15zJyMBQDpyhVLN98h6hdZvt49E948aF0QIXyhccA== X-Received: by 2002:a17:903:2348:b0:1ac:921c:87fc with SMTP id c8-20020a170903234800b001ac921c87fcmr1406792plh.32.1686911875165; Fri, 16 Jun 2023 03:37:55 -0700 (PDT) Received: from lindev-local-latest.corp.microsoft.com ([2404:f801:8028:1:7e0e:5dff:fea8:2c14]) by smtp.gmail.com with ESMTPSA id t15-20020a1709027fcf00b001b3d4d74749sm8958129plb.7.2023.06.16.03.37.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 03:37:54 -0700 (PDT) From: Shyam Prasad N X-Google-Original-From: Shyam Prasad N To: linux-cifs@vger.kernel.org, smfrench@gmail.com, bharathsm.hsk@gmail.com, pc@cjr.nz, ematsumiya@suse.de Cc: Shyam Prasad N Subject: [PATCH 1/2] cifs: print nosharesock value while dumping mount options Date: Fri, 16 Jun 2023 10:37:45 +0000 Message-Id: <20230616103746.87142-1-sprasad@microsoft.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org We print most other mount options for a mount when dumping the mount entries. But miss out the nosharesock value. This change will print that in addition to the other options. Signed-off-by: Shyam Prasad N --- fs/smb/client/cifsfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c index 43a4d8603db3..86ac620a9615 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -688,6 +688,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) seq_puts(s, ",noautotune"); if (tcon->ses->server->noblocksnd) seq_puts(s, ",noblocksend"); + if (tcon->ses->server->nosharesock) + seq_puts(s, ",nosharesock"); if (tcon->snapshot_time) seq_printf(s, ",snapshot=%llu", tcon->snapshot_time); From patchwork Fri Jun 16 10:37:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Prasad N X-Patchwork-Id: 13282609 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 DF42DEB64D8 for ; Fri, 16 Jun 2023 10:46:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345163AbjFPKqw (ORCPT ); Fri, 16 Jun 2023 06:46:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345498AbjFPKqi (ORCPT ); Fri, 16 Jun 2023 06:46:38 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C5C2137C6 for ; Fri, 16 Jun 2023 03:39:07 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-666ac5b63beso530348b3a.0 for ; Fri, 16 Jun 2023 03:39:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686911878; x=1689503878; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xFwRTsPx/fKZbFo0BvjGltjWzdgasTKdpCqJRJ0WPj0=; b=mJ6WYi9vc5Ay5y2+jOvcVnRk2wj7I0EkLiVaUUgoWT5+9ePiPszouTnSIRdMu5iThU +gbDbrsQCn00CAWVz3FYpOE+YVYUQX0saWClAYNMMpNWWd67B2puYdlyRwbFDrRak9np QAjVAy5L+E4pgatBVQFtOPt9XZYE3WSGrQmpa/0b81a2/GNMyf60PgfLFxdrTM0bQ+sF BxVA/OrKbN2niR5Q3Sn6L2z7yPE3iHblfghgXsWJAe0JqC6YMtKI7AY+d6LcQmgysOdi /zdxv+HxPRNFF3Ehx06tFGt0HnoiEAUwLC3HYe2dyudRZRhr5DinWOUlcoUVEFofOIKY ZkPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686911878; x=1689503878; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xFwRTsPx/fKZbFo0BvjGltjWzdgasTKdpCqJRJ0WPj0=; b=U/a67L1zaGlKMLK/f1nb7JPu6a/ZXwLUc+j1cyhEzo0VpnPhwHSAZ8gIwQf179MTgg 8Z7KhmBfmCZV26tTEGDP214pGxTRc7+4cz5Q2VqmtGETFw6/v0mK+EP7tt8M8ldtdZuH EsSrORiqT3GyAaA2zlnyTT/4fDBFxVQCECN5DDisZJlZOgbje+gCs+qfktBNch2Txehy +Mia+kogzCDnAj9QTB4/q/lLPI0Sqws4HjS9e5Zzhg3wUUznx12V+8LnPnbNA6hmK0Hm TdU6vH/liEq2adttDvO0WaBIwixOr3adqkeZtFpeMzWcPMzlbXLn53vR2rf8oh3rtE7C VXsg== X-Gm-Message-State: AC+VfDyORbN1ZJBReYVY+Wq3/DQ8u3TB7Jh8RC/bSR2utqkmfXBd4bVl k4PdKcofqwq6dQa7k+P3fxcyLaCzQM64Mg== X-Google-Smtp-Source: ACHHUZ6ViQxKpq45qUZMbwZ54yAcbcv8iKQjHuwpbC7UUcyH4jGJCOm69+4YQX3nENfOvw29UBrAKA== X-Received: by 2002:a05:6a20:9381:b0:119:fffb:e37f with SMTP id x1-20020a056a20938100b00119fffbe37fmr2200972pzh.10.1686911878143; Fri, 16 Jun 2023 03:37:58 -0700 (PDT) Received: from lindev-local-latest.corp.microsoft.com ([2404:f801:8028:1:7e0e:5dff:fea8:2c14]) by smtp.gmail.com with ESMTPSA id t15-20020a1709027fcf00b001b3d4d74749sm8958129plb.7.2023.06.16.03.37.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 03:37:57 -0700 (PDT) From: Shyam Prasad N X-Google-Original-From: Shyam Prasad N To: linux-cifs@vger.kernel.org, smfrench@gmail.com, bharathsm.hsk@gmail.com, pc@cjr.nz, ematsumiya@suse.de Cc: Shyam Prasad N Subject: [PATCH 2/2] cifs: allow dumping keys for directories too Date: Fri, 16 Jun 2023 10:37:46 +0000 Message-Id: <20230616103746.87142-2-sprasad@microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616103746.87142-1-sprasad@microsoft.com> References: <20230616103746.87142-1-sprasad@microsoft.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Dumping the enc/dec keys is a session wide operation. And it should not matter if the ioctl was run on a regular file or a directory. Currently, we obtain the tcon pointer from the cifs file handle. But since there's no dir open call in cifs, this is not populated for dirs. This change allows dumping of session keys using ioctl even for directories. To do this, we'll now get the tcon pointer from the superblock, and not from the file handle. Signed-off-by: Shyam Prasad N --- fs/smb/client/ioctl.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/fs/smb/client/ioctl.c b/fs/smb/client/ioctl.c index fff092bbc7a3..e1904b86ed96 100644 --- a/fs/smb/client/ioctl.c +++ b/fs/smb/client/ioctl.c @@ -433,16 +433,21 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) * Dump encryption keys. This is an old ioctl that only * handles AES-128-{CCM,GCM}. */ - if (pSMBFile == NULL) - break; if (!capable(CAP_SYS_ADMIN)) { rc = -EACCES; break; } - tcon = tlink_tcon(pSMBFile->tlink); + cifs_sb = CIFS_SB(inode->i_sb); + tlink = cifs_sb_tlink(cifs_sb); + if (IS_ERR(tlink)) { + rc = PTR_ERR(tlink); + break; + } + tcon = tlink_tcon(tlink); if (!smb3_encryption_required(tcon)) { rc = -EOPNOTSUPP; + cifs_put_tlink(tlink); break; } pkey_inf.cipher_type = @@ -459,6 +464,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) rc = -EFAULT; else rc = 0; + cifs_put_tlink(tlink); break; case CIFS_DUMP_FULL_KEY: /* @@ -470,8 +476,11 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) rc = -EACCES; break; } - tcon = tlink_tcon(pSMBFile->tlink); + cifs_sb = CIFS_SB(inode->i_sb); + tlink = cifs_sb_tlink(cifs_sb); + tcon = tlink_tcon(tlink); rc = cifs_dump_full_key(tcon, (void __user *)arg); + cifs_put_tlink(tlink); break; case CIFS_IOC_NOTIFY: if (!S_ISDIR(inode->i_mode)) {