Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1026006lqm; Thu, 2 May 2024 03:04:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVLri3P38oSqYxi7YSCyKfqkAcvTtxy3NJwdXcePC2L8HafPvq93JTEQAV6ckP7HMEUYDGTlJ6Wg8FP7KC7SVuY+mwQjtvoF+CrjSMFfg== X-Google-Smtp-Source: AGHT+IFl1uxoh67oDgf7t5kv+7lXLzJPoIVwWmLUhRiXnLN6venQhsQPcyDZi3fLlWKiKdXejs7L X-Received: by 2002:a17:906:2695:b0:a52:5493:a0b9 with SMTP id t21-20020a170906269500b00a525493a0b9mr1366013ejc.39.1714644278399; Thu, 02 May 2024 03:04:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714644278; cv=pass; d=google.com; s=arc-20160816; b=FH7UhQwPX7hvolX2GpRyJjAM1dJpPF9ZENTwNpdPPypA9PMFXU46t1u7tikfqFpEnK FkDlqBdQsJfSk9nbtGGQc8CgVLgpLf18mL77rBAQvXBpT0fSZyPA9/eTE4U+t1Gjg4qh Cybgm9Uz8Z8E3EExWVJj+FBT9XMafp9uqQavEwWaN+cxLZ9yZVW5UnsnF7ybKCPHnVQH BtyXK8wcI5/1qIFI16PUttJnbMA6dTrM5PmbNOnxc/IMI6yIZvy2TPZ4yvEckNrgXlGx K/dPZcn2WbwMstaH7M2Jpxr577tCe5m9v3xbosKTm19B5CPBNQdsbpq5mPlFJ+9eU4Am oNzA== 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 :subject:cc:to:from:date:dkim-signature; bh=C1G5i7UrakZCjxnuz0b6XpSd9GU8N4mdlGasVNQPq1Y=; fh=9cG+fEZE3sEBrStDydkxQASu9rTPWxF94UuW1ZB7mg8=; b=NDWviFDAKHSNYjU1empySDvFg9+RIO/tIY5K/qQ9GdoLkcXIawy75XbNH0RWs1goQk O0tXP/fm0bKWcBSbgYNbkPAxLh/udFVSH4V5haoPDs0xk2ayN6gIpamce6BwFgU3jLN7 Ix8uFpwFdErMSCp/KCpVTYl00+TbRmfjD8it/MyfbjXAN6v8PUYqnJi97L1/Ud3Vucgg x2Kln5VnsoqvZFrogbVkm5ayvUD2rCfohUSIRLu5TYkMpYSnloS11Jwne6lp0AYSANwP WyonHMOcLE2XGe4W1m5yc5D1p/83bNkmsAIwAHumE+HglwlqomUWsWTXeA5eT7lb/jIY Gugg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=flyTCNeB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-166280-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166280-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id q17-20020a17090622d100b00a474e6a5726si358995eja.574.2024.05.02.03.04.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 03:04:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166280-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=flyTCNeB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-166280-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166280-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 328221F25B6B for ; Thu, 2 May 2024 10:04:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8979F5820E; Thu, 2 May 2024 10:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="flyTCNeB" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5E2256B78; Thu, 2 May 2024 10:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714644222; cv=none; b=aAPllHrfhDNokpL3NgK3RI6/WAKxMyd5L92iIBeDCV0lQXYiUjjUZbYwrcrk0NFOgR4KMkhRPTSsb2y8qlfUdua08Cx7iwzSDtX5THhy8tsTw4XWNtwgreo4gOWW7Pvgz3vsBbJg+a/g1ZmI1bJkvyHCjTix/YlVYZ+D5YqZ0dg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714644222; c=relaxed/simple; bh=ENkbJLHRwFRQxCc8aY+6hcE4ZTb8Z+QG0pGceE0w8a4=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iw75Qxyn1OAw9suc25335ZmqOwz8Y46kwoSGzwXl3WJFBW4OPuFswerLNtDsz4MS96qz1rBPW24DOy8bj6i5GcnqsHkUJYvm8MGRB/U4FJih5fDEIzziZqiBzHoO9RxPqWp9Ads5enJ4kAEC2o9l9a2in7EA3nYXUVRD9v28DIY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=flyTCNeB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E08E3C113CC; Thu, 2 May 2024 10:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714644222; bh=ENkbJLHRwFRQxCc8aY+6hcE4ZTb8Z+QG0pGceE0w8a4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=flyTCNeBhEr+gQyCTC5kBU39G6/4eT+ECUJ/7HXC4NLgZw/35a629PnuyYdhRRTPH PWLKBk9Wom5EjiPT9o2eB/jrJNt6RgeS2gOW5oMRG+flFq3ZhmH+BQkso+Q4LbTbmw uLIPOTNavgz9j2d0k3Te0MsWCCLNUaqJfzBA8ryUVE9mxXquQg+sgfmYLUwhDYk7Vo sAgGIjNhQWOojbKm04Bo52Uw2nPnrfFUWUh7DDahJ042yrbKNyxKRo+Pe4P5iHicIt i3OwbFv9AHyqp0yWyHhcD83uXcHL0/Z9UrfZgVzPW7u9u/nQ0wTLwtiVi6tE/nSg1N EKlp7/2aY1zMA== Date: Thu, 2 May 2024 11:03:35 +0100 From: Mauro Carvalho Chehab To: Sakari Ailus Cc: Stephen Rothwell , linux-media@vger.kernel.org, Bingbu Cao , Hans Verkuil , Linux Kernel Mailing List , Linux Next Mailing List Subject: Re: [PATCH 1/1] media: ipu6: Fix vmalloc memory allocation Message-ID: <20240502110335.7b3495ab@sal.lan> In-Reply-To: <20240502061525.1004018-1-sakari.ailus@linux.intel.com> References: <20240501102236.3b2585d1@canb.auug.org.au> <20240502061525.1004018-1-sakari.ailus@linux.intel.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Em Thu, 2 May 2024 09:15:25 +0300 Sakari Ailus escreveu: > The driver was calling vmalloc() to allocate memory, something which isn't > available except when particular Kconfig settings are enabled. > > Use kvmalloc() instead. > > Reported-by: Stephen Rothwell > Fixes: 25fedc021985 ("media: intel/ipu6: add Intel IPU6 PCI device driver") > Signed-off-by: Sakari Ailus > --- > Hi Stephen, > > Thanks for reporting this. I'm a bit surprised this wasn't catched > earlier. But it seems vmalloc() is defined in some configuration. > > - Sakari > > drivers/media/pci/intel/ipu6/ipu6.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c > index 4b1f69d14d71..082b1d6196be 100644 > --- a/drivers/media/pci/intel/ipu6/ipu6.c > +++ b/drivers/media/pci/intel/ipu6/ipu6.c > @@ -526,7 +526,7 @@ static int request_cpd_fw(const struct firmware **firmware_p, const char *name, > } > > dst->size = fw->size; > - dst->data = vmalloc(fw->size); > + dst->data = kvmalloc(fw->size, GFP_KERNEL); Where are you freeing it? If I understood the code right, you're storing dst at isp->cpd_fw, but I can't see any code freeing it nor cpw_fw->data at device removal. Also, there is a logic there at the same function checking for vmalloc: if (is_vmalloc_addr(fw->data)) { *firmware_p = fw; return 0; } As now the memory may not be inside vmalloc space, shouldn't this be changed as well? Regards, Mauro > if (!dst->data) { > kfree(dst); > ret = -ENOMEM;