Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp110091lqs; Thu, 13 Jun 2024 05:33:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWl40E2+mJsnn6Pn4toGe1y1hNlJJeX7EbR4JdSnTvIBteiW3t5H2LOh2VF8LzOq4dGu8rn9SPNLldzY2oH8Da0yeqEh+a4drWWIv9nNA== X-Google-Smtp-Source: AGHT+IE+Y4W954aaAdVPvKek0VRn0JLwq8QvDXFo6BVkoF0swy4VZDXuT3PQbDMR2fsYpZ8L/64/ X-Received: by 2002:a05:6a21:272f:b0:1b6:5360:2586 with SMTP id adf61e73a8af0-1b8a9bf0493mr4780568637.35.1718282005400; Thu, 13 Jun 2024 05:33:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718282005; cv=pass; d=google.com; s=arc-20160816; b=YbhFyorETMPT5Ct7QMo9cRXcNAXonoB8NI6X2nMsagUmBoT654HujDQqk2vTptf7fa +uHj+5R6FYn1PzixS/HX6V+Zrzdw8v33gVEd2CR11YNU6tiFgaV8gcJlmTDt14+rFCLF tsvSx8ekTdAVIRqdjtjHYaek3JG2bQOvuSeRvMZ7ajp9lY5zK7Aey8zSLrH1ZMqIvS7z aFLdEnJKfBgl1RIWjW8eMjqppweiBf6CZNCbm6b28lM1Ggak/VBQbumniTEqoLFtNleU UB8zfXdloFKDcLTRnLHGkObauWh2mmmZMAl7ZeDfKhwn//6TxLLs1jPcMtxxH/NYFTpc x1yw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vsUrIlTW6nGOTZobooi2Rw2dAWLou1HKoci8poY+DbY=; fh=W6PtSKmQERQh4MDbNl05lnd55mQtjLWZ4FCCw+HdUqM=; b=BwBgg1fvfb4Usq2ZUHNRB3E7GVxRdvBkXSSgovzBhtpziCcAg3W75m3LDoyHu16QE+ mYwp91gPpuJMkR6NO4e6fhRjFXUDMPQba+GSGq/4J2KPh+hMgFIMuefZdYrZD+JmLz4d yETuMhmY9jBYwOey6+qMjd3mWAkfsYHaq5ZXp1EIFQ/YzAB+Mz2K9Lg7xfrDVuYK8zw1 Msqf9uGAHfudWTrm1fTvkCz2pbPEp8vto25zj39r4BXmXmMkWhhyRwSoY0ylu9REr9tD cr4wCbNsyyBfJ2jkccd9tlHQ/18PkB7l+/So3xW14jPNl6Cnk4BJ+J9PkQJ9ibctSi3+ gp3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hv1ir7F5; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-213204-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213204-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c4d5cf0ab9si252821a91.61.2024.06.13.05.33.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 05:33:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213204-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hv1ir7F5; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-213204-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213204-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5036D28364A for ; Thu, 13 Jun 2024 12:32:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DDD91877; Thu, 13 Jun 2024 12:31:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Hv1ir7F5" Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60D2128FF for ; Thu, 13 Jun 2024 12:31:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718281916; cv=none; b=V8IFzxVYXzpTc/77KZF6mEgkaI+4Fn2tJnvWW9Goz9Plx30dfBo4Cc6DG5P/skEWk76hyWDByVzUashFg4xaGsPjOEp4JF0pIA6nTSc3Slnq5MORVbGedzohoSTvUsK6zOVnpZY95CvofMUmM88ztyjubWZmLbiSUJRBc0XMzTw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718281916; c=relaxed/simple; bh=V8V25mHe3o3dnQMzJHzUOo+mYsYHzL6B8ZGKBhsc9Lw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fyQ3eZ3vJGkf7KZiBvGN4Z769FiwP/ruVR0jECQHQ2qRhqy2fkwcBrTfFQKqsNtGzi6k4gkh1vsgIv0zcCTR5XKsk1jHMBT4wHsLgb+mL82SuwE521txVXITkRTbckjX3Cp6mugvFAl0aqBCNsqKWluWCBkqE4lthnB3ejJups8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Hv1ir7F5; arc=none smtp.client-ip=209.85.208.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2ebed33cbafso10735471fa.1 for ; Thu, 13 Jun 2024 05:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718281912; x=1718886712; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=vsUrIlTW6nGOTZobooi2Rw2dAWLou1HKoci8poY+DbY=; b=Hv1ir7F59zmgva0ffRY5aGBHjHE5pNOtq5gIep1bUhID33+/LClKaucoZod9jZzTfq 0C+pfhinXRDcmdLUMqBmJGopyLhb5EvFX66z1Z6/s/XMDLTZ7aRZFss+E1+VbxaKCe/A L3DFqnmxFXu7sR5p598RJX22lcDOctqwiOynFi0ddxAjHtGpHohQkbZFMPAdNQH86sqk 90LMFcH0uqsz4Kyrgd1/uYwiA+X6Ryel6aYvbYIkokcSUutVp+GIPe0P8C6VS2fsquHZ j1BJLgo9MX8rQLrWxsBssFCs0RP42jRhqT47zm1WV7ODXeYgYZ4ZwkT7xrP0EwfNhUZd Yc2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718281912; x=1718886712; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vsUrIlTW6nGOTZobooi2Rw2dAWLou1HKoci8poY+DbY=; b=s9OF8MifRJc8Oj/qaCOW44q8AZQK2bYJU+NgYDSCflzeFuSHmftIG8xOkAzhv8dpX0 nTL0WTxOPi0Iq2d9CSZtEs9GThBNl5wBag3XfHuzLD9Sllb0nzCzlZeyIgL2e8YYDWjl R2yBx8t+uQO8NWRHB6O9+irnBVJif3lF25lelniKoXwvETtmFfLT2f8LwlN6/W9cnTFd WX82vxc6Q8tttP9HyI+YIa3VtwJxSThEmdGx1LgjF7sdivMh/0c6Yyq5oMgkjY+u8YCG d+jEbRSyeJIIF5AZA74P34SSqYroAC78Ow518ug3SRP/PhP09rlJSmqN9CPNorOPBUij vc3Q== X-Forwarded-Encrypted: i=1; AJvYcCXpmJAhfccBXIcuHMav9GAyfwSU+wR4NlFEqS91fyW36UPx4CK5it0hqDr2HaetKiR18xF0IIZUDMl+aB8tIX9gsUXXGb2lgRFG6ler X-Gm-Message-State: AOJu0Yy75tANkgv98S4wvDBQbBOdGHMSnzmhTrtTDUuzaPZKHpt5lj9j 0pXk0eNdQGdqv0m2s3c1pwVoaVmEY4QI73imu/aKF0WUvKuIGetok9CrwDX721c= X-Received: by 2002:a2e:9211:0:b0:2ec:67:8647 with SMTP id 38308e7fff4ca-2ec0067882amr20415521fa.2.1718281912500; Thu, 13 Jun 2024 05:31:52 -0700 (PDT) Received: from eriador.lumag.spb.ru (dzdbxzyyyyyyyyyyybrhy-3.rev.dnainternet.fi. [2001:14ba:a0c3:3a00::b8c]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec05c7813dsm2004091fa.76.2024.06.13.05.31.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 05:31:52 -0700 (PDT) Date: Thu, 13 Jun 2024 15:31:50 +0300 From: Dmitry Baryshkov To: Javier Carrasco Cc: Heikki Krogerus , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] usb: typec: ucsi: glink: fix child node release in probe function Message-ID: References: <20240613-ucsi-glink-release-node-v1-1-f7629a56f70a@gmail.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=us-ascii Content-Disposition: inline In-Reply-To: <20240613-ucsi-glink-release-node-v1-1-f7629a56f70a@gmail.com> On Thu, Jun 13, 2024 at 02:14:48PM +0200, Javier Carrasco wrote: > The device_for_each_child_node() macro requires explicit calls to > fwnode_handle_put() in all early exits of the loop if the child node is > not required outside. Otherwise, the child node's refcount is not > decremented and the resource is not released. > > The current implementation of pmic_glink_ucsi_probe() makes use of the > device_for_each_child_node(), but does not release the child node on > early returns. Add the missing calls to fwnode_handle_put(). > > Cc: stable@vger.kernel.org > Fixes: c6165ed2f425 ("usb: ucsi: glink: use the connector orientation GPIO to provide switch events") > Signed-off-by: Javier Carrasco > --- > This case would be a great opportunity for the recently introduced > device_for_each_child_node_scoped(), but given that it has not been > released yet, the traditional approach has been used to account for > stable kernels (bug introduced with v6.7). A second patch to clean > this up with that macro is ready to be sent once this fix is applied, > so this kind of problem does not arise if more early returns are added. > > This issue has been found while analyzing the code and not tested with > hardware, only compiled and checked with static analysis tools. Any > tests with real hardware are always welcome. > --- > drivers/usb/typec/ucsi/ucsi_glink.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > Reviewed-by: Dmitry Baryshkov -- With best wishes Dmitry