From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA0CA426299; Sat, 28 Feb 2026 17:46:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300786; cv=none; b=luRcFTsahPtNWLqJQLYTsEWUL00sgDmHl1FdXQIrKtq5VRy6pjA6gtHQxUL0JuavZrTGKZwDTUbEc0fanhE/1YcvKmsKIFQbZZ53yQLwhYw/G1/rqpqY90T09IaLKqapPf75eLWxLa5BuEMB8WRMq+1RUC8V9K6NghvH3Mz0PPM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300786; c=relaxed/simple; bh=0b1vuObYsEZ9ud6Aegk2XNO6ah6NuCR4+PMJ1tMhXag=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FvHlSA1HZj4/IWzLC4sCTIDsnpPBJbf68cx+Qx7fku06+ZJVb+iiG2pWdh69HM2HpeTDC7nKUD8OOTjddBZ0jA6TPbi+PqWF+W+kos9JTWKgRlm1D5bFEFzzW6cgDFe7L2ztB/GbE+rGh/WLwHtnQBQOpdqo6FkABjon7vc3KHs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qRlxaI6n; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qRlxaI6n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3564C19423; Sat, 28 Feb 2026 17:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772300786; bh=0b1vuObYsEZ9ud6Aegk2XNO6ah6NuCR4+PMJ1tMhXag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qRlxaI6ngstsn+idFa4pWroCkqYYrPWgNpYIA/c1gnK8Nap8DikJniDY3sr0RiU22 5sE+nM4ys98fi5Zcj8QKR1uwuVgEHCCKTCyIYBB7zuwoSb+201Zw9vStT0Fy2VMGu9 J5eIHrYAkwX49/Jpzd2q0+fzq4dwHhnhPsPJGADHMxtRBNVjkYAbIDHuewDhDSURgU 2SwzgO4HJzQlqQhg49YCaT2pd/TA0vs6QYnYbZOHUok3jmdQFzleFAlUgVyeUG/MHk b/1TAtLNnPGxVGyjooyu3BhyRDEdhuAtToRq0ajupTHg0H8FhXOSXNql4myvfF4mKx bwIksD1/wERbw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , Gabriel Krisman Bertazi , Jens Axboe , Sasha Levin Subject: [PATCH 6.19 818/844] io_uring/cmd_net: fix too strict requirement on ioctl Date: Sat, 28 Feb 2026 12:32:11 -0500 Message-ID: <20260228173244.1509663-819-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228173244.1509663-1-sashal@kernel.org> References: <20260228173244.1509663-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Asbjørn Sloth Tønnesen [ Upstream commit 600b665b903733bd60334e86031b157cc823ee55 ] Attempting SOCKET_URING_OP_SETSOCKOPT on an AF_NETLINK socket resulted in an -EOPNOTSUPP, as AF_NETLINK doesn't have an ioctl in its struct proto, but only in struct proto_ops. Prior to the blamed commit, io_uring_cmd_sock() only had two cmd_op operations, both requiring ioctl, thus the check was warranted. Since then, 4 new cmd_op operations have been added, none of which depend on ioctl. This patch moves the ioctl check, so it only applies to the original operations. AFAICT, the ioctl requirement was unintentional, and it wasn't visible in the blamed patch within 3 lines of context. Cc: stable@vger.kernel.org Fixes: a5d2f99aff6b ("io_uring/cmd: Introduce SOCKET_URING_OP_GETSOCKOPT") Signed-off-by: Asbjørn Sloth Tønnesen Reviewed-by: Gabriel Krisman Bertazi Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- io_uring/cmd_net.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/io_uring/cmd_net.c b/io_uring/cmd_net.c index 19d3ce2bd20ad..3db34e2d22ee5 100644 --- a/io_uring/cmd_net.c +++ b/io_uring/cmd_net.c @@ -159,16 +159,19 @@ int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags) struct proto *prot = READ_ONCE(sk->sk_prot); int ret, arg = 0; - if (!prot || !prot->ioctl) - return -EOPNOTSUPP; - switch (cmd->cmd_op) { case SOCKET_URING_OP_SIOCINQ: + if (!prot || !prot->ioctl) + return -EOPNOTSUPP; + ret = prot->ioctl(sk, SIOCINQ, &arg); if (ret) return ret; return arg; case SOCKET_URING_OP_SIOCOUTQ: + if (!prot || !prot->ioctl) + return -EOPNOTSUPP; + ret = prot->ioctl(sk, SIOCOUTQ, &arg); if (ret) return ret; -- 2.51.0