Fix the goodixmoc crash in exiting callback

The fix for goodixmoc crash in exiting callback issue.

Link: da42268911
Link: https://gitlab.freedesktop.org/libfprint/libfprint/-/issues/694

Resolves: RHEL-102592
This commit is contained in:
Kate Hsuan 2025-12-02 13:41:03 +08:00
parent 926caef244
commit 795ede62fe
7 changed files with 68 additions and 27 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,32 @@
From da42268911c3fc9f591783e0c3cdd4511930612a Mon Sep 17 00:00:00 2001
From: Benjamin Berg <benjamin@sipsolutions.net>
Date: Thu, 24 Jul 2025 08:39:54 +0200
Subject: [PATCH] goodixmoc: fix crash in exit callback handler
If the button shield command cannot be executed due to an underlying
error then resp is NULL. Avoid the crash by adding the appropriate
check.
Closes: #694
---
libfprint/drivers/goodixmoc/goodix.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libfprint/drivers/goodixmoc/goodix.c b/libfprint/drivers/goodixmoc/goodix.c
index 33e137f..659722a 100644
--- a/libfprint/drivers/goodixmoc/goodix.c
+++ b/libfprint/drivers/goodixmoc/goodix.c
@@ -1483,9 +1483,7 @@ gx_fp_exit_cb (FpiDeviceGoodixMoc *self,
gxfp_cmd_response_t *resp,
GError *error)
{
-
-
- if (resp->result >= GX_FAILED)
+ if (resp && resp->result >= GX_FAILED)
fp_dbg ("Setting power button shield failed, result: 0x%x", resp->result);
self->is_power_button_shield_on = false;
gx_fp_release_interface (self, error);
--
2.51.1

View File

@ -9,6 +9,9 @@ URL: http://www.freedesktop.org/wiki/Software/fprint/libfprint
Source0: https://gitlab.freedesktop.org/libfprint/libfprint/-/archive/v%{version}/libfprint-v%{version}.tar.gz
ExcludeArch: s390 s390x
# https://gitlab.freedesktop.org/libfprint/libfprint/-/commit/da42268911c3fc9f591783e0c3cdd4511930612a
Patch00001: 0001-goodixmoc-fix-crash-in-exit-callback-handler.patch
BuildRequires: meson
BuildRequires: gcc
BuildRequires: gcc-c++
@ -40,12 +43,20 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%package tests
Summary: Tests for the %{name} package
Requires: %{name}%{?_isa} = %{version}-%{release}
%description tests
The %{name}-tests package contains tests that can be used to verify
the functionality of the installed %{name} package.
%prep
%autosetup -S git -n libfprint-v%{version}
%build
# Include the virtual image driver for integration tests
%meson -Ddrivers=all -Dinstalled-tests=false
%meson -Ddrivers=all
%meson_build
%install
@ -73,5 +84,9 @@ developing applications that use %{name}.
%{_datadir}/gir-1.0/*.gir
%{_datadir}/gtk-doc/html/libfprint-2/
%files tests
%{_libexecdir}/installed-tests/libfprint-2/
%{_datadir}/installed-tests/libfprint-2/
%changelog
%autochangelog

5
plans/integration.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Test for libfprint
discover:
how: fmf
execute:
how: tmt

View File

@ -0,0 +1,11 @@
summary: Test for libfprint
require:
- cairo-devel
- libfprint-devel
- libfprint-tests
- umockdev-devel
- python3-cairo
- python3-gobject-base
- python3-pip
- python3-packaging
test: bash ./run-umockdev.sh

View File

@ -2,7 +2,7 @@
set -u
# Switch into the tests directory
cd source/tests || exit 1
cd /usr/share/installed-tests/libfprint-2 || exit 1
# check if we need to install additional packages
# which is the case if we are on RHEL 8
@ -14,7 +14,7 @@ if [[ "$ID" = *"rhel"* ]] && [[ "$VERSION_ID" == *"8"* ]]; then
pip3 install python-dbusmock
fi
# Each directory in source/tests is a umockdev based test
# Each directory in /usr/share/installed-tests/libfprint-2 is a umockdev based test
# discover them
declare -a TESTS=()
for f in *; do
@ -27,7 +27,7 @@ export FP_DEVICE_EMULATION=1
RESULT=0
for test in ${TESTS[@]}; do
echo "$test"
./umockdev-test.py "$test"
/usr/libexec/installed-tests/libfprint-2/umockdev-test.py "$test"
RES=$?
echo "$test finished with return code $RES"
echo ""

View File

@ -1,23 +0,0 @@
---
- hosts: localhost
roles:
- role: standard-test-source
tags:
- always
required_packages:
- git
- role: standard-test-basic
tags:
- atomic
- classic
required_packages:
- python3-dbusmock
- umockdev
tests:
- virtual_image:
dir: .
run: source/tests/virtual-image.py
- umockdev:
dir: .
run: run-umockdev.sh