diff mbox series

[v1] obex: Move size emit signal to plugins instead of obex.c

Message ID 20241017061331.2097436-1-quic_amisjain@quicinc.com (mailing list archive)
State Accepted
Commit b5b51017ea1818712137bc03d0eba49204e5bc4e
Headers show
Series [v1] obex: Move size emit signal to plugins instead of obex.c | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Amisha Jain Oct. 17, 2024, 6:13 a.m. UTC
Instead of emitting the property "Size" from obex_put_stream_start(),
Call the function manager_emit_transfer_property() from plugins/*.c
wherever plugin has transfer object present.
Remove the code from obex.c which is generic for all profiles.

This change resolves the type mismatch issue when calling the
manager_emit_transfer_property from obex.c. We are passing
'os->service_data' of plugin session type but the
manager_emit_transfer_property() expects the 'obex_transfer'
type, therefore size is not set properly and might cause
crash/disconnection.
---
 obexd/plugins/ftp.c | 5 +++++
 obexd/plugins/opp.c | 5 +++++
 obexd/src/obex.c    | 3 ---
 3 files changed, 10 insertions(+), 3 deletions(-)

Comments

bluez.test.bot@gmail.com Oct. 17, 2024, 8:03 a.m. UTC | #1
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=900075

---Test result---

Test Summary:
CheckPatch                    PASS      0.58 seconds
GitLint                       PASS      0.29 seconds
BuildEll                      PASS      24.62 seconds
BluezMake                     PASS      1607.82 seconds
MakeCheck                     PASS      12.84 seconds
MakeDistcheck                 PASS      179.74 seconds
CheckValgrind                 PASS      259.12 seconds
CheckSmatch                   PASS      386.74 seconds
bluezmakeextell               PASS      132.54 seconds
IncrementalBuild              PASS      2172.38 seconds
ScanBuild                     PASS      1212.41 seconds



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org Oct. 18, 2024, 2:10 p.m. UTC | #2
Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu, 17 Oct 2024 11:43:31 +0530 you wrote:
> Instead of emitting the property "Size" from obex_put_stream_start(),
> Call the function manager_emit_transfer_property() from plugins/*.c
> wherever plugin has transfer object present.
> Remove the code from obex.c which is generic for all profiles.
> 
> This change resolves the type mismatch issue when calling the
> manager_emit_transfer_property from obex.c. We are passing
> 'os->service_data' of plugin session type but the
> manager_emit_transfer_property() expects the 'obex_transfer'
> type, therefore size is not set properly and might cause
> crash/disconnection.
> 
> [...]

Here is the summary with links:
  - [v1] obex: Move size emit signal to plugins instead of obex.c
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b5b51017ea18

You are awesome, thank you!
diff mbox series

Patch

diff --git a/obexd/plugins/ftp.c b/obexd/plugins/ftp.c
index 874fe2b8b..6c841d207 100644
--- a/obexd/plugins/ftp.c
+++ b/obexd/plugins/ftp.c
@@ -175,6 +175,11 @@  int ftp_chkput(struct obex_session *os, void *user_data)
 
 	ret = obex_put_stream_start(os, path);
 
+	if (ret == 0 && obex_get_size(os) != OBJECT_SIZE_DELETE &&
+				obex_get_size(os) != OBJECT_SIZE_UNKNOWN) {
+		manager_emit_transfer_property(ftp->transfer, "Size");
+	}
+
 	if (ret == 0)
 		manager_emit_transfer_started(ftp->transfer);
 
diff --git a/obexd/plugins/opp.c b/obexd/plugins/opp.c
index 777f5f8ed..2220efd49 100644
--- a/obexd/plugins/opp.c
+++ b/obexd/plugins/opp.c
@@ -87,6 +87,11 @@  skip_auth:
 
 	err = obex_put_stream_start(os, path);
 
+	if (err == 0 && obex_get_size(os) != OBJECT_SIZE_DELETE &&
+				obex_get_size(os) != OBJECT_SIZE_UNKNOWN) {
+		manager_emit_transfer_property(user_data, "Size");
+	}
+
 	g_free(path);
 
 	if (err < 0)
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index 98d6245a4..370bfac9e 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -716,9 +716,6 @@  int obex_put_stream_start(struct obex_session *os, const char *filename)
 		return err;
 	}
 
-	if (os->size != OBJECT_SIZE_DELETE && os->size != OBJECT_SIZE_UNKNOWN)
-		manager_emit_transfer_property(os->service_data, "Size");
-
 	os->path = g_strdup(filename);
 
 	return 0;