From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E37CC5ACC4 for ; Thu, 20 Feb 2020 00:32:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 326CE208C4 for ; Thu, 20 Feb 2020 00:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726962AbgBTAcw (ORCPT ); Wed, 19 Feb 2020 19:32:52 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:49542 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726736AbgBTAcw (ORCPT ); Wed, 19 Feb 2020 19:32:52 -0500 Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 64B0A15BD9500; Wed, 19 Feb 2020 16:32:51 -0800 (PST) Date: Wed, 19 Feb 2020 16:32:50 -0800 (PST) Message-Id: <20200219.163250.1284615020212149795.davem@davemloft.net> To: rohitm@chelsio.com Cc: kuba@kernel.org, netdev@vger.kernel.org, borisp@mellanox.com, aviadye@mellanox.com, john.fastabend@gmail.com, daniel@iogearbox.net, manojmalviya@chelsio.com Subject: Re: [PATCH net v4] net/tls: Fix to avoid gettig invalid tls record From: David Miller In-Reply-To: <20200219041022.22701-1-rohitm@chelsio.com> References: <20200219041022.22701-1-rohitm@chelsio.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 19 Feb 2020 16:32:51 -0800 (PST) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Rohit Maheshwari Date: Wed, 19 Feb 2020 09:40:22 +0530 > Current code doesn't check if tcp sequence number is starting from (/after) > 1st record's start sequnce number. It only checks if seq number is before > 1st record's end sequnce number. This problem will always be a possibility > in re-transmit case. If a record which belongs to a requested seq number is > already deleted, tls_get_record will start looking into list and as per the > check it will look if seq number is before the end seq of 1st record, which > will always be true and will return 1st record always, it should in fact > return NULL. > As part of the fix, start looking each record only if the sequence number > lies in the list else return NULL. > There is one more check added, driver look for the start marker record to > handle tcp packets which are before the tls offload start sequence number, > hence return 1st record if the record is tls start marker and seq number is > before the 1st record's starting sequence number. > > Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure") > Signed-off-by: Rohit Maheshwari Applied and queued up for -stable.