Subject: CVE-2024-35859: block: fix module reference leakage from bdev_open_by_dev error path

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

block: fix module reference leakage from bdev_open_by_dev error path

At the time bdev_may_open() is called, module reference is grabbed
already, hence module reference should be released if bdev_may_open()
failed.

This problem is found by code review.

The Linux kernel CVE team has assigned CVE-2024-35859 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.8 with commit ed5cc702d311 and fixed in 6.8.9 with commit 0e9327c67410
	Issue introduced in 6.8 with commit ed5cc702d311 and fixed in 6.9 with commit 9617cd6f24b2

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-35859
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	block/bdev.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/0e9327c67410b129bf85e5c3a5aaea518328636f
	https://git.kernel.org/stable/c/9617cd6f24b294552a817f80f5225431ef67b540