From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (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 43ABB1A9FAF for ; Fri, 9 Jan 2026 04:42:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767933773; cv=none; b=ipwd9LKUSwvwWpCrwA8mrf+Nz5FngCJQcI/P1CIbhdB8ACes3EXzdZ6MjzY7Bwfxfh6MqiMkdGXbn4KGyK3xQWDy7D+ZG4k0J+jcdr17lTboWxJSVWNv+Vs4SHRuHCjarHC6v7+RVU4sK5DZyyzlWuDxG/Osg/v6faH5SPS0X84= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767933773; c=relaxed/simple; bh=cDneNoCFN2NHmxddIcc/AQdk3UagosSbIU6XVkEQ2nQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=R16Unwgrj2riGTGQnmOB+RhkCbXlIcoHV4GrFs5xL3E41i7cLSondPi/AVChXpjkj1l7tdJHy53E9m3COVK3HWA2PnLe4rcm09D/5+DSQ7vwZ8m1boXf6RZ+syztAiJL2t0M7Oc8QGSuRuFOxDhePGHcYAhpQelCzA2l8WlimF0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=packett.cool; spf=pass smtp.mailfrom=packett.cool; dkim=pass (2048-bit key) header.d=packett.cool header.i=@packett.cool header.b=cUzQzed1; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=packett.cool Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=packett.cool Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=packett.cool header.i=@packett.cool header.b="cUzQzed1" Message-ID: <2dc9a9a3-2af7-475d-bfb6-9741ac0f2790@packett.cool> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=packett.cool; s=key1; t=1767933769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ONG0/w04+VGe3YstfLMfJo0O9OcN1H5ybNV55QqrJ9s=; b=cUzQzed1CwEqPqkLlNZsF4jKYG/kbLPEBa8qE/LOOtZzU+A0LUzfYWq6TNX7grj9v6YOLO JIzAknWIfuGlbsYJG3mLHuB5hoZNEn/IdPPihbFZhaXGtrxwbDyXsYpAyNtSvaG0uqCYoz cKAc4WsivF1edNppSA1Gd6xlocMbDapnuiyFz5+HJpAxYjlfe1NLSWTg304lfFuZrd1kZg X+piNf8H9vaZC536Hynob1zdYyvDUyi0q2FdG/syIlxcxpxt5nvcDgCkZF/jhG3YeRiHRn IJJl1W2xvzhu+tHs42Wr5fLZwqC32dlKZvScVZpPGS1PoOvsbBbQxfvWObstMw== Date: Fri, 9 Jan 2026 01:42:43 -0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] gpiolib: fix lookup table matching To: Bartosz Golaszewski , Linus Walleij , Bartosz Golaszewski , Marek Szyprowski , Konrad Dybcio Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org References: <20260108102314.18816-1-bartosz.golaszewski@oss.qualcomm.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Val Packett In-Reply-To: <20260108102314.18816-1-bartosz.golaszewski@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 1/8/26 7:23 AM, Bartosz Golaszewski wrote: > If on any iteration in gpiod_find(), gpio_desc_table_match() returns > NULL (which is normal and expected), we never reinitialize desc back to > ERR_PTR(-ENOENT) and if we don't find a match later on, we will return > NULL causing a NULL-pointer dereference in users not expecting it. Don't > initialize desc, but return ERR_PTR(-ENOENT) explicitly at the end of > the function. > > Fixes: 9700b0fccf38 ("gpiolib: allow multiple lookup tables per consumer") > Reported-by: Marek Szyprowski > Closes: https://lore.kernel.org/all/00107523-7737-4b92-a785-14ce4e93b8cb@samsung.com/ > Signed-off-by: Bartosz Golaszewski Tested-by: Val Packett This also fixes things on Qualcomm x1e laptops (same NULL deref logged from snd_soc_wcd938x wcd938x_probe, but as a consequence the display&gpu subsystem also wouldn't work)