]> git.itanic.dy.fi Git - linux-stable/commit
net: caif: fix memory leak in caif_device_notify
authorPavel Skripkin <paskripkin@gmail.com>
Thu, 3 Jun 2021 16:39:11 +0000 (19:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jun 2021 10:42:36 +0000 (12:42 +0200)
commit9348c1f10932f13b299cbc8b1bd5f780751fae49
tree23a089ac0bf51803660142474076178d6695a1c7
parent4f6da6c526a0bf470536b59fdb219d11336e390e
net: caif: fix memory leak in caif_device_notify

commit b53558a950a89824938e9811eddfc8efcd94e1bb upstream.

In case of caif_enroll_dev() fail, allocated
link_support won't be assigned to the corresponding
structure. So simply free allocated pointer in case
of error

Fixes: 7c18d2205ea7 ("caif: Restructure how link caif link layer enroll")
Cc: stable@vger.kernel.org
Reported-and-tested-by: syzbot+7ec324747ce876a29db6@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/caif/caif_dev.c