From patchwork Wed Feb 7 06:51:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fedor Pchelkin X-Patchwork-Id: 197767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2044999dyb; Tue, 6 Feb 2024 22:52:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZ/oU9s6GzfM9A7m6+HDXe/KVPmhj0dP2N37qXHKKSHI81NbxoevdLHSPG0W9vHUufiEMP X-Received: by 2002:a25:83c2:0:b0:dc6:b0ce:97d with SMTP id v2-20020a2583c2000000b00dc6b0ce097dmr3864652ybm.29.1707288741522; Tue, 06 Feb 2024 22:52:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707288741; cv=pass; d=google.com; s=arc-20160816; b=KwkvvjhB6XFdUnBJ8Eqq7hmq66ttKlNQqHD1CMFC7VIW15US5ECkd0UUf4fCRDRJQN FIN9pA14TFPRNkcMDt1xufdwcLIjvI/KrGBcmAfgXe2QuZO6d/9cY6DopxPoY3XuCPbu m4v+oBOjspBqqvjPuhytIRJvGt40fkqg1M+5HAwjbhCfPB4AXSnATob3p1eGcJ/V4z8K Cz+J6QWnaJ5lSZKPcZVnx5zq2M4N9Jyp2biGiB2xiXG0eQ2kUOu1TsX+jd+hLpkogFxl XGqk1ykHz6TiBuvAiZXLwp4fnRY3f2Omo1Jvs3UoPrh4i1bHB8a8fGaT/n2b3SKMuGIH YCnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature:dkim-filter; bh=pLGumPzf4SnkMMXOZxsu4fQpASfZpE+/MTtI3Z2JftY=; fh=pdv8Afc0TtNDruW3uA6MYjZNAZFWd+0Q20K2nZL6bNA=; b=G11xPayhc8B/sCW0mTI2VghqwnvB7l8xSvG1EqltcuLupueOi1/OHkNTjQagDhET07 F/oSJFqSXCH+Q2rVKF8RxNwNzHadhXdXSktShd6rcmhOiTPOYivmHEVhde0GDfXA0mJY 4ZHM3kmlYfMJdSiXbUBdWVof3h1STiNwWk7kFWIlYERTSGuI4/3LoD1dacNoUcHHqTU2 5VhdlHz+b7mcXBYOu4nJ7BghFqKM1zq1m2bxIHxvbomjTNOUffqnQzsZAYlNRZTSIgGU sadBjCD5peZBXVrvdW2bo2fBOQHUv+9qUTWnTa+2sDk6QmEWAFHm5Elo4mQx+iW07vVN zx+Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=CkTAmr4S; arc=pass (i=1 spf=pass spfdomain=ispras.ru dkim=pass dkdomain=ispras.ru dmarc=pass fromdomain=ispras.ru); spf=pass (google.com: domain of linux-kernel+bounces-56034-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56034-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru X-Forwarded-Encrypted: i=2; AJvYcCWW7zaI27TwMcM+NR+v+JMipjdlF1gxAJvCtAmfkO6Ca2bEOb8PzsKhah7aEvXE/t5UXeOojuzsGM7+z6/d/s5MfBz/DQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c22-20020a637256000000b005cf0309e41bsi818414pgn.823.2024.02.06.22.52.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 22:52:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56034-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=CkTAmr4S; arc=pass (i=1 spf=pass spfdomain=ispras.ru dkim=pass dkdomain=ispras.ru dmarc=pass fromdomain=ispras.ru); spf=pass (google.com: domain of linux-kernel+bounces-56034-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56034-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 489F32862F4 for ; Wed, 7 Feb 2024 06:52:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4ED971F5F3; Wed, 7 Feb 2024 06:52:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b="CkTAmr4S" Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 464901CF99; Wed, 7 Feb 2024 06:51:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.149.199.84 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707288720; cv=none; b=c2Y15W0IE6o+7QMUWPUSTg0GHjR/Zfu5er5ndlV6hPi6jDyrojBmc2IUdceKYePcersbitYqddMQH45RQQSlxTmQuc3qs5Xy4sfhi6s1OHxYtHhGuXQ9M9mnxtSwh+J228tJcCFHPJ6iyAgj+8ycNE9lE4xPGjDSwJvNpxvgM44= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707288720; c=relaxed/simple; bh=xfJuk5EK3kY+kaejXnInyfN61eHdttxUa2l2rdBDTco=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=TjS1n55T+yfLmX4bTq0zZTH94spJM0svKOVyUDYWAlJLlKLS6zcOKlWm4n+3omo0wUcDobdfIRuPML1crprwwQ6orITxcyjCoiNUB/ssuOk8YKFXG3G/aum69gT8W+mgb6eIufiORiebLmc42psESMlED+YMSA+Tq/6Uky7MdRY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ispras.ru; spf=pass smtp.mailfrom=ispras.ru; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b=CkTAmr4S; arc=none smtp.client-ip=83.149.199.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ispras.ru Received: from fpc.intra.ispras.ru (unknown [10.10.165.5]) by mail.ispras.ru (Postfix) with ESMTPSA id 8FEBD4076729; Wed, 7 Feb 2024 06:51:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 8FEBD4076729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1707288709; bh=pLGumPzf4SnkMMXOZxsu4fQpASfZpE+/MTtI3Z2JftY=; h=From:To:Cc:Subject:Date:From; b=CkTAmr4SSItmwJIz7i0JJOF8It2sn5ADcCKXh6nsZdkDzt0hRJBDM0OEerEGNY6Ns 0xYSPX7fudoG0hxj6zctyd6JsTBskxtlMonpsSsIN/vzp1FDkD29pD5wCKRGfWLM4n K9lN0CCKxV0U46Fz80I9mYQCHvvDFS2Cv7JriuRY= From: Fedor Pchelkin To: Manivannan Sadhasivam Cc: Fedor Pchelkin , Jeffrey Hugo , Kalle Valo , Carl Vanderlip , Sujeev Dias , Greg Kroah-Hartman , Siddartha Mohanadoss , mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Alexey Khoroshilov , lvc-project@linuxtesting.org Subject: [PATCH] bus: mhi: host: free buffer on error in mhi_alloc_bhie_table Date: Wed, 7 Feb 2024 09:51:36 +0300 Message-Id: <20240207065136.18316-1-pchelkin@ispras.ru> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790221999550395547 X-GMAIL-MSGID: 1790221999550395547 img_info->mhi_buf should be freed on error path in mhi_alloc_bhie_table(). This error case is rare but still needs to be fixed. Found by Linux Verification Center (linuxtesting.org). Fixes: 3000f85b8f47 ("bus: mhi: core: Add support for basic PM operations") Signed-off-by: Fedor Pchelkin --- drivers/bus/mhi/host/boot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bus/mhi/host/boot.c b/drivers/bus/mhi/host/boot.c index edc0ec5a0933..738dcd11b66f 100644 --- a/drivers/bus/mhi/host/boot.c +++ b/drivers/bus/mhi/host/boot.c @@ -357,6 +357,7 @@ int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl, for (--i, --mhi_buf; i >= 0; i--, mhi_buf--) dma_free_coherent(mhi_cntrl->cntrl_dev, mhi_buf->len, mhi_buf->buf, mhi_buf->dma_addr); + kfree(img_info->mhi_buf); error_alloc_mhi_buf: kfree(img_info);