From nobody Mon Feb 9 07:19:23 2026 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 6D9F317D6 for ; Fri, 16 Jan 2026 16:32:06 +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=1768581126; cv=none; b=g+2pQnJCmYymJwvCtE67Nk8KRR/FRt2gUHa7jI0f9YHCxzsaZoD8RWj3HC4ZlSt67q+Qz7ArPXWJ/sgiF2l+rLhv1fdA2AlxyuG1to5BNl8daIFiP3Hdu7OMSAn+/YP1da2JiqN54BkHDO8qO9rE3E3uI0Bnh8f6sEYYQOCnjaI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768581126; c=relaxed/simple; bh=LJiIfY49bz7ChDGkJuJVaJweUR1H8NENlPm+RYlN+ow=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GVdG8hSheYQqJwy0S90JAmNHnYlYZAfwp1mhRbPva3nZK+0B3x0D/JPg8/zcrxArr/oizS5p/gkz6l0u017xnZ8vTUP0LBBfeagy4U8hFDvj/XtBD7zFvCTk39tvoCi1ucDl7t4ijQYRJCmU8cOLgg85o6KEvAgQE4+HuCh9c5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TU8sURP9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TU8sURP9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E376CC16AAE; Fri, 16 Jan 2026 16:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768581125; bh=LJiIfY49bz7ChDGkJuJVaJweUR1H8NENlPm+RYlN+ow=; h=From:To:Cc:Subject:Date:From; b=TU8sURP9euNCWFiG9muFGlRfhQuYTMi4QIjajm7FxHe+/X4Rx7UylYUTrnwmO/uHk gVYBmALZr/hADncL1A8dnNnfb7DVJMJDDVfEihRfQ/MowIgaL0RPqT+VlQk0CbJOck EhDMgtohwLA6HSaJn6Mvln2nGkdC2bJ8KCpqV8NZ4A7SPss0w/uUWLp4mdALPjdgw4 nUkJ8LZEjoR3BJF7RoFKU2SEWrNsRmm6Vn1fgoHzjq7JEJ4wvSu4QJZinFgAo/u2lE I2VCarrO/fY1xChyxWb8TGWsll0YM7lOk41SxeYIMoCGu5PGuv0XPu+zmW/87dUgSH 5kih9FH66Hvsg== Received: from johan by xi.lan with local (Exim 4.98.2) (envelope-from ) id 1vgmjy-000000005eg-1GcM; Fri, 16 Jan 2026 17:32:03 +0100 From: Johan Hovold To: Parthiban Veerasooran , Christian Gromm , Greg Kroah-Hartman Cc: Abdun Nihaal , Dan Carpenter , Navaneeth K , linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH] most: core: fix leak on early registration failure Date: Fri, 16 Jan 2026 17:29:50 +0100 Message-ID: <20260116162950.21578-1-johan@kernel.org> X-Mailer: git-send-email 2.52.0 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 Content-Type: text/plain; charset="utf-8" A recent commit fixed a resource leak on early registration failures but for some reason left out the first error path which still leaks the resources associated with the interface. Fix up also the first error path so that the interface is always released on errors. Fixes: 1f4c9d8a1021 ("most: core: fix resource leak in most_register_interf= ace error paths") Fixes: 723de0f9171e ("staging: most: remove device from interface structure= ") Cc: Christian Gromm Cc: Navaneeth K Signed-off-by: Johan Hovold --- This complements the above mentioned fix which is currently in the char-misc-next branch. Johan drivers/most/core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/most/core.c b/drivers/most/core.c index 6277e6702ca8..40d63e38fef5 100644 --- a/drivers/most/core.c +++ b/drivers/most/core.c @@ -1282,12 +1282,17 @@ int most_register_interface(struct most_interface *= iface) int id; struct most_channel *c; =20 - if (!iface || !iface->enqueue || !iface->configure || - !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) + if (!iface) return -EINVAL; =20 device_initialize(iface->dev); =20 + if (!iface->enqueue || !iface->configure || !iface->poison_channel || + (iface->num_channels > MAX_CHANNELS)) { + put_device(iface->dev); + return -EINVAL; + } + id =3D ida_alloc(&mdev_id, GFP_KERNEL); if (id < 0) { dev_err(iface->dev, "Failed to allocate device ID\n"); --=20 2.52.0