提交 7c01407e 编写于 作者: J Johan Hovold 提交者: Zheng Zengkai

USB: cdc-acm: fix double free on probe failure

stable inclusion
from stable-5.10.28
commit 64deff1f4e0f8e5b56d10c58933ac188eff641c3
bugzilla: 51779

--------------------------------

commit 7180495c upstream.

If tty-device registration fails the driver copy of any Country
Selection functional descriptor would end up being freed twice; first
explicitly in the error path and then again in the tty-port destructor.

Drop the first erroneous free that was left when fixing a tty-port
resource leak.

Fixes: cae2bc76 ("usb: cdc-acm: Decrement tty port's refcount if probe() fail")
Cc: stable@vger.kernel.org      # 4.19
Cc: Jaejoong Kim <climbbb.kim@gmail.com>
Acked-by: NOliver Neukum <oneukum@suse.com>
Signed-off-by: NJohan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20210322155318.9837-2-johan@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: N  Weilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 c1077c11
...@@ -1521,7 +1521,6 @@ static int acm_probe(struct usb_interface *intf, ...@@ -1521,7 +1521,6 @@ static int acm_probe(struct usb_interface *intf,
&dev_attr_wCountryCodes); &dev_attr_wCountryCodes);
device_remove_file(&acm->control->dev, device_remove_file(&acm->control->dev,
&dev_attr_iCountryCodeRelDate); &dev_attr_iCountryCodeRelDate);
kfree(acm->country_codes);
} }
device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities);
alloc_fail5: alloc_fail5:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册