linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 0/1] Free ALSA seq resources in midi_device_remove()
@ 2021-11-01 13:49 Jacek Konieczny
  2021-11-01 13:49 ` [PATCH BlueZ 1/1] " Jacek Konieczny
  0 siblings, 1 reply; 4+ messages in thread
From: Jacek Konieczny @ 2021-11-01 13:49 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jacek Konieczny


I am having problem connecting via Bluetooth LE MID to my VOX Adio Air GT
guitar amplifier. I was not able to debug the connection problem yet,
but there was a bigger problem on hand: due to constant
connecting/disconnecting ALSA seq resources were leaking until
bluetoothd hung and ALSA backend crashed.

I have described a bit more in the github issue: https://github.com/bluez/bluez/issues/225

I was able to fix the leak with the following patch. I am not sure if
that is the right way to do this, though. As the relation between
midi_disconnect() and midi_device_remove() functions is not clear to me,
I have just copied some of the cleanup code from one to the other.


Jacek Konieczny (1):
  Free ALSA seq resources in midi_device_remove()

 profiles/midi/midi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH BlueZ 1/1] Free ALSA seq resources in midi_device_remove()
  2021-11-01 13:49 [PATCH BlueZ 0/1] Free ALSA seq resources in midi_device_remove() Jacek Konieczny
@ 2021-11-01 13:49 ` Jacek Konieczny
  2021-11-01 14:35   ` bluez.test.bot
  0 siblings, 1 reply; 4+ messages in thread
From: Jacek Konieczny @ 2021-11-01 13:49 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jacek Konieczny

Sometimes, on connection error, this gets called and frees the device
when midi_disconnect() was not called which would leave ALSA sequencer
objects leaking.
---
 profiles/midi/midi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/profiles/midi/midi.c b/profiles/midi/midi.c
index 737d1b5f6..f644d47e9 100644
--- a/profiles/midi/midi.c
+++ b/profiles/midi/midi.c
@@ -255,6 +255,16 @@ static void midi_device_remove(struct btd_service *service)
 		return;
 	}
 
+	if (midi->seq_handle) {
+		midi_read_free(&midi->midi_in);
+		midi_write_free(&midi->midi_out);
+		io_destroy(midi->io);
+		snd_seq_delete_simple_port(midi->seq_handle, midi->seq_port_id);
+		midi->seq_port_id = 0;
+		snd_seq_close(midi->seq_handle);
+		midi->seq_handle = NULL;
+	}
+
 	btd_device_unref(midi->dev);
 	g_free(midi);
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: Free ALSA seq resources in midi_device_remove()
  2021-11-01 13:49 ` [PATCH BlueZ 1/1] " Jacek Konieczny
@ 2021-11-01 14:35   ` bluez.test.bot
  2021-11-04  0:39     ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 4+ messages in thread
From: bluez.test.bot @ 2021-11-01 14:35 UTC (permalink / raw)
  To: linux-bluetooth, jajcus

[-- Attachment #1: Type: text/plain, Size: 884 bytes --]

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=573565

---Test result---

Test Summary:
CheckPatch                    PASS      1.43 seconds
GitLint                       PASS      0.89 seconds
Prep - Setup ELL              PASS      46.37 seconds
Build - Prep                  PASS      0.50 seconds
Build - Configure             PASS      8.57 seconds
Build - Make                  PASS      202.34 seconds
Make Check                    PASS      9.49 seconds
Make Distcheck                PASS      242.98 seconds
Build w/ext ELL - Configure   PASS      8.72 seconds
Build w/ext ELL - Make        PASS      191.05 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Free ALSA seq resources in midi_device_remove()
  2021-11-01 14:35   ` bluez.test.bot
@ 2021-11-04  0:39     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2021-11-04  0:39 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jacek Konieczny

Hi Jacek,

On Mon, Nov 1, 2021 at 7:36 AM <bluez.test.bot@gmail.com> wrote:
>
> 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=573565
>
> ---Test result---
>
> Test Summary:
> CheckPatch                    PASS      1.43 seconds
> GitLint                       PASS      0.89 seconds
> Prep - Setup ELL              PASS      46.37 seconds
> Build - Prep                  PASS      0.50 seconds
> Build - Configure             PASS      8.57 seconds
> Build - Make                  PASS      202.34 seconds
> Make Check                    PASS      9.49 seconds
> Make Distcheck                PASS      242.98 seconds
> Build w/ext ELL - Configure   PASS      8.72 seconds
> Build w/ext ELL - Make        PASS      191.05 seconds
>
>
>
> ---
> Regards,
> Linux Bluetooth

Applied, thanks.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-04  0:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-01 13:49 [PATCH BlueZ 0/1] Free ALSA seq resources in midi_device_remove() Jacek Konieczny
2021-11-01 13:49 ` [PATCH BlueZ 1/1] " Jacek Konieczny
2021-11-01 14:35   ` bluez.test.bot
2021-11-04  0:39     ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).