Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3546422ybb; Mon, 6 Apr 2020 10:47:03 -0700 (PDT) X-Google-Smtp-Source: APiQypJti7KmyUBE21HA5EegKxY3x6dIYXWF3cIBfcFJU8aOIF3atXPqfMmomfzlfMpgFsm7pHws X-Received: by 2002:a9d:949:: with SMTP id 67mr18298748otp.304.1586195223023; Mon, 06 Apr 2020 10:47:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586195223; cv=none; d=google.com; s=arc-20160816; b=tkfAF5JYVQM3UbfPzvzqDtsfQ88VXT3NnaMj0wLqgMncuuPEXOrH+ru7gWiLWi/uMr /jBxc36OVOJt48X4YzMBrrkLM6wuegy0PNYEM+DG0UCoInRQXvqUH31LpGdRQVgVdeF4 0kjm/PsBkkwnxOsiWC3wdm4daKzLpNc3cYIKsbew+PDlY2nZqPubIgOeX57W6WmRK4zO WZRm6mw/4TTDJ2BdTzwLri+hEU0dmwwPhurGph2zn3DkPcJasP/D0PakBeAtCdLpO6x0 AozsnOW3uKLiGij42xLQLdsZLT3QtfUkEevEZXvyx50oOPapy4l5QtTnRNLeNV0YMLr8 esUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from; bh=BRyMCJPIrJsjXIixHshxb+9RLwUOT3FLENTi6EpVnco=; b=i5ArQogJwdRAtsjrysq2zKiLv93PLwACTCAY2F0sVySxmWqKTuz5dsofIJ27tOXBXA y0si0tSz3iqq4bV8Kuhg8O18R6c33CK72QDOTL+Eim39n1GzAWQPvUvlEl4Ei/+CzZrV ZrinP5aC9h+txlYOs7rA5PeZLPGqqqeodPreGMHEWCO3kYQe3X7KCtYtu3WtynusVPpe cFoc73oo45xw1JKveiaPApxNgLKib8/D8G15YRTuMdNy81ACxMJwagwQszByxXf/ZFkW 9BjzDiGp5quVn3zX8aqFuwkAh9Qt3SA5WJiAYLt6ZQRInB06VvGSCxDL5mnrRPF28iju 34mA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si62682oie.2.2020.04.06.10.46.51; Mon, 06 Apr 2020 10:47:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729683AbgDFR1r convert rfc822-to-8bit (ORCPT + 99 others); Mon, 6 Apr 2020 13:27:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:49206 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726536AbgDFR1q (ORCPT ); Mon, 6 Apr 2020 13:27:46 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 93A78BE46; Mon, 6 Apr 2020 17:27:43 +0000 (UTC) From: =?utf-8?Q?Aur=C3=A9lien?= Aptel To: Pavel Shilovsky , Long Li Cc: Steve French , linux-cifs , samba-technical , Kernel Mailing List Subject: Re: [PATCH] cifs: Allocate crypto structures on the fly for calculating signatures of incoming packets In-Reply-To: References: <1585696903-96794-1-git-send-email-longli@linuxonhyperv.com> Date: Mon, 06 Apr 2020 15:05:55 +0200 Message-ID: <87h7xwn4r0.fsf@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pavel Shilovsky writes: > + Aurelien > > Ok, before negotiate tcpStatus is not CifsGood, so, the allocation > won't be skipped. I think this function should be no-op for all > protocols except SMB 3.1.1 to reflect the meaning. Other protocols > don't use preauth hash anyway. > > @Aurelien, @everybody, what would be your thoughts about moving > protocol version check from IF block to the top of the function thus > skipping to allocate preauth hash for protocols that don't need it? In > this case Long's patch will require a change to keep > smb2_crypto_shash_allocate() and its invocation. Sounds good. I think we could go even further and do preauth crypto alloc/dealloc all in the preauth hash compute function too and remove the pointers from the server struct (except for the byte array with the hash result). It only runs during negprot+session establishement which is not a hot path at all and would keep the memory model simpler. Cheers, -- Aurélien Aptel / SUSE Labs Samba Team GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)