“65c011845316d3c1381f478ca0d8265c43b3b039”上不存在“arch/x86/kernel/cpu/microcode/intel.c”
提交 a8798516 编写于 作者: P Pan Bian 提交者: Zheng Zengkai

NFC: fix resource leak when target index is invalid

stable inclusion
from stable-5.10.13
commit e10a1aad5f7cc969a78424c8b28cafdbb9299c8f
bugzilla: 47995

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

commit 3a30537c upstream.

Goto to the label put_dev instead of the label error to fix potential
resource leak on path that the target index is invalid.

Fixes: c4fbb651 ("NFC: The core part should generate the target index")
Signed-off-by: NPan Bian <bianpan2016@163.com>
Link: https://lore.kernel.org/r/20210121152748.98409-1-bianpan2016@163.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 61fdc34e
......@@ -105,7 +105,7 @@ static int rawsock_connect(struct socket *sock, struct sockaddr *_addr,
if (addr->target_idx > dev->target_next_idx - 1 ||
addr->target_idx < dev->target_next_idx - dev->n_targets) {
rc = -EINVAL;
goto error;
goto put_dev;
}
rc = nfc_activate_target(dev, addr->target_idx, addr->nfc_protocol);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册