git: d9a1e54cb037 - stable/13 - qlnxe: Fix error handling of SIOCGI2C ioctl
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 20 Jul 2025 14:17:30 UTC
The branch stable/13 has been updated by zlei:
URL: https://cgit.FreeBSD.org/src/commit/?id=d9a1e54cb037706f53f12b488d8288b9f951b859
commit d9a1e54cb037706f53f12b488d8288b9f951b859
Author: Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2025-07-17 04:01:16 +0000
Commit: Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-07-20 14:16:36 +0000
qlnxe: Fix error handling of SIOCGI2C ioctl
The error -1 is actually ERESTART in the context of syscall. It is for
kernel mode only and will not be passed to user mode. When the kernel
sees this error it will restart the syscall.
When the the SFP module data is not available, e.g. the SFP module is
not present, the ioctl handler returns ERESTART and kernel will retry
infinitely, hence the userland `ifconfig -v ql0` will hang forever until
get interrupted. That is apparently wrong.
Fix that by returning error ENODEV to indicate the SFP module data is
not available.
As for the case that ecore_ptt_acquire() fails, it appears to be quite
safe to restart, so keep returning ERESTART.
Reported by: Steve Wheeler
See also: https://redmine.pfsense.org/issues/16248
Reviewed by: kbowling
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D51351
(cherry picked from commit 12fea464070a9061fda874038614ed55011ad59d)
(cherry picked from commit f40f6374f3d2cfc1a99781acd5c3252e1edfe612)
---
sys/dev/qlnx/qlnxe/qlnx_os.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c
index 2422e4e26df1..fe6ccc538c26 100644
--- a/sys/dev/qlnx/qlnxe/qlnx_os.c
+++ b/sys/dev/qlnx/qlnxe/qlnx_os.c
@@ -2813,7 +2813,7 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if (!p_ptt) {
QL_DPRINT1(ha, "ecore_ptt_acquire failed\n");
- ret = -1;
+ ret = ERESTART;
break;
}
@@ -2824,7 +2824,7 @@ qlnx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
ecore_ptt_release(p_hwfn, p_ptt);
if (ret) {
- ret = -1;
+ ret = ENODEV;
break;
}