Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp127180rdh; Tue, 6 Feb 2024 22:52:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHywZ2RBiGQYEX2dbhvZtc5QBV0+jRnrHfaCm5C5oJZD8L7DrFj6cBJqbHfAbqnCdR35BK3 X-Received: by 2002:ac8:604d:0:b0:42c:3c63:d3dd with SMTP id k13-20020ac8604d000000b0042c3c63d3ddmr1998588qtm.10.1707288734162; Tue, 06 Feb 2024 22:52:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707288734; cv=pass; d=google.com; s=arc-20160816; b=yAipdqLWjRGfc3MftBqQhBkbuYOltx/pnvsHko6nUdZ6JU4lQiTdEW/FxvJXmnU0kl jbWIQ+iH9aXvhbNGgj38T3hT8nvno8ANR/xct9E6KIFX0hSvGF7m10H2KhvlQ9muw1pH ss/kaEYxhFZcdxsNF+y5Xox7b2jAf2H8gAKARajZcV5TeKeFI+J4faWASPs+bEy6HfzO uh+j8FhkGDQleQVIf5kV5Ge2en5C2oIt+oGo68bv8CVKjPInccszmsm0d/ROxLOsUodl aVKn1sHrA46iuaQrJVmu3O+ZkyC0yiMua/9w/NYTF3lW8aPCxZRXnYDSoF8isLzzHvLY faeA== 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=TICKFlKvl73+SAkbJ24nHH9ru2HyLrF3yadbUjSoSqw=; b=s7N4nsEch50veBByySfIC9ykxZzRLPqmEPrpLHDAVRJ7lrHcYWfm4iS3TuvydpNvvD Qq9nx5WhWBGYSV+iCMFcptHQNrlhG3qRY8ak5QASBNAAIyv4BTiDT+GLlBSBP65yaTVZ sV3lLngiZn35O5YcwtJ/dSMj5YcbJGoa3/9EJitFsWVtYkYigj9Rl5UMZSbYUad9LBmk KdNvdh2PyTpjT6RtJvkJT4iEfJplCdw3nMwVLgFMWbsQkxmIc47wO4XLnAOUf1mQ8/cx +uUjISo2kOMpHL0cPK79G//O0kmK2mYdBP8TYs8lJIWhTySwg1Yv3fMFIVGAd6+0X9WY HkLw==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56034-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru X-Forwarded-Encrypted: i=2; AJvYcCUgNpjd0MTLH1eUXOrTmzuU8ONCkDylwmB/2pj5r+0mqKes3ljwqGeYiWTDSDaxO4FaIS8QLnTetTO4jpEPiyRjf2mpOlKxBZdr7B+k3w== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f13-20020a05622a1a0d00b0042c2e481dbesi554054qtb.393.2024.02.06.22.52.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 22:52:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56034-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56034-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E4F2C1C225C8 for ; Wed, 7 Feb 2024 06:52:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 119091CD38; Wed, 7 Feb 2024 06:52:02 +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 Content-Transfer-Encoding: 8bit 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); -- 2.39.2