Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2748263pxj; Mon, 31 May 2021 09:44:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRRJSC2wWtONcd+En2lHakI9/z7lAelMCxYsnhyDSHrTKEcbxaD2EdVYjvuteMp3Mg9o+5 X-Received: by 2002:a17:906:fa93:: with SMTP id lt19mr16258396ejb.54.1622479477547; Mon, 31 May 2021 09:44:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622479477; cv=none; d=google.com; s=arc-20160816; b=N+HmGcCy1yBNGc10ruSkoEeLSqLuXpAXk9ikHCIYpn6f4qJVjCu/xQ+SWMiWcNLLmL u+PCvpgtJ03AOt4ixzKPv9Cz0GRe7FO5JmOrLWPctmssLoXo3ygWd8GknKEwnpVWvRLN nVF10NhyoTHALgjAU6zIBkF6ZLiM4hhe3fQdWf1exUr3VDMbuA6/7POgCerSEOslMu0Q Hy2BdO2mVYI2GkOKSgaSi5PYa0Bs6aBFqfVwbKJSYTvXeA1uazXQW3Z5PI3kPic2GbyL FsLIPSelxqGMTR8uu7g4r373NXDJZiOml+G0QJcAruP5Sa33yd/p4aoO4reyesnCG6T+ 5gQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LK2fm4UY3qi2VoyN/0yTNq68MI+rw0Q2xyo3likLToc=; b=xqRwoVbECsS3apqiFD1fzMlBmLa4i0llwCQGlCSJRS8WlcXlhSQBqpo5OR0ikQNUob X/6jByhs0ye740Dj1yddDriGLR37I3Y4qkkJvYEA9k61qEJWjpaX5n/yp6bkVF8/zV2M 3UdFa1MlRyK1BcCJun6YGIDYjUPEKw9/qNdVnWnk2kEw4RISv3L/xppcEO6Ex7txMB4s D0UlunN0s6jTvT9u5p4xAcmdTiTx6U7Fo+TwECY9UpHQaKmoxwOhIxMYR1vdC61Q8yBM dlc/y+2YswPANeUGO1I7PPL84pOLfVGESw0IO3KuoE31RLj15wWuEm/m8YSGWR6hOEyW k31g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fvUvIM33; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si15014033edw.369.2021.05.31.09.44.15; Mon, 31 May 2021 09:44:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fvUvIM33; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234827AbhEaQou (ORCPT + 99 others); Mon, 31 May 2021 12:44:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:48410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233130AbhEaOxk (ORCPT ); Mon, 31 May 2021 10:53:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 533FC61CAD; Mon, 31 May 2021 13:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469540; bh=3Shp8sSKKLxkGkhTI0C21kKKh1LOq5TbLqI58tEXAGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fvUvIM33yR2tTpmubg3VwmowqVwES3171TSdv1twrdpEQnyE3HXbFd5/qJwgyECjp cqT99K/ppdY7dxhi453mjOXm6UdLnL0XTi8LbAsXQCzL0ixZmmYk29egU7dC36brZW rvpo2azO7VubTW1n1tM2fva9wWc9lpuAqfQI7c0Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "David S. Miller" , Sasha Levin Subject: [PATCH 5.12 236/296] chelsio/chtls: unlock on error in chtls_pt_recvmsg() Date: Mon, 31 May 2021 15:14:51 +0200 Message-Id: <20210531130711.737664546@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 832ce924b1a14e139e184a6da9f5a69a5e47b256 ] This error path needs to release some memory and call release_sock(sk); before returning. Fixes: 6919a8264a32 ("Crypto/chtls: add/delete TLS header in driver") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c index 188d871f6b8c..c320cc8ca68d 100644 --- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c +++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c @@ -1564,8 +1564,10 @@ found_ok_skb: cerr = put_cmsg(msg, SOL_TLS, TLS_GET_RECORD_TYPE, sizeof(thdr->type), &thdr->type); - if (cerr && thdr->type != TLS_RECORD_TYPE_DATA) - return -EIO; + if (cerr && thdr->type != TLS_RECORD_TYPE_DATA) { + copied = -EIO; + break; + } /* don't send tls header, skip copy */ goto skip_copy; } -- 2.30.2