From nobody Mon May 25 01:58:07 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 91B6F409609 for ; Tue, 19 May 2026 13:22:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779196937; cv=none; b=VbE5miv51Ge78ZTxLni6oskdOM9szIP85pij1/DGrm8bBhGkV++2dLf9ZpS4X8cZ/vXhnkxAh51eUNNBUfxw4yR4x67aJwJLgz7HWVgg/6iaXnv2v93bZIn0fvIfb3TY5r3qgIhk0azvwoQoTEQxzyg0DSbBnhjG4xKo1dvu+1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779196937; c=relaxed/simple; bh=CDNwvT4agILtR6rw1O5AVk9gtDJEn7GHHuLJcd9T2B4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=VWveUXMWljhz1+KLfa31D/lNNd5dWYmMC0uPVcCUpvJzkFeEKa35auRcOjg85DT+j1/4qqBMsW3QiDIbtvW92WfXyEPNajlIFRQc6jZCKjko9MGxsi1fh8CuJaPxiMfCIFrYHo6xokgzQ1cvYcqNRAzDqyHJSC3ynKu7mcS9tI0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=N8/hb9WX; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="N8/hb9WX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779196934; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=dfACR+DpYMNxcAFiorOHYvOXYrKjsJZ6QVfWGevX42Q=; b=N8/hb9WXl4TFXp38PA3q53ECR2NPH/HWQThyHEA0GuEkrFLE8942aGNjC+q/0JYHgnW1nD oulA1lehgqK8do3mWAN23rzwLxv7tuSiBv0MK0WDsN5IiTv4eiq92Y3gh6ztkkhhzgosCS uuI5+fnwZo73GKVvCbVB4VOZC0bRAW8= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-262-B-0Ow1XCPFi1Nlr1rSXWxg-1; Tue, 19 May 2026 09:22:11 -0400 X-MC-Unique: B-0Ow1XCPFi1Nlr1rSXWxg-1 X-Mimecast-MFC-AGG-ID: B-0Ow1XCPFi1Nlr1rSXWxg_1779196930 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A86B7195609F; Tue, 19 May 2026 13:22:09 +0000 (UTC) Received: from p16v.redhat.com (unknown [10.44.33.185]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 22E7230001A2; Tue, 19 May 2026 13:22:06 +0000 (UTC) From: Ivan Vecera To: netdev@vger.kernel.org Cc: Petr Oros , Prathosh Satish , Vadim Fedorenko , Arkadiusz Kubalewski , Jiri Pirko , Jakub Kicinski , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net v2] dpll: zl3073x: fix memory leak on pin registration failure Date: Tue, 19 May 2026 15:22:05 +0200 Message-ID: <20260519132205.161847-1-ivecera@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" If zl3073x_dpll_pin_register() fails, the allocated pin is not yet added to zldpll->pins list. The error path calls zl3073x_dpll_pins_unregister() which only iterates pins on the list, so the current pin is leaked. Free the pin before jumping to the error label. Additionally move the pin->dpll_pin =3D NULL assignment in zl3073x_dpll_pin_register() from err_register to the common err_pin_get path. When dpll_pin_get() fails, pin->dpll_pin holds an ERR_PTR value. Without this fix the subsequent zl3073x_dpll_pin_free() would trigger a spurious WARN because it checks pin->dpll_pin for non-NULL. Fixes: 75a71ecc2412 ("dpll: zl3073x: Register DPLL devices and pins") Reviewed-by: Petr Oros Signed-off-by: Ivan Vecera --- v2: Move pin->dpll_pin =3D NULL to err_pin_get path to avoid spurious WARN when dpll_pin_get() fails with ERR_PTR. --- drivers/dpll/zl3073x/dpll.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/dpll/zl3073x/dpll.c b/drivers/dpll/zl3073x/dpll.c index c95e93ef3ab0..64b4e9e3e8fe 100644 --- a/drivers/dpll/zl3073x/dpll.c +++ b/drivers/dpll/zl3073x/dpll.c @@ -1394,8 +1394,8 @@ zl3073x_dpll_pin_register(struct zl3073x_dpll_pin *pi= n, u32 index) =20 err_register: dpll_pin_put(pin->dpll_pin, &pin->tracker); - pin->dpll_pin =3D NULL; err_pin_get: + pin->dpll_pin =3D NULL; fwnode_handle_put(pin->fwnode); pin->fwnode =3D NULL; zl3073x_pin_props_put(props); @@ -1563,8 +1563,10 @@ zl3073x_dpll_pins_register(struct zl3073x_dpll *zldp= ll) } =20 rc =3D zl3073x_dpll_pin_register(pin, index); - if (rc) + if (rc) { + zl3073x_dpll_pin_free(pin); goto error; + } =20 list_add(&pin->list, &zldpll->pins); } --=20 2.53.0