From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 31887286419; Fri, 12 Jun 2026 10:55:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781261726; cv=none; b=c4NjNrDMICnmRF9JV9pA5ReSdjfNJbbpX7biI+XBSY5AT0gHHd1G2Tor9PCw9Tc0rI2KJ6Cvqb+eY5M8dt/lJ4ko/ybFTuaGHYmCmkMyMG2gAi7Q7ptLnankBqCaBLcpGO6B5QYFuS9iWVyqFt2ZFUk6udnfK9vv5SCTYIsSahA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781261726; c=relaxed/simple; bh=lavYfJUsOm7AieFfYN/FIu6H8hRn0UhQJUfwL9MTky8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sN05vWF0x7m+8uL5l3S+uTtLNLMc9s4MdtuI8YZB2NG4JBXH29CfUP+/X2WsMggbNp8zhHFZRouj+sQnbhkWbb2VyH3szLL0hdDVp4ifp5G0IHgf5uGaJFz1hu3Be23rMuG73yWwz0861u1b15UMBRTn8qb8wR627sEdGN8tRjg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nJs/iKnz; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nJs/iKnz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A78B1F000E9; Fri, 12 Jun 2026 10:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781261724; bh=IZiSEkCX6kKkdkS50nu71JK7uzuZuYnFd1L29ILY3Go=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=nJs/iKnzz2mf4+YD03tIqjuzu3OUfrYeW4xhbk453t2LGeCZJGCndPIaxjvSNV199 Q/PKZfKfif6tWQ8P6zJCx8MOwxtZZ+46h+B+9Lk/nV6Dp0N2SGtEt1dptcHi32qt1m 03oruL4fN++UIzlBXqDL74lKmEjaCKuonuLb5yJDqzNa03s6IluXjCDfIvfeFAQ9Hg pxTTGGzHw/5JwmzsnhNstKB3GvjcWMZdVACgB+X/FC0Gz6AqFp2QvKeZy7r43Csecr Vdk/Myur0KeDyhbPUY2zbO50l6cBz87PldVBEOBYOAEGlj2ghIvts3wkkirKiWVND0 fSC4FLIq/Hh5Q== Date: Fri, 12 Jun 2026 11:55:21 +0100 From: Sudeep Holla To: Unnathi Chalicheemala Cc: Jens Wiklander , Sudeep Holla , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, kernel@oss.qualcomm.com, Trilok Soni , Satya Durga Srinivasu Prabhala Subject: Re: [PATCH] firmware: arm_ffa: Fix NULL dereference in ffa_partition_info_get() Message-ID: <20260612-fat-energetic-hummingbird-8ddc62@sudeepholla> References: <20260611-ffa_partition_nullptr_fix-v1-1-ec2b7ef7e130@oss.qualcomm.com> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260611-ffa_partition_nullptr_fix-v1-1-ec2b7ef7e130@oss.qualcomm.com> On Thu, Jun 11, 2026 at 01:19:17PM -0700, Unnathi Chalicheemala wrote: > ffa_partition_info_get() passes uuid_str directly to uuid_parse() > without a NULL check. When a caller passes NULL (or an empty string), > uuid_parse() → __uuid_parse() → uuid_is_valid() dereferences the > pointer, causing a kernel panic: > > Unable to handle kernel NULL pointer dereference at virtual address > 0000000000000040 > pc : uuid_parse+0x40/0xac > lr : ffa_partition_info_get+0x1c/0x94 [arm_ffa] > The above is very valid issue and needs to be addressed. > Per the FF-A spec, the all-zeros UUID is the defined wildcard that > instructs the SPMC to return information for all partitions. Map NULL > and empty string to uuid_null rather than crashing in uuid_parse(), > preserving the intended "return all partitions" semantics for callers > that pass NULL. > Agreed on the spec part but not w.r.t the interface. Where is the driver using this call and why is it sending null or wants to extract all the partition information ? > Fixes: d0c0bce83122 ("firmware: arm_ffa: Setup in-kernel users of FFA partitions") > Signed-off-by: Unnathi Chalicheemala > --- > drivers/firmware/arm_ffa/driver.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c > index b9f17fda7243..dd500fb81b79 100644 > --- a/drivers/firmware/arm_ffa/driver.c > +++ b/drivers/firmware/arm_ffa/driver.c > @@ -1129,7 +1129,9 @@ static int ffa_partition_info_get(const char *uuid_str, > uuid_t uuid; > struct ffa_partition_info *pbuf; > > - if (uuid_parse(uuid_str, &uuid)) { > + if (!uuid_str || uuid_str[0] == '\0') { > + uuid = uuid_null; I object to make it uuid_null. Below check is enough to check NULL dereference. - if (uuid_parse(uuid_str, &uuid)) { + if (!uuid_str || uuid_parse(uuid_str, &uuid)) { I don't think we need to service NULL as valid argument via this interface as the callee driver needs to pass its partition UUID here. -- Regards, Sudeep