From patchwork Sun Oct 3 04:31:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Namjae Jeon X-Patchwork-Id: 12532513 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0A36C433EF for ; Sun, 3 Oct 2021 04:31:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6BAC361AE0 for ; Sun, 3 Oct 2021 04:31:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229484AbhJCEdE (ORCPT ); Sun, 3 Oct 2021 00:33:04 -0400 Received: from mail-pf1-f181.google.com ([209.85.210.181]:40560 "EHLO mail-pf1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbhJCEdD (ORCPT ); Sun, 3 Oct 2021 00:33:03 -0400 Received: by mail-pf1-f181.google.com with SMTP id y8so11561487pfa.7 for ; Sat, 02 Oct 2021 21:31:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aqG+PiBsuD9YBGcDWEmbTTjraYxy41A8XoG9qAESQB8=; b=OPKNyJ5pFGx0j3OpXviB4VKKOJjIj4SD+jz4pv4Ofms7Xjxlwt/LSed7m7jfG1Rg/E /msIQ05WeH4PymmcwgammSrCr49AwmNDjcx8rtqUpvlEiuscgF9T/17QCHjqhBbdyRcZ J+lkgkdOP/l4x8S1RRHKWoAPohk0xoTxzvxQpbsracBVefwSi3LdxF86wC6CUF1+i/zi dj2sHJduDTnUGPUkw+zPxFwGeyMj8tuPXCO/5cK9RzQlJ0+otMDwNfmSrgxLM8HS4XDF u7RDjPXCjpypBwfdgad56kXizWyiEz4Aq5wnm476pHzIkJnDAXF1ovnJH7uZElUfrmDJ Sa+Q== X-Gm-Message-State: AOAM5302E35j2VJ/ltBLa8yrA5o4luwQS0tPJ0tdBEm6oi41yaTB//zs PdechxOfg85Kk71e6EoLDQMi96/8oQfwyQ== X-Google-Smtp-Source: ABdhPJwcs8r71dB8af5l7bguDSaPN7ZFMdnUpuuMSRBExoC7qq54+lxUkJyS56F2c//Fd1Jq05aWJg== X-Received: by 2002:a65:47cd:: with SMTP id f13mr5394246pgs.439.1633235476842; Sat, 02 Oct 2021 21:31:16 -0700 (PDT) Received: from localhost.localdomain ([61.74.27.164]) by smtp.gmail.com with ESMTPSA id w136sm3845782pfc.50.2021.10.02.21.31.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 21:31:16 -0700 (PDT) From: Namjae Jeon To: linux-cifs@vger.kernel.org Cc: Namjae Jeon , Tom Talpey , Ronnie Sahlberg , =?utf-8?q?Ralph_B=C3=B6hme?= , Steve French , Sergey Senozhatsky , Hyunchul Lee Subject: [PATCH 1/3] ksmbd: use buf_data_size instead of recalculation in smb3_decrypt_req() Date: Sun, 3 Oct 2021 13:31:03 +0900 Message-Id: <20211003043105.10453-1-linkinjeon@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Tom suggested to use buf_data_size that is already calculated, to verify these offsets. Cc: Tom Talpey Cc: Ronnie Sahlberg Cc: Ralph Böhme Cc: Steve French Cc: Sergey Senozhatsky Cc: Hyunchul Lee Suggested-by: Tom Talpey Signed-off-by: Namjae Jeon --- fs/ksmbd/smb2pdu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index b06361313889..4d1be224dd8e 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -8457,15 +8457,13 @@ int smb3_decrypt_req(struct ksmbd_work *work) struct smb2_transform_hdr *tr_hdr = (struct smb2_transform_hdr *)buf; int rc = 0; - if (pdu_length + 4 < - sizeof(struct smb2_transform_hdr) + sizeof(struct smb2_hdr)) { + if (buf_data_size < sizeof(struct smb2_hdr)) { pr_err("Transform message is too small (%u)\n", pdu_length); return -ECONNABORTED; } - if (pdu_length + 4 < - le32_to_cpu(tr_hdr->OriginalMessageSize) + sizeof(struct smb2_transform_hdr)) { + if (buf_data_size < le32_to_cpu(tr_hdr->OriginalMessageSize)) { pr_err("Transform message is broken\n"); return -ECONNABORTED; } From patchwork Sun Oct 3 04:31:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Namjae Jeon X-Patchwork-Id: 12532515 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82B21C433F5 for ; Sun, 3 Oct 2021 04:31:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60B9661222 for ; Sun, 3 Oct 2021 04:31:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229514AbhJCEdH (ORCPT ); Sun, 3 Oct 2021 00:33:07 -0400 Received: from mail-pg1-f175.google.com ([209.85.215.175]:38553 "EHLO mail-pg1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbhJCEdG (ORCPT ); Sun, 3 Oct 2021 00:33:06 -0400 Received: by mail-pg1-f175.google.com with SMTP id s75so2477047pgs.5 for ; Sat, 02 Oct 2021 21:31:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oiGPYO//uQR+2WZggUlZIn+39GD8bQ9leIyENDjGmwQ=; b=bCJ7NFOty+X+3CfxwjRGUSrNa+t2EZC6UrkqabZ6xGf/K2C3ECD8LwWwM89brav6ox tAIXNsf4HHh8H8AqVqY4rCeqXuV26+LPYdZUSlFCz4iL6SFuSxAQugUz7s0GTyW5NLC6 YJ4yXsm+EiEf1LRelv+zA5RaUmoCddg2V2nvLw5GkX7p2DAnscr2/X4fq9mFuu/5embg TJhu6WjkFPhfSvoxO1FHjbgyxFEXUg+G0aV/GfgSPQxHjHe/BpXLBYaOho6ZMOSEBNjD y5rwFjL0AOXWuIdABaUVE/JOWlUN0vQQmziRJaYImLPpfMXUHEwnETV6HdfwNnsdhVw1 C6dw== X-Gm-Message-State: AOAM531iLBxESl+um/MCDVp9RB3d2JALc65U2mXJCPB9zsCrfM7ditSu yKjCX6c+TQyjJTr1xYFZ97uuDlsnZwWypA== X-Google-Smtp-Source: ABdhPJxzLkJvzEQ5lWnTunt35tpgIqKEgeJwWhFDGdPTdWWwL3b1uBZLuAFTMx5WX8SWVTinUmmYCg== X-Received: by 2002:aa7:96ab:0:b0:43d:f9e0:10bf with SMTP id g11-20020aa796ab000000b0043df9e010bfmr18203002pfk.32.1633235479885; Sat, 02 Oct 2021 21:31:19 -0700 (PDT) Received: from localhost.localdomain ([61.74.27.164]) by smtp.gmail.com with ESMTPSA id w136sm3845782pfc.50.2021.10.02.21.31.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 21:31:19 -0700 (PDT) From: Namjae Jeon To: linux-cifs@vger.kernel.org Cc: Namjae Jeon , Tom Talpey , Ronnie Sahlberg , =?utf-8?q?Ralph_B=C3=B6hme?= , Steve French , Sergey Senozhatsky , Hyunchul Lee Subject: [PATCH 2/3] ksmbd: fix version mismatch with out of tree Date: Sun, 3 Oct 2021 13:31:04 +0900 Message-Id: <20211003043105.10453-2-linkinjeon@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211003043105.10453-1-linkinjeon@kernel.org> References: <20211003043105.10453-1-linkinjeon@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Fix version mismatch with out of tree, This updated version will be matched with ksmbd-tools. Cc: Tom Talpey Cc: Ronnie Sahlberg Cc: Ralph Böhme Cc: Steve French Cc: Sergey Senozhatsky Cc: Hyunchul Lee Signed-off-by: Namjae Jeon --- fs/ksmbd/glob.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ksmbd/glob.h b/fs/ksmbd/glob.h index 49a5a3afa118..5b8f3e0ebdb3 100644 --- a/fs/ksmbd/glob.h +++ b/fs/ksmbd/glob.h @@ -12,7 +12,7 @@ #include "unicode.h" #include "vfs_cache.h" -#define KSMBD_VERSION "3.1.9" +#define KSMBD_VERSION "3.4.2" extern int ksmbd_debug_types; From patchwork Sun Oct 3 04:31:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Namjae Jeon X-Patchwork-Id: 12532517 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0F7BC433EF for ; Sun, 3 Oct 2021 04:31:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF3E761222 for ; Sun, 3 Oct 2021 04:31:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229534AbhJCEdK (ORCPT ); Sun, 3 Oct 2021 00:33:10 -0400 Received: from mail-pj1-f41.google.com ([209.85.216.41]:41739 "EHLO mail-pj1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbhJCEdK (ORCPT ); Sun, 3 Oct 2021 00:33:10 -0400 Received: by mail-pj1-f41.google.com with SMTP id na16-20020a17090b4c1000b0019f5bb661f9so6037352pjb.0 for ; Sat, 02 Oct 2021 21:31:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PtZutAXRGIMTfkqIUlW3Wat8+E4VPcoyA+Ain2jDqR8=; b=56rt3pif0bNIslofvPRcEb20GWHk1KafmjJW6st2dIcgNRuip3I0WHqZWWdWbD0Xdf oM7rSa4M2pMIR56jt1aIEVSNbpqEi0PW1K1193zr1q/AFeBN3/qpsXNNdRkyeqWq2Mmn GDhktjwdulFTs2TGS3+5WVii9C3eFT/lze5W3wyAJFzUyt7vjCS7KrcZNuF9U9hVnTtx aA/tv40ftOuL1Nzx68iPDcRsWofnk5eyOybkBEzjJadCFcrhu+3aIHlLjox60iEi210Z DBr6Y5q5EMv8/8DohvCcyjkurX2DtajwdrQWNimNC+pNFF1lJtiFuAC0lP2EOerNIgs8 KI9A== X-Gm-Message-State: AOAM531rWVE/VRNQZx8EG691ie0xom4EFGi6zvg17V28uWlY5J6x7PW3 oQQGN6Tlj/xqEhbue1Z70dC/45j1U0Wf3w== X-Google-Smtp-Source: ABdhPJy056NHxlFhM4tWJasB9pYt/IAAjtPoE2RZMb0Oi2p99d5MgrCDvJSd7pEPZC8E7AKbFNsMXg== X-Received: by 2002:a17:90a:46c1:: with SMTP id x1mr29938402pjg.174.1633235483142; Sat, 02 Oct 2021 21:31:23 -0700 (PDT) Received: from localhost.localdomain ([61.74.27.164]) by smtp.gmail.com with ESMTPSA id w136sm3845782pfc.50.2021.10.02.21.31.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 21:31:22 -0700 (PDT) From: Namjae Jeon To: linux-cifs@vger.kernel.org Cc: Namjae Jeon , Tom Talpey , Ronnie Sahlberg , =?utf-8?q?Ralph_B=C3=B6hme?= , Steve French , Sergey Senozhatsky , Hyunchul Lee , Marios Makassikis Subject: [PATCH 3/3] ksmbd: fix oops from fuse driver Date: Sun, 3 Oct 2021 13:31:05 +0900 Message-Id: <20211003043105.10453-3-linkinjeon@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211003043105.10453-1-linkinjeon@kernel.org> References: <20211003043105.10453-1-linkinjeon@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Marios reported kernel oops from fuse driver when ksmbd call mark_inode_dirty(). This patch directly update ->i_ctime after removing mark_inode_ditry() and notify_change will put inode to dirty list. Cc: Tom Talpey Cc: Ronnie Sahlberg Cc: Ralph Böhme Cc: Steve French Cc: Sergey Senozhatsky Cc: Hyunchul Lee Reported-by: Marios Makassikis Tested-by: Marios Makassikis Signed-off-by: Namjae Jeon Acked-by: Hyunchul Lee --- fs/ksmbd/smb2pdu.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index 4d1be224dd8e..ed8324f9c2bd 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -5483,7 +5483,6 @@ static int set_file_basic_info(struct ksmbd_file *fp, struct ksmbd_share_config *share) { struct iattr attrs; - struct timespec64 ctime; struct file *filp; struct inode *inode; struct user_namespace *user_ns; @@ -5505,13 +5504,11 @@ static int set_file_basic_info(struct ksmbd_file *fp, attrs.ia_valid |= (ATTR_ATIME | ATTR_ATIME_SET); } - if (file_info->ChangeTime) { + attrs.ia_valid |= ATTR_CTIME; + if (file_info->ChangeTime) attrs.ia_ctime = ksmbd_NTtimeToUnix(file_info->ChangeTime); - ctime = attrs.ia_ctime; - attrs.ia_valid |= ATTR_CTIME; - } else { - ctime = inode->i_ctime; - } + else + attrs.ia_ctime = inode->i_ctime; if (file_info->LastWriteTime) { attrs.ia_mtime = ksmbd_NTtimeToUnix(file_info->LastWriteTime); @@ -5557,11 +5554,9 @@ static int set_file_basic_info(struct ksmbd_file *fp, return -EACCES; inode_lock(inode); + inode->i_ctime = attrs.ia_ctime; + attrs.ia_valid &= ~ATTR_CTIME; rc = notify_change(user_ns, dentry, &attrs, NULL); - if (!rc) { - inode->i_ctime = ctime; - mark_inode_dirty(inode); - } inode_unlock(inode); } return rc;