Skip to contentSkip to conversation

gobex: Fix read from pointer after free

PATCH In review Tedd Ho-Jeong An 2 participants 2 messages Feb 18, 2022 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gobex: Fix read from pointer after free

From: Tedd Ho-Jeong An <[email protected]>

This patch sets the pointer to null after free since the g_free(p) doesn't set the pointer to NULL.

This is reported by the Coverity.

Fixes 7e7d826aa1db ("gobex: Print error if data cannot be written")
---
 gobex/gobex.c | 2 ++
 1 file changed, 2 insertions(+)
gobex/gobex.c +2 -0
index 185eed4d7..e9b89cead 100644
@@ -471,6 +471,8 @@ encode:
 				check_srm_final(obex,
 						obex->tx_buf[0] & ~FINAL_BIT);
 			pending_pkt_free(p);
+			/* g_free() doesn't set the pointer to NULL */
+			p = NULL;
 		}
 
 		obex->tx_data = len;
Signature · 1 line
2.25.1
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=615864

---Test result---

Test Summary:

CheckPatch                    FAIL      1.51 seconds
GitLint                       PASS      1.03 seconds
Prep - Setup ELL              PASS      39.27 seconds
Build - Prep                  PASS      0.71 seconds
Build - Configure             PASS      8.01 seconds
Build - Make                  PASS      1327.50 seconds
Make Check                    PASS      11.31 seconds
Make Check w/Valgrind         PASS      405.40 seconds
Make Distcheck                PASS      213.79 seconds
Build w/ext ELL - Configure   PASS      8.08 seconds
Build w/ext ELL - Make        PASS      1305.72 seconds
Incremental Build with patchesPASS      0.00 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[BlueZ] gobex: Fix read from pointer after free
WARNING:UNKNOWN_COMMIT_ID: Unknown commit id '7e7d826aa1db', maybe rebased or not pulled? #84:

Fixes 7e7d826aa1db ("gobex: Print error if data cannot be written")

/github/workspace/src/12751809.patch total: 0 errors, 1 warnings, 8 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12751809.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

---
Regards,
Linux Bluetooth