summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorQiujun Huang <hqjagain@gmail.com>2020-03-08 12:45:27 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-13 11:45:14 +0300
commit78a4ad28608a530b5bd85da60307d61133e68040 (patch)
tree2d56cf035c4c0f0105063f80fe57936d92943767 /net
parentee433d1cdee016c73707b4636c9dd4424aaaad53 (diff)
downloadlinux-78a4ad28608a530b5bd85da60307d61133e68040.tar.xz
Bluetooth: RFCOMM: fix ODEBUG bug in rfcomm_dev_ioctl
commit 71811cac8532b2387b3414f7cd8fe9e497482864 upstream. Needn't call 'rfcomm_dlc_put' here, because 'rfcomm_dlc_exists' didn't increase dlc->refcnt. Reported-by: syzbot+4496e82090657320efc6@syzkaller.appspotmail.com Signed-off-by: Qiujun Huang <hqjagain@gmail.com> Suggested-by: Hillf Danton <hdanton@sina.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/rfcomm/tty.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index 5e44d842cc5d..cf0ccd05329c 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -413,10 +413,8 @@ static int __rfcomm_create_dev(struct sock *sk, void __user *arg)
dlc = rfcomm_dlc_exists(&req.src, &req.dst, req.channel);
if (IS_ERR(dlc))
return PTR_ERR(dlc);
- else if (dlc) {
- rfcomm_dlc_put(dlc);
+ if (dlc)
return -EBUSY;
- }
dlc = rfcomm_dlc_alloc(GFP_KERNEL);
if (!dlc)
return -ENOMEM;