In the Linux kernel, the following vulnerability has been resolved:
chardev: fix error handling in cdevdeviceadd()
While doing fault injection test, I got the following report:
------------[ cut here ]------------ kobject: '(null)' (0000000039956980): is not initialized, yet kobjectput() is being called. WARNING: CPU: 3 PID: 6306 at kobjectput+0x23d/0x4e0 CPU: 3 PID: 6306 Comm: 283 Tainted: G W 6.1.0-rc2-00005-g307c1086d7c9 #1253 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 RIP: 0010:kobjectput+0x23d/0x4e0 Call Trace: <TASK> cdevdeviceadd+0x15e/0x1b0 _iiodeviceregister+0x13b4/0x1af0 [industrialio] _devmiiodeviceregister+0x22/0x90 [industrialio] max517probe+0x3d8/0x6b4 [max517] i2cdevice_probe+0xa81/0xc00
When deviceadd() is injected fault and returns error, if dev->devt is not set, cdevadd() is not called, cdev_del() is not needed. Fix this by checking dev->devt in error path.
[
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@85a5660491b507d33662b8e81c142e6041e642eb",
"target": {
"file": "fs/char_dev.c"
},
"digest": {
"line_hashes": [
"201962234338815379696110521922727637789",
"120151065584324155401350232123311716166",
"253663011782157310858377402902900366844",
"73448203744084520718167815962181858598"
],
"threshold": 0.9
},
"signature_type": "Line",
"id": "CVE-2022-50282-01d992bc"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@34d17b39bceef25e4cf9805cd59250ae05d0a139",
"target": {
"file": "fs/char_dev.c"
},
"digest": {
"line_hashes": [
"201962234338815379696110521922727637789",
"120151065584324155401350232123311716166",
"253663011782157310858377402902900366844",
"73448203744084520718167815962181858598"
],
"threshold": 0.9
},
"signature_type": "Line",
"id": "CVE-2022-50282-0cfcfbf7"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5d2146889fad4cb9e6c13e790d4cfd871486eca8",
"target": {
"function": "cdev_device_add",
"file": "fs/char_dev.c"
},
"digest": {
"function_hash": "119731803963665899910312063777774238077",
"length": 275.0
},
"signature_type": "Function",
"id": "CVE-2022-50282-22dfb5e1"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b5de1eac71fec1af7723f1083d23a24789fd795c",
"target": {
"file": "fs/char_dev.c"
},
"digest": {
"line_hashes": [
"201962234338815379696110521922727637789",
"120151065584324155401350232123311716166",
"253663011782157310858377402902900366844",
"73448203744084520718167815962181858598"
],
"threshold": 0.9
},
"signature_type": "Line",
"id": "CVE-2022-50282-2e43354a"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@28dc61cc49c6e995121c6d86bef4b73df78dda80",
"target": {
"function": "cdev_device_add",
"file": "fs/char_dev.c"
},
"digest": {
"function_hash": "119731803963665899910312063777774238077",
"length": 275.0
},
"signature_type": "Function",
"id": "CVE-2022-50282-3daab394"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d85b5247a79355b8432bfd9ac871f96117f750d4",
"target": {
"file": "fs/char_dev.c"
},
"digest": {
"line_hashes": [
"201962234338815379696110521922727637789",
"120151065584324155401350232123311716166",
"253663011782157310858377402902900366844",
"73448203744084520718167815962181858598"
],
"threshold": 0.9
},
"signature_type": "Line",
"id": "CVE-2022-50282-42d86cc8"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c46db6088bccff5115674d583fef46ede80077a2",
"target": {
"file": "fs/char_dev.c"
},
"digest": {
"line_hashes": [
"201962234338815379696110521922727637789",
"120151065584324155401350232123311716166",
"253663011782157310858377402902900366844",
"73448203744084520718167815962181858598"
],
"threshold": 0.9
},
"signature_type": "Line",
"id": "CVE-2022-50282-431b11b1"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6acf8597c5b04f455ee0649e11e5f3bcd28f381e",
"target": {
"file": "fs/char_dev.c"
},
"digest": {
"line_hashes": [
"201962234338815379696110521922727637789",
"120151065584324155401350232123311716166",
"253663011782157310858377402902900366844",
"73448203744084520718167815962181858598"
],
"threshold": 0.9
},
"signature_type": "Line",
"id": "CVE-2022-50282-49b0e910"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@85a5660491b507d33662b8e81c142e6041e642eb",
"target": {
"function": "cdev_device_add",
"file": "fs/char_dev.c"
},
"digest": {
"function_hash": "119731803963665899910312063777774238077",
"length": 275.0
},
"signature_type": "Function",
"id": "CVE-2022-50282-7cdfafdf"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5d2146889fad4cb9e6c13e790d4cfd871486eca8",
"target": {
"file": "fs/char_dev.c"
},
"digest": {
"line_hashes": [
"201962234338815379696110521922727637789",
"120151065584324155401350232123311716166",
"253663011782157310858377402902900366844",
"73448203744084520718167815962181858598"
],
"threshold": 0.9
},
"signature_type": "Line",
"id": "CVE-2022-50282-8b22790b"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@28dc61cc49c6e995121c6d86bef4b73df78dda80",
"target": {
"file": "fs/char_dev.c"
},
"digest": {
"line_hashes": [
"201962234338815379696110521922727637789",
"120151065584324155401350232123311716166",
"253663011782157310858377402902900366844",
"73448203744084520718167815962181858598"
],
"threshold": 0.9
},
"signature_type": "Line",
"id": "CVE-2022-50282-8c6d9fa7"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c46db6088bccff5115674d583fef46ede80077a2",
"target": {
"function": "cdev_device_add",
"file": "fs/char_dev.c"
},
"digest": {
"function_hash": "119731803963665899910312063777774238077",
"length": 275.0
},
"signature_type": "Function",
"id": "CVE-2022-50282-8e8c2f77"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6acf8597c5b04f455ee0649e11e5f3bcd28f381e",
"target": {
"function": "cdev_device_add",
"file": "fs/char_dev.c"
},
"digest": {
"function_hash": "119731803963665899910312063777774238077",
"length": 275.0
},
"signature_type": "Function",
"id": "CVE-2022-50282-8fd884ea"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@11fa7fefe3d8fac7da56bc9aa3dd5fb3081ca797",
"target": {
"function": "cdev_device_add",
"file": "fs/char_dev.c"
},
"digest": {
"function_hash": "119731803963665899910312063777774238077",
"length": 275.0
},
"signature_type": "Function",
"id": "CVE-2022-50282-b9468c9a"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d85b5247a79355b8432bfd9ac871f96117f750d4",
"target": {
"function": "cdev_device_add",
"file": "fs/char_dev.c"
},
"digest": {
"function_hash": "119731803963665899910312063777774238077",
"length": 275.0
},
"signature_type": "Function",
"id": "CVE-2022-50282-c0474266"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b5de1eac71fec1af7723f1083d23a24789fd795c",
"target": {
"function": "cdev_device_add",
"file": "fs/char_dev.c"
},
"digest": {
"function_hash": "119731803963665899910312063777774238077",
"length": 275.0
},
"signature_type": "Function",
"id": "CVE-2022-50282-c7ad3ff7"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@11fa7fefe3d8fac7da56bc9aa3dd5fb3081ca797",
"target": {
"file": "fs/char_dev.c"
},
"digest": {
"line_hashes": [
"201962234338815379696110521922727637789",
"120151065584324155401350232123311716166",
"253663011782157310858377402902900366844",
"73448203744084520718167815962181858598"
],
"threshold": 0.9
},
"signature_type": "Line",
"id": "CVE-2022-50282-cbe12325"
},
{
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@34d17b39bceef25e4cf9805cd59250ae05d0a139",
"target": {
"function": "cdev_device_add",
"file": "fs/char_dev.c"
},
"digest": {
"function_hash": "119731803963665899910312063777774238077",
"length": 275.0
},
"signature_type": "Function",
"id": "CVE-2022-50282-d3a1ca56"
}
]