Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4479488ybz; Tue, 28 Apr 2020 12:01:17 -0700 (PDT) X-Google-Smtp-Source: APiQypJKk0Yc2CAcJ1YdgF3jz4S1EAnP7Q3GNalv4XX4AHmdr+8n3O6FT2As7ABi1lHZdFV2FNIa X-Received: by 2002:a05:6402:759:: with SMTP id p25mr24861742edy.102.1588100476976; Tue, 28 Apr 2020 12:01:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588100476; cv=none; d=google.com; s=arc-20160816; b=j/7hQ7mQNR4YFRfqeG/FnyrVfipcUCFSVlbUdNOb7LDHeGa22pD+IiMyEbErSwmE+O TFEiBN5STZQchqZz6vq9aKrvIyYnj9MaDRuNey7M7T6dUoVgFU5TCSUz41r2ogbB/fBb mMmfrnvaDGLoFKo1UPE3DIw+pZppbRVMaxIIJSPuv/7+WHw9PsvRUEwvRP3YVIIFSgaP qmSiiFHpNxPnRMVmqE3chvEU0TVhSYNZx3iDBE/ZIVzntlVoZgu9r9b3NA3c1tsEbGWg XJWQoqzJNCBa99aLx3EzT9HFLGmE206ObsJbOX+Wm8H2XfX8BawuLmQFC+QJo9OUAJOr TTSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WIc1VUf8Ebq5kpw6VAmv2N1DpkaWO5qcFYKL7E3iz2c=; b=bZ4SNaaGVTGXgTYBpjT0SI3BWFobRM19wf4O0w7fEL/e+wFqrgZ8JxK1zlbv+/47DK VZ8a9DsueHqkGzEbLacI8/qMW5xZER8MOpPmybHq2zoXpMeghJTeBY1eoHRzIOR+K6IJ nYa/5wt3yLFILE9xe0g/gjcDJSeacg++v+8pJrs3rv1Zno34Smosr08Gi5XOGE1OlcRS SRGhCHBE6FJ+51r/+m/Ud3QDC58ebCyAJXzsPSR8iHTjnsbUpBj49BRS/L+o8t59GqS4 FKIjLXdz2BPAzkOfet+SXPjuPHJOaKdAtxuy1heIrNoTX8977GqB9jiGbMMUuzv2SiVk z/6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k9mrJk6p; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q6si1959623edb.559.2020.04.28.12.00.53; Tue, 28 Apr 2020 12:01:16 -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=@kernel.org header.s=default header.b=k9mrJk6p; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729465AbgD1S7h (ORCPT + 99 others); Tue, 28 Apr 2020 14:59:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:41272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729189AbgD1S2Z (ORCPT ); Tue, 28 Apr 2020 14:28:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4DE5220BED; Tue, 28 Apr 2020 18:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588098504; bh=cAsobCg9jwmouMkaU0/F+93bEXvxaMeqh2tFcVn6pKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k9mrJk6pGq7IPz6VeCI/Rt+kH858nHTOHnP5H93rbMf+NlvmMlkLer9U5IDas3HAE NjbiQ+hAE1IyrRZz6PrW7sk83jAWJ0JS0JaA0fy4mJblKhl54fRQdExlFJdf3R/AxR v3RuVaF+Gx2XOuzv9QcR4HZq7pSRdxcpd+tMMThM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiyu Yang , Xin Tan , "David S. Miller" Subject: [PATCH 5.6 062/167] tipc: Fix potential tipc_aead refcnt leak in tipc_crypto_rcv Date: Tue, 28 Apr 2020 20:23:58 +0200 Message-Id: <20200428182232.791482602@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200428182225.451225420@linuxfoundation.org> References: <20200428182225.451225420@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiyu Yang [ Upstream commit 441870ee4240cf67b5d3ab8e16216a9ff42eb5d6 ] tipc_crypto_rcv() invokes tipc_aead_get(), which returns a reference of the tipc_aead object to "aead" with increased refcnt. When tipc_crypto_rcv() returns, the original local reference of "aead" becomes invalid, so the refcount should be decreased to keep refcount balanced. The issue happens in one error path of tipc_crypto_rcv(). When TIPC message decryption status is EINPROGRESS or EBUSY, the function forgets to decrease the refcnt increased by tipc_aead_get() and causes a refcnt leak. Fix this issue by calling tipc_aead_put() on the error path when TIPC message decryption status is EINPROGRESS or EBUSY. Signed-off-by: Xiyu Yang Signed-off-by: Xin Tan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/tipc/crypto.c | 1 + 1 file changed, 1 insertion(+) --- a/net/tipc/crypto.c +++ b/net/tipc/crypto.c @@ -1712,6 +1712,7 @@ exit: case -EBUSY: this_cpu_inc(stats->stat[STAT_ASYNC]); *skb = NULL; + tipc_aead_put(aead); return rc; default: this_cpu_inc(stats->stat[STAT_NOK]);