Message ID | 20210427162258.7238-1-lyl2019@mail.ustc.edu.cn (mailing list archive) |
---|---|
State | Accepted |
Commit | 75258586793efc521e5dd52a5bf6c7a4cf7002be |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net:nfc:digital: Fix a double free in digital_tg_recv_dep_req | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | fail | 2 blamed authors not CCed: sameo@linux.intel.com thierry.escande@linux.intel.com; 4 maintainers not CCed: sameo@linux.intel.com zhengyongjun3@huawei.com wanghai38@huawei.com thierry.escande@linux.intel.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 8 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
Hello: This patch was applied to netdev/net-next.git (refs/heads/master): On Tue, 27 Apr 2021 09:22:58 -0700 you wrote: > In digital_tg_recv_dep_req, it calls nfc_tm_data_received(..,resp). > If nfc_tm_data_received() failed, the callee will free the resp via > kfree_skb() and return error. But in the exit branch, the resp > will be freed again. > > My patch sets resp to NULL if nfc_tm_data_received() failed, to > avoid the double free. > > [...] Here is the summary with links: - net:nfc:digital: Fix a double free in digital_tg_recv_dep_req https://git.kernel.org/netdev/net-next/c/75258586793e You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c index 5971fb6f51cc..dc21b4141b0a 100644 --- a/net/nfc/digital_dep.c +++ b/net/nfc/digital_dep.c @@ -1273,6 +1273,8 @@ static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg, } rc = nfc_tm_data_received(ddev->nfc_dev, resp); + if (rc) + resp = NULL; exit: kfree_skb(ddev->chaining_skb);
In digital_tg_recv_dep_req, it calls nfc_tm_data_received(..,resp). If nfc_tm_data_received() failed, the callee will free the resp via kfree_skb() and return error. But in the exit branch, the resp will be freed again. My patch sets resp to NULL if nfc_tm_data_received() failed, to avoid the double free. Fixes: 1c7a4c24fbfd9 ("NFC Digital: Add target NFC-DEP support") Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn> --- net/nfc/digital_dep.c | 2 ++ 1 file changed, 2 insertions(+)