Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3866968pxb; Tue, 17 Nov 2020 05:46:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJx4z/4DAhGadi3JmkElMnyJMgB1gWSN5vvwsIGWFPP3Hpjwhc0kOTIUiFhZTgl5M7wfrmZS X-Received: by 2002:a17:906:3547:: with SMTP id s7mr18775604eja.70.1605620770209; Tue, 17 Nov 2020 05:46:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620770; cv=none; d=google.com; s=arc-20160816; b=CCYiqBzgSCR99LwUy5mzlo7+KhBGqQihI+3RChdQxK6LVrO6zkdOZmMcLBiC00UAKo V5pU7Ryt+SvYZd4Y09LO0eE0dtgJ1ki9+vEktcvlw5fM84fa6rPIxI8kpKFpU+CcxrJL ahU7O5UhVx031N5NaOUC/WMVR/Y8TCVHFcYKQDGj6S9XFQ5iG+4sMl8PcGmoK1WZI9Pr vH51WeCImLIaWhxs52bbjSymdYPC9o4l/L2UwQgMMpsOSNXXW2TWcM7BqnddExkwzPbO sf+UFiNWj9Qp6JzV5B8k2U68X7rbeptVmxjWIhSovjkcjLQ5ANSVPFY6TXIPqJxi2GH+ bo+g== 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=SzYStA8rlVs9upOcf+bwRQjX3LIntJiBMEM/nYLUBN0=; b=Hlw/34evscFXbX/hG0Dhcw5ojibBXzdwOxUh+OGEoegFQroNz1jOGAWeGQjq0tNCIw x00/JfXrbSYJgRTmw94miMZTv29pNnciETJTVXIhgmVZPxLXAaJ30ONhAXFGmH9YBnpa 9zgfnDfRrPa+5hGT49UiJaBSKMCOS6QEpiLdHn5pwd8h2XokvIqxzfCjC/ZJ58Bq/Dty KCbTTia/lGTMcGMywXkfUzw0WXpa07s3d0k5fbtywE4J0vKTSD60OFIUGVVBzdD/rsu2 r+m+SQucTV0O8ShnqlgwZLQsusnO94VRsO+tzdKaP2gCZKbvgpFKjfBIPNoicqDim/VP 7mBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Vc7/tKtU"; 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=fail (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 a11si13154984ejd.391.2020.11.17.05.45.46; Tue, 17 Nov 2020 05:46:10 -0800 (PST) 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="Vc7/tKtU"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733156AbgKQNo1 (ORCPT + 99 others); Tue, 17 Nov 2020 08:44:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:53134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732949AbgKQNkz (ORCPT ); Tue, 17 Nov 2020 08:40:55 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 12AC5246A5; Tue, 17 Nov 2020 13:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620454; bh=6Xj/UfNXlm5AE48Worr5DOIeURy7ha/pUSjLAuAIqik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vc7/tKtUTb6iP/5OAqAVnVoJm+pSfg/zLltVwEh/7JIe61WKOa0oTknkv1tfu1uPK C68Txn/L4JRCEXKwzKfD+uLuVOBT3zEBI0CkaN6M2I7j8y/In1W/+Tz3AOfl2FGzx9 PzFpnpIQ/alQ0bTI3Zc4Rt8FqD1y3w3V/05qf1S4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg Subject: [PATCH 5.9 195/255] thunderbolt: Fix memory leak if ida_simple_get() fails in enumerate_services() Date: Tue, 17 Nov 2020 14:05:35 +0100 Message-Id: <20201117122148.420952563@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@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: Mika Westerberg commit a663e0df4a374b8537562a44d1cecafb472cd65b upstream. The svc->key field is not released as it should be if ida_simple_get() fails so fix that. Fixes: 9aabb68568b4 ("thunderbolt: Fix to check return value of ida_simple_get") Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg Signed-off-by: Greg Kroah-Hartman --- drivers/thunderbolt/xdomain.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c @@ -881,6 +881,7 @@ static void enumerate_services(struct tb id = ida_simple_get(&xd->service_ids, 0, 0, GFP_KERNEL); if (id < 0) { + kfree(svc->key); kfree(svc); break; }