From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.213 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796406452; b=GMQwr0k26MHFCEZmUJrGXZScISluEdWazj4ZrwdeCyXqc7rhdrom7FI+dL83Ngyf5NXc r9BtfP6z87dWmuCuU6L4FD5+lju0doPgWEMpZ7W15ju/Vvl3MLBgcsDiNSQzpN+jZ86C0 RUwQjPJ68MuuHLLtWhuYHF9SHi/XWi0OGzDl4U3Izm0u8sOWm2vp1FCSFaBXgnzcJqKyj ungrss5gyCu9+tNIf0pjOLpUWwgDVqGPdiagJS8t/X5Hh/mpCdlVbIOKoIvlgJ06lTYuy shxrMHzeqAhVd8Y+5jRHjZeMf9iI3RUhSCnlnIo9vmUGox+cSXusxDlaYvSuf0PxIOA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796406452; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=orQUvwarKzz78DPDTzByjjv3g6IwfuCgfe8HzK8jNq0=; b=QN/XOCCkj/qOUldCoUOHU89Ib+B1ETmdCOb9q6VXyQkLD+Lnl9htXaQW+quI6ZQvhFYb cQcGSonXSxUtqqQikgJIcJdflKBUtprkuuma0f9xapGnulFHNuqXWS5WsFnQ2R5ajdtN7 gVPwqQSEP+moOKKrNJdOa3T+pON/K+qSz5XU2GbbICt+fokrf1Jv2nkGvu3O6uKwno2vx BIhNsFYK2EGPriMNuG+gBbziNWN6HX0NGaK46RWorP30dOn04N5jcKrJ7OiM3458B2mF/ YYi5eGCOl0/WFYpMqvPGs5Ry5uRq1eGpgzCb3aQejBKLizOESlMCUCXUsKLxFJspHwA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Vvbi0tey; arc=none smtp.remote-ip=95.215.58.213 Received: from mta1.migadu.com (out-213.mta1.migadu.com [95.215.58.213]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF818606A322 for ; Fri, 4 Dec 2026 17:47:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CF818606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Vvbi0tey X-Envelope-To: netdev@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=HBlMQaM3B+N4dca+GxhTRIajappt7qn1wHlXKA2dfRU=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796406448; v=1; x=1797011248; b=Vvbi0teytnKjxu4vYpmcEDeFTs8RoCpkH9l73l5AFcgcuzrAddOQ5BNSgGFA9exRqNartR1A QUhQhCGHsP+ZP2JAryvXuVx3B250p5K0tzhemG3nsuSwQW5/C0092uBEmzDKzQZYcaeR2GSQ9/l nfZNuqqQAqgBTABkj+iELao0= X-Envelope-To: netdev@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 2148cb658fb1e13a; Fri, 04 Dec 2026 17:47:28 +0000 X-Mizu-Trace-ID: 2148cb658fb1e13a X-Migadu-Flow: FLOW_OUT Message-ID: <860a764d-089c-4fda-919e-740d5b61f095@linux.dev> Date: Fri, 4 Dec 2026 17:47:26 +0000 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 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net] dpll: do not overwrite extack messages set by drivers To: Ivan Vecera , netdev@vger.kernel.org Cc: Sashiko , Arkadiusz Kubalewski , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Simon Horman , Aleksandr Loktionov , Przemek Kitszel , Milena Olech References: <20261204155246.425636-1-ivecera@redhat.com> Content-Language: en-US From: Vadim Fedorenko In-Reply-To: <20261204155246.425636-1-ivecera@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 04/12/2026 15:52, Ivan Vecera wrote: > 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 Reviewed-by: Vadim Fedorenko