Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1369843imm; Tue, 2 Oct 2018 07:12:40 -0700 (PDT) X-Google-Smtp-Source: ACcGV63+kQZPw7siJQ5HUgK5/qOg4Zpmrv3fwVn3z8d1NkS0KEZtVND2b8a3o54jNGyCr81BFP2S X-Received: by 2002:a63:1342:: with SMTP id 2-v6mr14698083pgt.19.1538489560839; Tue, 02 Oct 2018 07:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538489560; cv=none; d=google.com; s=arc-20160816; b=xqcU5vOqfinGNAwoPGVL1N9/DYgG7JyL0tc0wnmqj7NRu7DdNyEisooJor3fVykuKd 0GOLAAglnT6BhGWIOkBRO90aMJ03i3500/axkk7WE+yq8gLEGYmZGauCYcTGJ2UkjXS3 Xyk6OBZuMfmqPDWH5W9qQr8OzVzmTXXCJdzdQuwjvZpuy7FqHXXYbFHjDDqBY/dPBXFw Pn5Pfxh5+OGGOFPep4MH7XVpH+MjSSrIEVWhVwkmvUH6zJ1WjyeVe6rz+wMXb0RTCVJL GCGJMzlo1RtAuMxysoehtmcGKzOpiW8JfsrDg2mk7yg9mVC8JcrzvKDe05IZ4OenBX7U tbWg== 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; bh=Tto3IQlCn+BWDS2wKR1UkcMqncognnPv1rCNEI/6HWU=; b=DoTQDyaC1NHy8Q87LZpca37dk5LpNTRw1aHZDhGy8WX8ZbobjvaHA2izPHkUdLOzTr g44Zlngpkee7qixMUBsag/zciDgnx3HBheo0qpnaXt+TXerK18MNzmVz2PVosZeqwg5q wCsquv2yAR34TP6uk1oeIdzp21xJ440tklwGE1PgHRAVCkBKEA9+/dwBHHASPfoJd/Z3 VHMjExjgDFv3YHCQ63jyP45wyZD91TFGblDkXI4WClrDqG0ELENo0nWPYaobbOt8eKmU OamaK0OWx39Ezz51kHyodqYXgWXs0Eh1upB7TUxHIK6TgGh3nQDMRZ0bKk2efD+KX3sI BNQA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u2-v6si4685498pgg.355.2018.10.02.07.12.25; Tue, 02 Oct 2018 07:12:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729510AbeJBUxu (ORCPT + 99 others); Tue, 2 Oct 2018 16:53:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60566 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727584AbeJBULO (ORCPT ); Tue, 2 Oct 2018 16:11:14 -0400 Received: from localhost (24-104-73-23-ip-static.hfc.comcastbusiness.net [24.104.73.23]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 37F12266; Tue, 2 Oct 2018 13:27:52 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Sasha Levin Subject: [PATCH 4.18 077/228] serial: pxa: Fix an error handling path in serial_pxa_probe() Date: Tue, 2 Oct 2018 06:22:54 -0700 Message-Id: <20181002132504.550075042@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132459.032960735@linuxfoundation.org> References: <20181002132459.032960735@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christophe JAILLET [ Upstream commit 95a0e656580fab3128c7bee5f660c50784f53651 ] If port.line is out of range, we still need to release some resources, or we will leak them. Fixes: afc7851fab83 ("serial: pxa: Fix out-of-bounds access through serial port index") Signed-off-by: Christophe JAILLET Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pxa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c @@ -887,7 +887,8 @@ static int serial_pxa_probe(struct platf goto err_clk; if (sport->port.line >= ARRAY_SIZE(serial_pxa_ports)) { dev_err(&dev->dev, "serial%d out of range\n", sport->port.line); - return -EINVAL; + ret = -EINVAL; + goto err_clk; } snprintf(sport->name, PXA_NAME_LEN - 1, "UART%d", sport->port.line + 1);