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=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 A4B8BC43381 for ; Mon, 25 Feb 2019 05:59:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 722A620842 for ; Mon, 25 Feb 2019 05:59:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726528AbfBYF7G (ORCPT ); Mon, 25 Feb 2019 00:59:06 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:35550 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725912AbfBYF7G (ORCPT ); Mon, 25 Feb 2019 00:59:06 -0500 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::bf5]) (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 637E514DF2233; Sun, 24 Feb 2019 21:59:05 -0800 (PST) Date: Sun, 24 Feb 2019 21:59:04 -0800 (PST) Message-Id: <20190224.215904.2270271071160812988.davem@davemloft.net> To: vakul.garg@nxp.com Cc: netdev@vger.kernel.org, borisp@mellanox.com, aviadye@mellanox.com, davejwatson@fb.com, doronrk@fb.com Subject: Re: [PATCHv3 net-next] tls: Return type of non-data records retrieved using MSG_PEEK in recvmsg From: David Miller In-Reply-To: <20190223084010.17021-1-vakul.garg@nxp.com> References: <20190223084010.17021-1-vakul.garg@nxp.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]); Sun, 24 Feb 2019 21:59:05 -0800 (PST) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vakul Garg Date: Sat, 23 Feb 2019 08:42:37 +0000 > The patch enables returning 'type' in msghdr for records that are > retrieved with MSG_PEEK in recvmsg. Further it prevents records peeked > from socket from getting clubbed with any other record of different > type when records are subsequently dequeued from strparser. > > For each record, we now retain its type in sk_buff's control buffer > cb[]. Inside control buffer, record's full length and offset are already > stored by strparser in 'struct strp_msg'. We store record type after > 'struct strp_msg' inside 'struct tls_msg'. For tls1.2, the type is > stored just after record dequeue. For tls1.3, the type is stored after > record has been decrypted. > > Inside process_rx_list(), before processing a non-data record, we check > that we must be able to return back the record type to the user > application. If not, the decrypted records in tls context's rx_list is > left there without consuming any data. > > Fixes: 692d7b5d1f912 ("tls: Fix recvmsg() to be able to peek across > multiple records") > Signed-off-by: Vakul Garg Applied, but please don't break up long Fixes: lines into multiple lines. Always keep it all on one single line.