From: David Miller Subject: Re: [PATCH net] tls: Correct length of scatterlist in tls_sw_sendpage Date: Mon, 22 Jan 2018 16:27:02 -0500 (EST) Message-ID: <20180122.162702.159233205962084742.davem@davemloft.net> References: <20180119203013.GA66428@AM-iPhone.dhcp.thefacebook.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, ilyal@mellanox.com, borisp@mellanox.com, aviadye@mellanox.com To: davejwatson@fb.com Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:41490 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751149AbeAVV1E (ORCPT ); Mon, 22 Jan 2018 16:27:04 -0500 In-Reply-To: <20180119203013.GA66428@AM-iPhone.dhcp.thefacebook.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Dave Watson Date: Fri, 19 Jan 2018 12:30:13 -0800 > The scatterlist is reused by both sendmsg and sendfile. > If a sendmsg of smaller number of pages is followed by a sendfile > of larger number of pages, the scatterlist may be too short, resulting > in a crash in gcm_encrypt. > > Add sg_unmark_end to make the list the correct length. > > tls_sw_sendmsg already calls sg_unmark_end correctly when it allocates > memory in alloc_sg, or in zerocopy_from_iter. > > Signed-off-by: Dave Watson Applied, thanks Dave.