Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp311236rdh; Wed, 7 Feb 2024 05:40:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgJoPfL5ln4K4YzEu80CIvLBS0svN1mDJHxjAhcYFlWpytWMx2j8wPBVXi9CUSs09CD9q/ X-Received: by 2002:a05:6358:3422:b0:179:46:d3c2 with SMTP id h34-20020a056358342200b001790046d3c2mr2976546rwd.21.1707313251590; Wed, 07 Feb 2024 05:40:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707313251; cv=pass; d=google.com; s=arc-20160816; b=cmKRQNgip8AtEhwxPC5epEXcWkxqlADw5qExK1CWl07KJrXkZ+kfODV+HJTbh6OGom 398+ENd4/223wFUCVyBgOuPGdBH95WDLE8kDnPxDlllxtCyHIXPjePvxcoqNTtpr8znt /ZC7KRsFFm2Lpu/7Lo+ljmRyzLsl0nZQjn/2JjnNE9zIeHpdt9eTkwefkktdUM+n+jRa Axt47eCtRTP8nRdnZLmSKaHzxV3fQa+jhmXniTgdd1XA2Tg58U0YVlg1K2j4AQww09k9 UTPAtTWxGtI94jmNtDjnUKovvk2enXWJFUVYJlggyOIo5rfb43hvwxOUQzkiJHPnh+AE mZVQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=oJI2plXYN0CmS62atrDcw/0YXz35BqxpvKCMr0u8TjE=; fh=a4puXbMxA+cMWvnQDBtP4JeN5v3nMahOVMK7j12l8vo=; b=vdar2daqwCO8OZWqnHelHMevFlkUlLH/3iqW8PSslS2br5DVhJXmMC0pnbHSVVEY1Z 6aeJDRECy8U2qtqS1n+sRbbdbxxqz3vOurq0W701HStr/6RfAcMrM4UAIuz7HFm7ynuv h9rq+tGL+J4Nj+OBqe5tayFshV0A17EwzOyFoFNQHNSqvLFEared9TL8jszmkQXYsvcO KWcZPX5B8Vh4cd/P/0BYKNP4FEFkYDTIapQHKeNIlCuP7kKTaMz+mfolY+wpHdUIw+BU e0wZf4a2zUG+ldc0LEBqQx9I60c0NFjg6Mkm44dQP35NNHCRbrubAliocEJf3qKhv+Uy HQLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b="dnS/pEGg"; 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-56559-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56559-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; AJvYcCXmfiCsDKNedUWrrXM53aRs6NbOBoUwXpGob7L8+1kApEXnECw5k2IpvSt6Te3zz6kNleqE9mUawc7hc5aF9qtbgrsF0GRlP1DuVE5ujQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id le10-20020a056a004fca00b006e0695e6a64si1452871pfb.389.2024.02.07.05.40.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 05:40:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56559-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b="dnS/pEGg"; 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-56559-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56559-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1A7CD28579E for ; Wed, 7 Feb 2024 13:40:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED73D77F0A; Wed, 7 Feb 2024 13:40:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b="dnS/pEGg" 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 1177276C8F; Wed, 7 Feb 2024 13:40:24 +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=1707313228; cv=none; b=b/S+z4mWVh1T82Ve2yUEUSVy3+R2mW5/DittvhDCu2lEaTmuW/O4ticXkPYox5ZmubOMU0f+td9ugnu6xwP9gBmMdSEGqEw8bTL56QaszsBKstEPdN2LD6DXHVAsuwnAQUHOLZ2GiLW6DVAFSZv4aEQUGHy9tSNr1dUE41SdpFg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707313228; c=relaxed/simple; bh=KXP8XQgu1vPb7UIBRCAFbCn2XbWBSi9zlPgqvl9ob/Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HKVmc58tWiKp6qm3ZPcBjrcG0veBRNalmGLjmRKFGX/iHDaYkTk7ydA5k+Xoo5qlXtKtaZxhpvk0vVRha2DCUG6LmOOk/iv8NTeMKN3Q8P7ACeSc28wuLOPDv55U1jo9Ipyj0ZeXr7ZDILV11tQE25/bMA/LcX+5LWx72H26MHU= 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=dnS/pEGg; 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.6]) by mail.ispras.ru (Postfix) with ESMTPSA id 5CCFA40F1DEF; Wed, 7 Feb 2024 13:40:22 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 5CCFA40F1DEF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1707313222; bh=oJI2plXYN0CmS62atrDcw/0YXz35BqxpvKCMr0u8TjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dnS/pEGghnu4Oy0O9SuHkrzqgDeZ7i4KRaZNBOgqTCUn9dO2dcYdlm82QgxdXGc8K o828vcRrxI7O4ZgCVoqyFpO+b4RyfvABP6gxgZxUbcp9tMKvpQTRST+NUK8bwLEQbZ XEW14U6grY/0yQn1oj7PgPTPtteWDh9r202FoABA= 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, stable@vger.kernel.org Subject: [PATCH v2] bus: mhi: host: free buffer on error in mhi_alloc_bhie_table Date: Wed, 7 Feb 2024 16:40:05 +0300 Message-Id: <20240207134005.7515-1-pchelkin@ispras.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: <2024020709-familiar-slapping-a96a@gregkh> References: 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") Cc: stable@vger.kernel.org Signed-off-by: Fedor Pchelkin --- v2: add missing Cc: stable, as Greg Kroah-Hartman's bot reported 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