From mboxrd@z Thu Jan 1 00:00:00 1970 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 C13941BC092; Wed, 20 Nov 2024 12:59:24 +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=1732107564; cv=none; b=eQky/ilhpGxZy9htHNftf6JosMgvIsBrsgUIUpXzybqCk2hK7Zh0kTlDpRVvnOxPF+Wc8Pu7z2zKpFrBenDaC+JxXIDFCVr+oODXLmlGUk0x3bJE9dO2m8GkLfX/AS8yRyYHs1LcYFC07Y5RkIlcvKIXbfYtSL66XiYiDgppJnY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732107564; c=relaxed/simple; bh=5wK5F11B8ToTGa0v5wKSghh3Cpcbdy8lDd6CI3hAqWY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qfb26jxMP4atuRF+bVgBzJ5ctd6rD5HVNGQMRVbtA0MnzMnv1acdDWb/8Y/w0LLz5IiJHqbKP5ilTfItFYCTawQSn1Qvg/30Ap5dA5s1ssz8VbduHJ6L1aWSMNgpn1ciRqWGMoGmZZUXeG2EZcxhwoaAltdHsdh8L1JlkMSBA5M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=RXW2XC3/; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="RXW2XC3/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E132C4CED8; Wed, 20 Nov 2024 12:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1732107564; bh=5wK5F11B8ToTGa0v5wKSghh3Cpcbdy8lDd6CI3hAqWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RXW2XC3/YINE8hcPFpsSq9XewqT57vzhdaOtRtwPwsFigtnNTuOjjDXJJMrIvTWN1 Jzgw0bxHVRSJ4sqFuYeCALT1hjhfPVnF5nR2BV8lS21vOtbFwrSmtsCaV51tN2XMae stn2HvtYf90e/C/KpNQQ4sdcQ8ip2CA6abajDT7o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, kernel test robot , Dan Carpenter , Mauro Carvalho Chehab , Nathan Chancellor Subject: [PATCH 6.11 107/107] media: dvbdev: fix the logic when DVB_DYNAMIC_MINORS is not set Date: Wed, 20 Nov 2024 13:57:22 +0100 Message-ID: <20241120125632.157485361@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241120125629.681745345@linuxfoundation.org> References: <20241120125629.681745345@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.11-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mauro Carvalho Chehab commit a4aebaf6e6efff548b01a3dc49b4b9074751c15b upstream. When CONFIG_DVB_DYNAMIC_MINORS, ret is not initialized, and a semaphore is left at the wrong state, in case of errors. Make the code simpler and avoid mistakes by having just one error check logic used weather DVB_DYNAMIC_MINORS is used or not. Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202410201717.ULWWdJv8-lkp@intel.com/ Signed-off-by: Mauro Carvalho Chehab Link: https://lore.kernel.org/r/9e067488d8935b8cf00959764a1fa5de85d65725.1730926254.git.mchehab+huawei@kernel.org Cc: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- drivers/media/dvb-core/dvbdev.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -530,6 +530,9 @@ int dvb_register_device(struct dvb_adapt for (minor = 0; minor < MAX_DVB_MINORS; minor++) if (!dvb_minors[minor]) break; +#else + minor = nums2minor(adap->num, type, id); +#endif if (minor >= MAX_DVB_MINORS) { if (new_node) { list_del(&new_node->list_head); @@ -543,17 +546,7 @@ int dvb_register_device(struct dvb_adapt mutex_unlock(&dvbdev_register_lock); return -EINVAL; } -#else - minor = nums2minor(adap->num, type, id); - if (minor >= MAX_DVB_MINORS) { - dvb_media_device_free(dvbdev); - list_del(&dvbdev->list_head); - kfree(dvbdev); - *pdvbdev = NULL; - mutex_unlock(&dvbdev_register_lock); - return ret; - } -#endif + dvbdev->minor = minor; dvb_minors[minor] = dvb_device_get(dvbdev); up_write(&minor_rwsem);