Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3852371pxb; Tue, 17 Nov 2020 05:24:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQfTzxrvEMToXHpgSUqb4AighGy5AANjb3ajqMyMItj48qg1UIR+kGqW3LEwH1hpiECnLk X-Received: by 2002:a17:906:519b:: with SMTP id y27mr18755310ejk.25.1605619495112; Tue, 17 Nov 2020 05:24:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605619495; cv=none; d=google.com; s=arc-20160816; b=jjw1dJAFiPhN4XdoHiFzH8Hqr0iaxCcrVZaNvNI+EWKm6gjTNU7g7gWpfW9jWXS22w xdf2b4g2NzxNr5m/2FsIQECuL+r7lI7WwzcaUTZV140WUmibuvBFPD2c0GlYyYr3X3MS IKTjwz35+PMeaVH0/Bl91A8k6jg2mAsY6XIj0PH27M8VWldHY0hh24P5nM26Wuoh++jo pN+nq7PdxFR31gEV4vQzYQcteeYKBkuSXSm0bbt0SaAZlk2bYpYb/65Y321O4jjHYo8X +FvXeRMTrgO/Mb2MFVo2KWZ8T5xBk81QzMN0osA/tsCHtZekRzwIfGeLylnotCO7xbBU rjlw== 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=WYNdckaiaL8qw7qL8qlvmkQVFSxWWmm9XJlLgjsGJpU=; b=NUgIlWNkkLN5FMvFNgpi2Yg+t235+XNPWhjsv3ninBJAfGTdIidKOA3sFLWuHC3K+e EpKy+/IhipA8CuATAsWcu7hQkHRY+sUBt3FxYw90dJTUmm3/CAYcOjN9yzpsdHzhXJRS kSVYTS1DTitnyaePoJopjh9T8GJbyC14E5iFafJNo0YfINnVoaF3JbdoaaBk7Vj/bQve SKFUhPI/3IQWwZYIPtEO0wgnhBDsf53JWNgFbjYAB9kvmH3HhQ0MW53POghomTZ+vSkN 9lFtdRwttQI/eE2U2A+gyjnof3E39rYllvodFGScKrTjWpqMmfWK6JEgUClilvP0WXcx Agug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RKk9gS+e; 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 c1si14427298edq.286.2020.11.17.05.24.32; Tue, 17 Nov 2020 05:24:55 -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=RKk9gS+e; 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 S1728960AbgKQNU0 (ORCPT + 99 others); Tue, 17 Nov 2020 08:20:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:53748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730512AbgKQNUV (ORCPT ); Tue, 17 Nov 2020 08:20:21 -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 B99FD2464E; Tue, 17 Nov 2020 13:20:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619219; bh=Yw1B9yR1LrXrJU3GGhQFjNUB3ifcuZATm5ZkwuY4VqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RKk9gS+eOqq0nr7GbiBhgloZx9/nlgWnn/Rncvlmnz2HXX2DQdicUQ4j3m5eXyjKF DjcbUvyKbYexZK6rROIEiOv+ruy30WXiAS1IKMLPM42AZl8og5KmAgAtpFnq2WwWit AIDhf2BLk9mvMPr9X09+uLy49Wol6QrKM9uZwnHg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg Subject: [PATCH 4.19 067/101] thunderbolt: Fix memory leak if ida_simple_get() fails in enumerate_services() Date: Tue, 17 Nov 2020 14:05:34 +0100 Message-Id: <20201117122116.374513186@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122113.128215851@linuxfoundation.org> References: <20201117122113.128215851@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 @@ -774,6 +774,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; }