From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796399578; b=5kpg3Z6egO3sBgkKq3k9VAG9C6qrpAT6AyW1r3BlfmHBzxiBoQmK/pX6jPuRRFUlp0Dz 4XLVqDWHpClzMZri2oDe8Ul2xNZ8U5RhW/2xIqhPFAKX9lKEIY0PWjQaPR6ctTaWwfNvK 1EjoXawJvrPm4xy87v1u/UGLwE99Sgez4AYU7Ip5V8yCazz7e6wJUouDh2hRLGyG6qtXM vI1Bdnvx7cSbqB0OEsRZ4DYQ41bdCNeZgbV49HIaeg2tzOTi1DCcLUYlV940Y8Cyhs+QV EBxpwnQ6qA/FQHRC9+AIE4zClcO3GIV4GVX02yH1QBJvx7DngLxVtOu27HegWOw40mA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796399578; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:From:To:Cc:Subject:Date: Message-ID:MIME-Version:Content-Transfer-Encoding:X-Scanned-By; bh=H/c+oWSyBmwsBnPmEMu4iFKQaUIiKy219IfIhkr7YOM=; b=2+SfiPYKdJ71PZSGdK5WQ9/mwTOJQ6Fw5jOM1YbV7YmCvLmm9y15IMNKZSrlLVWv1l28 Iq0l7oCNM+cMGmKkxJRrFGUR32NdAoE805rP4tzO5EMAr/9qIj8T5faFscgvt7rrhGqQc ol+cIj/V2V5Yi9gsRCl0OAjRmMlrUvE59SOnlGX6FNaxsuSRlhgMg58GgWcXa3MowHv1C F+w/v1Ebv0x39rYo3GWh08qhPHzUqcQusZEH4l6RhLShyo9M0gfWmq+UV8WfNprlTmEiW ubzOgbq7PWwy0gaJB+RqxbduVpGYQ+gGVtyCJ9ezAbkUeXIxi2ZiXZEHLEIRK4YvRcA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CyAiDaIX; arc=none smtp.remote-ip=170.10.129.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43D47606A32C for ; Fri, 4 Dec 2026 15:52:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 43D47606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CyAiDaIX DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796399578; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=H/c+oWSyBmwsBnPmEMu4iFKQaUIiKy219IfIhkr7YOM=; b=CyAiDaIXkd3W7GUkwIFtyRUfeg8cHpvVXUkqOsIKz/DfYPmsCqFyZ4Hn1hI9JRfSaLg9XQ BWfX7pcskNp4/FbaU9BUefCRXLYyWqdIuMNNb+p78lUeWcUCdosNyvTKlgUNKlrMuTf10m DhJy+/8/AUCg65qVgMiVA2lTeduapsI= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-663-iskGbCYENDawfBt2JzK25A-1; Fri, 4 Dec 2026 15:52:53 +0000 X-MC-Unique: iskGbCYENDawfBt2JzK25A-1 X-Mimecast-MFC-AGG-ID: iskGbCYENDawfBt2JzK25A_1796399572 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8AC42188C34F; Fri, 4 Dec 2026 15:52:51 +0000 (UTC) Received: from ivecera-thinkpadp16vgen1.tpbc.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BA2DE1954236; Fri, 4 Dec 2026 15:52:47 +0000 (UTC) From: Ivan Vecera To: netdev@vger.kernel.org Cc: Sashiko , Vadim Fedorenko , Arkadiusz Kubalewski , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Simon Horman , Aleksandr Loktionov , Przemek Kitszel , Milena Olech Subject: [PATCH net] dpll: do not overwrite extack messages set by drivers Date: Fri, 4 Dec 2026 16:52:45 +0100 Message-ID: <20261204155246.425636-1-ivecera@redhat.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 When the frequency_set(), esync_set(), ref_sync_set() or phase_adjust_set() pin callback fails, the DPLL core sets its own generic message like "frequency set failed for dpll_id:N" with NL_SET_ERR_MSG_FMT(). This replaces any message set by the driver, so userspace never sees why the driver rejected the request, e.g. the zl3073x reasons for an invalid output frequency or reference sync pair, or the ice admin queue status. Add NL_SET_ERR_MSG_FMT_WEAK(), a formatted variant of NL_SET_ERR_MSG_WEAK() that sets the message only if none is set yet, and use it for these generic messages. The other set callbacks already return the driver error without a message of their own. Discovered by an AI code review agent (Sashiko) and confirmed by code inspection. Tested on a GNR-D system with a ZL80132B DPLL by setting the P-pin of an N-div output to 1 Hz, which leaves no valid frequency for its N-pin: the reply carried "frequency set failed for dpll_id:12" before the fix and "OUT8N freq must be at most half of OUT8P freq" with it. The new macro was also checked in a userspace test built from the netlink.h macros: a message set before is kept, otherwise the generic one is set. Fixes: d7fbc0b7e846 ("dpll: netlink/core: add support for pin-dpll signal phase offset/adjust") Fixes: 20f6677234d8 ("dpll: netlink/core: change pin frequency set behavior") Fixes: cda1fba15cb2 ("dpll: add Embedded SYNC feature for a pin") Fixes: 58256a26bfb3 ("dpll: add reference sync get/set") Reported-by: Sashiko Closes: https://sashiko.dev/#/bug/linux-06bba4c1-85c2-43b9-9d63-a2d615540f64 Signed-off-by: Ivan Vecera --- drivers/dpll/dpll_netlink.c | 24 ++++++++++++------------ include/linux/netlink.h | 7 +++++++ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/dpll/dpll_netlink.c b/drivers/dpll/dpll_netlink.c index e5380d95f238b3..422e3fa3a632a8 100644 --- a/drivers/dpll/dpll_netlink.c +++ b/drivers/dpll/dpll_netlink.c @@ -1132,9 +1132,9 @@ dpll_pin_freq_set(struct dpll_pin *pin, struct nlattr *a, ret = ops->frequency_set(pin, dpll_pin_on_dpll_priv(dpll, pin), dpll, dpll_priv(dpll), freq, extack); if (ret) { - NL_SET_ERR_MSG_FMT(extack, - "frequency set failed for dpll_id:%u", - dpll->id); + NL_SET_ERR_MSG_FMT_WEAK(extack, + "frequency set failed for dpll_id:%u", + dpll->id); return ret; } __dpll_pin_change_ntf(pin); @@ -1186,9 +1186,9 @@ dpll_pin_esync_set(struct dpll_pin *pin, struct nlattr *a, ret = ops->esync_set(pin, dpll_pin_on_dpll_priv(dpll, pin), dpll, dpll_priv(dpll), freq, extack); if (ret) { - NL_SET_ERR_MSG_FMT(extack, - "embedded sync frequency set failed for dpll_id: %u", - dpll->id); + NL_SET_ERR_MSG_FMT_WEAK(extack, + "embedded sync frequency set failed for dpll_id: %u", + dpll->id); return ret; } __dpll_pin_change_ntf(pin); @@ -1250,9 +1250,9 @@ dpll_pin_ref_sync_state_set(struct dpll_pin *pin, ret = ops->ref_sync_set(pin, pin_priv, ref_sync_pin, ref_sync_pin_priv, state, extack); if (ret) { - NL_SET_ERR_MSG_FMT(extack, - "reference sync set failed for dpll_id:%u", - dpll->id); + NL_SET_ERR_MSG_FMT_WEAK(extack, + "reference sync set failed for dpll_id:%u", + dpll->id); return ret; } __dpll_pin_change_ntf(pin); @@ -1462,9 +1462,9 @@ dpll_pin_phase_adj_set(struct dpll_pin *pin, struct nlattr *phase_adj_attr, ret = ops->phase_adjust_set(pin, dpll_pin_on_dpll_priv(dpll, pin), dpll, dpll_priv(dpll), phase_adj, extack); if (ret) { - NL_SET_ERR_MSG_FMT(extack, - "phase adjust set failed for dpll_id:%u", - dpll->id); + NL_SET_ERR_MSG_FMT_WEAK(extack, + "phase adjust set failed for dpll_id:%u", + dpll->id); return ret; } __dpll_pin_change_ntf(pin); diff --git a/include/linux/netlink.h b/include/linux/netlink.h index b4eb873850e752..18e05f81e33e0b 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -143,6 +143,13 @@ struct netlink_ext_ack { NL_SET_ERR_MSG_MOD((extack), msg); \ } while (0) +#define NL_SET_ERR_MSG_FMT_WEAK(extack, fmt, args...) do { \ + struct netlink_ext_ack *__extack_weak = (extack); \ + \ + if (__extack_weak && !__extack_weak->_msg) \ + NL_SET_ERR_MSG_FMT(__extack_weak, fmt, ##args); \ +} while (0) + #define NL_SET_BAD_ATTR_POLICY(extack, attr, pol) do { \ if ((extack)) { \ (extack)->bad_attr = (attr); \ base-commit: 3c8881ee98069d3c8a1a0ad1fd6efd726e466297 -- 2.56.1