From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net-next, net v2] net/tls: Set count of SG entries if sk_alloc_sg returns -ENOSPC Date: Sun, 09 Sep 2018 08:10:38 -0700 (PDT) Message-ID: <20180909.081038.97647923293099198.davem@davemloft.net> References: <20180906161140.14710-1-vakul.garg@nxp.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, borisp@mellanox.com, aviadye@mellanox.com, davejwatson@fb.com, doronrk@fb.com To: vakul.garg@nxp.com Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:49882 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726560AbeIIUAh (ORCPT ); Sun, 9 Sep 2018 16:00:37 -0400 In-Reply-To: <20180906161140.14710-1-vakul.garg@nxp.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Vakul Garg Date: Thu, 6 Sep 2018 21:41:40 +0530 > tls_sw_sendmsg() allocates plaintext and encrypted SG entries using > function sk_alloc_sg(). In case the number of SG entries hit > MAX_SKB_FRAGS, sk_alloc_sg() returns -ENOSPC and sets the variable for > current SG index to '0'. This leads to calling of function > tls_push_record() with 'sg_encrypted_num_elem = 0' and later causes > kernel crash. To fix this, set the number of SG elements to the number > of elements in plaintext/encrypted SG arrays in case sk_alloc_sg() > returns -ENOSPC. > > Fixes: 3c4d7559159b ("tls: kernel TLS support") > Signed-off-by: Vakul Garg Applied to 'net' and queued up for -stable.