aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBelgin Stirbu <belginstirbu@hotmail.com>2022-02-04 10:15:57 +0100
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-02-04 10:34:26 +0100
commit23221b4919823b642026aea117c1228c152d9d57 (patch)
tree203b1d4f70fce7072f970fb676bb3c4ff3476fac
parent2ceaa01eb4576f500cfa06fc16ece9c176f509ff (diff)
downloadhardware_replicant_libsamsung-ipc-23221b4919823b642026aea117c1228c152d9d57.tar.gz
hardware_replicant_libsamsung-ipc-23221b4919823b642026aea117c1228c152d9d57.tar.bz2
hardware_replicant_libsamsung-ipc-23221b4919823b642026aea117c1228c152d9d57.zip
devices: generic: generic_poll: Fix unitialized pollfd struct fields.GNUtoo/history/04-02-2022-after-pollfd-fix
Before that fix, ipc-modem would sometimes hang in generic_poll. Sometimes it would hang a lot and stop hanging after a reboot of the Galaxy SIII (GT-I9300), and sometimes that bug was really hard to reproduce. Here is the log of when it happens. It hangs at the end: # ipc-modem start --pin=1234 --debug --call=06xxxxxxxx [I] Got SIM PIN! [I] Got call number! [I] Debug enabled [0] Starting modem on FMT client [D] ENTER generic_data_create [D] generic_data_create DONE [D] ENTER generic_boot [D] Starting generic modem boot Bus 001 Device 002: ID 1519:0020 Comneon HSIC Device Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub [D] open_android_modem_partition_by_name: Trying to open /dev/disk/by-partlabel/RADIO [D] generic_boot: Opened the RADIO partition [D] Mapped modem image data to memory [D] ENTER xmm626_kernel_linux_modem_hci_power [D] xmm626_kernel_linux_modem_hci_power: DONE [D] Turned the modem off [D] generic_boot: xmm626_kernel_linux_modem_power(NULL, 1) = 0 [D] ENTER xmm626_kernel_linux_modem_hci_power [D] xmm626_kernel_linux_modem_hci_power: DONE [D] generic_boot: xmm626_kernel_linux_modem_hci_power(client, 1) = 0 [D] Turned the modem on Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub [D] Opened modem boot device [D] Wrote ATAT in ASCII [D] Read chip id (0x16) [D] Wrote PSI header [D] Wrote PSI, CRC is 0xc8 [D] Wrote PSI CRC (0xc8) [D] Read PSI CRC ACK [D] Read PSI ACK [D] Sent XMM626 HSIC PSI [D] Wrote EBL size [D] Wrote EBL, CRC is 0xb5 [D] Wrote EBL CRC (0xb5) [D] Sent XMM626 HSIC EBL [D] Read port config [D] Sent XMM626 HSIC port config [D] Sent XMM626 HSIC SEC start [D] Sent XMM626 HSIC firmware [D] Checked nv_data path [D] Checked nv_data md5 path [D] Calculated nv_data md5: 7f6d593d706cf196f16c4ea9efdcf49f [D] Read nv_data md5: 7f6d593d706cf196f16c4ea9efdcf49f [D] Checked nv_data backup path [D] Loaded nv_data [D] Sent XMM626 HSIC nv_data [D] Sent XMM626 HSIC SEC end [D] Sent XMM626 HSIC HW reset [D] Waited for host wake [D] ENTER xmm626_kernel_linux_modem_hci_power [D] xmm626_kernel_linux_modem_hci_power: DONE [D] Turned off the modem [D] Waited for host wake [D] ENTER xmm626_kernel_linux_modem_hci_power [D] xmm626_kernel_linux_modem_hci_power: DONE [D] Turned the modem on Bus 001 Device 002: ID 1519:0020 Comneon HSIC Device Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub [D] Wait for the modem to come up again Bus 001 Device 002: ID 1519:0020 Comneon HSIC Device Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub [D] generic_boot complete [D] generic_boot DONE [D] ENTER generic_open [D] ENTER xmm626_kernel_linux_modem_open [D] xmm626_kernel_linux_modem_open: client type: FMT [D] EXIT xmm626_kernel_linux_modem_open [D] generic_open DONE [D] ENTER generic_power_on: dummy function [1] Starting modem_read_loop on FMT client [D] ENTER generic_poll [D] generic_poll: poll: 1 [D] ENTER generic_read [D] generic_read DONE [D] xmm626_kernel_smdk4412_fmt_recv: Received FMT message [D] xmm626_kernel_smdk4412_fmt_recv: Message: aseq=0xff, command=IPC_DISP_RSSI_INFO, type=IPC_TYPE_NOTI, size=1 [D] ================================= IPC FMT data ================================= [D] [0000] 45 E [D] ================================================================================ [D] ENTER generic_poll With the current code, only the 'fd' field of the pollfd 'fd' variable is set, so events and revents are unitialized. And since it blocks at generic_poll, this commit can hopefuly fix that issue. Signed-off-by: Belgin Stirbu <belginstirbu@hotmail.com> GNUtoo: commit message Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--samsung-ipc/devices/generic/generic.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/samsung-ipc/devices/generic/generic.c b/samsung-ipc/devices/generic/generic.c
index 31fbbea..0cf25d9 100644
--- a/samsung-ipc/devices/generic/generic.c
+++ b/samsung-ipc/devices/generic/generic.c
@@ -692,6 +692,8 @@ int generic_poll(__attribute__((unused)) struct ipc_client *client,
int rc;
struct pollfd fd;
+ memset(&fd, 0, sizeof(fd));
+
#if GENERIC_DEBUG
ipc_client_log(client, "ENTER %s", __func__);
#endif