diff options
author | 2021-10-12 12:16:29 +0800 | |
---|---|---|
committer | 2021-10-15 21:06:10 +0200 | |
commit | 24d23181e43d72ca692a479e70dfe5b0b5dd33f1 (patch) | |
tree | b919f6af9cd9d6efc475e04c600af389b47b39f1 /drivers/rtc/dev.c | |
parent | rtc: class: don't call cdev_device_del() when cdev_device_add() failed (diff) | |
download | wireguard-linux-24d23181e43d72ca692a479e70dfe5b0b5dd33f1.tar.xz wireguard-linux-24d23181e43d72ca692a479e70dfe5b0b5dd33f1.zip |
rtc: class: check return value when calling dev_set_name()
I got a null-ptr-deref report when doing fault injection test:
BUG: kernel NULL pointer dereference, address: 0000000000000000
RIP: 0010:strcmp+0xc/0x20
Call Trace:
__devm_rtc_register_device.cold.7+0x16a/0x2df
rv3029_probe+0x4b1/0x770 [rtc_rv3029c2]
rv3029_i2c_probe+0x141/0x180 [rtc_rv3029c2]
i2c_device_probe+0xa07/0xbb0
really_probe+0x285/0xc30
If dev_set_name() fails, dev_name() is null, it causes null-ptr-deref,
we need check the return value of dev_set_name().
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20211012041629.2504158-1-yangyingliang@huawei.com
Diffstat (limited to 'drivers/rtc/dev.c')
0 files changed, 0 insertions, 0 deletions