summaryrefslogtreecommitdiffstats
path: root/net/sched/sch_netem.c
diff options
context:
space:
mode:
authorZhu Wang <wangzhu9@huawei.com>2023-08-03 10:02:30 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-16 18:13:01 +0200
commit06c5340858011aa1195aec43a776e3185fbf7f56 (patch)
treefde40335a3059650449ecf11dbda936f75d67715 /net/sched/sch_netem.c
parentf830968d464f55e11bc9260a132fc77daa266aa3 (diff)
downloadlinux-stable-06c5340858011aa1195aec43a776e3185fbf7f56.tar.gz
linux-stable-06c5340858011aa1195aec43a776e3185fbf7f56.tar.bz2
linux-stable-06c5340858011aa1195aec43a776e3185fbf7f56.zip
scsi: core: Fix possible memory leak if device_add() fails
commit 04b5b5cb0136ce970333a9c6cec7e46adba1ea3a upstream. If device_add() returns error, the name allocated by dev_set_name() needs be freed. As the comment of device_add() says, put_device() should be used to decrease the reference count in the error path. So fix this by calling put_device(), then the name can be freed in kobject_cleanp(). Fixes: ee959b00c335 ("SCSI: convert struct class_device to struct device") Signed-off-by: Zhu Wang <wangzhu9@huawei.com> Link: https://lore.kernel.org/r/20230803020230.226903-1-wangzhu9@huawei.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/sched/sch_netem.c')
0 files changed, 0 insertions, 0 deletions