From patchwork Fri Apr 28 05:24:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1774755 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) 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=20221208 header.b=cgn2Lfzu; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4Q71Jm62Nwz23v6 for ; Fri, 28 Apr 2023 15:25:12 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345280AbjD1FZJ (ORCPT ); Fri, 28 Apr 2023 01:25:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229970AbjD1FZJ (ORCPT ); Fri, 28 Apr 2023 01:25:09 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F23D11BFA for ; Thu, 27 Apr 2023 22:25:07 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4efe8991b8aso8017603e87.0 for ; Thu, 27 Apr 2023 22:25:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682659506; x=1685251506; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=+Pkw4IIS78xGsVo76jiygiHP0EH2VxbAPcuA/FeQLmI=; b=cgn2LfzuIBiXmx8G2HQwmiuzfVDVfmF27zqONYkhDSa0Hm8emzF/FVaEGOicc13dqb HciTptyilMsL7yU3VQL8QUy/97jM2u/skblIAsIocy7TH3MGnAQtSFpV6wgrWDagyKDg sLWCctEe/SCat72r/ZuQa7SdhEAXel7REiF8gBVcuWOt/kbIZZgpx7B9GEj428yVYRiH TDmA9Xd1ilaVGBuPvSK6jS8lfAtM/Pi7MO8cbBPcmRcZm0Es3RyfA1hO4QoYSP7Pxxg3 C0wI7ZANJnKs8cDtloa3JZGJ6vaj1jL+K4i3wq4xkMQvZDTen1QofIta0JkrwYA9p4P+ gzkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682659506; x=1685251506; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+Pkw4IIS78xGsVo76jiygiHP0EH2VxbAPcuA/FeQLmI=; b=ZjRhpmxSxbllV1TVi9a44evXI+MucbEA806oypzyn+PyB0sONx72g6accMCeIxGnxI fw+8bonk8QilwOixY9fCblwYdHt22l3aRod5cRhcILNKYTHqA/i3dHZISG5KxC9YUPRu uv7TKVCZm9SMNhYE4VUGu839n/5bwtG1KybmfZAvSB3OqJID0UWKTcAVuMrW3UhqKvN8 JLwMqUeEr1IISQI8QslHq2YT/cnBptFTumvYPi/jq8a4Bm1R/bYwrpmhCJ0tpq9ABAqy kMq87vMNeJmTlZzzIwaqcECwnBr5N6ZgPEYteUIgxfYly6LVXdYWQZaVYtUts0aUl0oX 4LSg== X-Gm-Message-State: AC+VfDxtIqhYZRwMZv9AwWf4zqtCe+GC6v0hk7aYHysgc1ddIdqeigg5 uY4k3/Q87+w2zrMFm/5W4TWkco5THhWEPo9o2Aj7DAyoI8o= X-Google-Smtp-Source: ACHHUZ42la2VKSeTdIlt8+Ln2GmX7pdcn3vz2KWrDCou3L5XbRBEuJw9/sy2ph1Xbwk4hgVupbQMecwZAXJ+O2WDA34= X-Received: by 2002:ac2:4c10:0:b0:4e9:5f8e:315a with SMTP id t16-20020ac24c10000000b004e95f8e315amr1131260lfq.65.1682659505576; Thu, 27 Apr 2023 22:25:05 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Fri, 28 Apr 2023 00:24:54 -0500 Message-ID: Subject: [PATCH][CIFS] fix incorrect size for query_on_disk_id To: CIFS Cc: Namjae Jeon X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org We were assuming the wrong size for the struct, use the ksmbd version of this struct and move it to common code. Acked-by: Namjae Jeon From b1e5a95a07cdcc755a00ee0c3fc9187b77109c1f Mon Sep 17 00:00:00 2001 From: Steve French Date: Fri, 28 Apr 2023 00:21:10 -0500 Subject: [PATCH] smb3: fix incorrect size for query_on_disk_id open context We were assuming the wrong size for the struct, use the ksmbd version of this struct and move it to common code. Signed-off-by: Steve French --- fs/cifs/smb2pdu.c | 2 +- fs/ksmbd/smb2pdu.h | 8 -------- fs/smbfs_common/smb2pdu.h | 11 +++++++++++ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 281e0b12658d..0521aa1da644 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2063,7 +2063,7 @@ create_reconnect_durable_buf(struct cifs_fid *fid) static void parse_query_id_ctxt(struct create_context *cc, struct smb2_file_all_info *buf) { - struct create_on_disk_id *pdisk_id = (struct create_on_disk_id *)cc; + struct create_disk_id_rsp *pdisk_id = (struct create_disk_id_rsp *)cc; cifs_dbg(FYI, "parse query id context 0x%llx 0x%llx\n", pdisk_id->DiskFileId, pdisk_id->VolumeId); diff --git a/fs/ksmbd/smb2pdu.h b/fs/ksmbd/smb2pdu.h index 9420dd2813fb..bcf71fd4dc1e 100644 --- a/fs/ksmbd/smb2pdu.h +++ b/fs/ksmbd/smb2pdu.h @@ -144,14 +144,6 @@ struct create_mxac_rsp { __le32 MaximalAccess; } __packed; -struct create_disk_id_rsp { - struct create_context ccontext; - __u8 Name[8]; - __le64 DiskFileId; - __le64 VolumeId; - __u8 Reserved[16]; -} __packed; - /* equivalent of the contents of SMB3.1.1 POSIX open context response */ struct create_posix_rsp { struct create_context ccontext; diff --git a/fs/smbfs_common/smb2pdu.h b/fs/smbfs_common/smb2pdu.h index ace133cf6072..eab801ee5cf3 100644 --- a/fs/smbfs_common/smb2pdu.h +++ b/fs/smbfs_common/smb2pdu.h @@ -1180,6 +1180,7 @@ struct create_posix { #define SMB2_LEASE_KEY_SIZE 16 +/* See MS-SMB2 2.2.13.2.8 */ struct lease_context { __u8 LeaseKey[SMB2_LEASE_KEY_SIZE]; __le32 LeaseState; @@ -1187,6 +1188,7 @@ struct lease_context { __le64 LeaseDuration; } __packed; +/* See MS-SMB2 2.2.13.2.10 */ struct lease_context_v2 { __u8 LeaseKey[SMB2_LEASE_KEY_SIZE]; __le32 LeaseState; @@ -1210,6 +1212,15 @@ struct create_lease_v2 { __u8 Pad[4]; } __packed; +/* See MS-SMB2 2.2.14.2.9 */ +struct create_disk_id_rsp { + struct create_context ccontext; + __u8 Name[8]; + __le64 DiskFileId; + __le64 VolumeId; + __u8 Reserved[16]; +} __packed; + /* See MS-SMB2 2.2.31 and 2.2.32 */ struct smb2_ioctl_req { struct smb2_hdr hdr; -- 2.34.1