]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mctp: return -ENOPROTOOPT for unknown getsockopt options
authorAlok Tiwari <alok.a.tiwari@oracle.com>
Tue, 2 Sep 2025 10:20:55 +0000 (03:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Sep 2025 16:58:13 +0000 (18:58 +0200)
[ Upstream commit a125c8fb9ddbcb0602103a50727a476fd30dec01 ]

In mctp_getsockopt(), unrecognized options currently return -EINVAL.
In contrast, mctp_setsockopt() returns -ENOPROTOOPT for unknown
options.

Update mctp_getsockopt() to also return -ENOPROTOOPT for unknown
options. This aligns the behavior of getsockopt() and setsockopt(),
and matches the standard kernel socket API convention for handling
unsupported options.

Fixes: 99ce45d5e7db ("mctp: Implement extended addressing")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Link: https://patch.msgid.link/20250902102059.1370008-1-alok.a.tiwari@oracle.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/mctp/af_mctp.c

index 70aeebfc4182e12d07065d3f040b35c35918733c..9a552569143bbf9d4cd306433bc2ae4bf83f93c3 100644 (file)
@@ -346,7 +346,7 @@ static int mctp_getsockopt(struct socket *sock, int level, int optname,
                return 0;
        }
 
-       return -EINVAL;
+       return -ENOPROTOOPT;
 }
 
 /* helpers for reading/writing the tag ioc, handling compatibility across the