mctp: return -ENOPROTOOPT for unknown getsockopt options

[ Upstream commit a125c8fb9d ]

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: 99ce45d5e7 ("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>
This commit is contained in:
Alok Tiwari 2025-09-02 03:20:55 -07:00 committed by Greg Kroah-Hartman
parent 6f774e379d
commit 2f08df544a

View File

@ -346,7 +346,7 @@ static int mctp_getsockopt(struct socket *sock, int level, int optname,
return 0;
}
return -EINVAL;
return -ENOPROTOOPT;
}
static int mctp_ioctl_alloctag(struct mctp_sock *msk, unsigned long arg)