summaryrefslogtreecommitdiff
path: root/net/mctp
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-08-20 20:42:41 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-08-20 20:42:41 +0300
commit5c40cd7db64a2949f268d7467b9be551a565d14b (patch)
treefb8a67f6edcb0c9922c256a598d675c1c04051d6 /net/mctp
parent8bde384a2090759efc9b92f34300887d418a2a3a (diff)
parent25bf10be219d37d2fb221c93816a913f5f735530 (diff)
downloadlinux-rolling-stable.tar.xz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/mctp')
-rw-r--r--net/mctp/device.c4
-rw-r--r--net/mctp/neigh.c5
2 files changed, 6 insertions, 3 deletions
diff --git a/net/mctp/device.c b/net/mctp/device.c
index 7c0dcf3df319..4d404edd7446 100644
--- a/net/mctp/device.c
+++ b/net/mctp/device.c
@@ -120,8 +120,8 @@ static int mctp_dump_addrinfo(struct sk_buff *skb, struct netlink_callback *cb)
int ifindex = 0, rc;
/* Filter by ifindex if a header is provided */
- if (cb->nlh->nlmsg_len >= nlmsg_msg_size(sizeof(*hdr))) {
- hdr = nlmsg_data(cb->nlh);
+ hdr = nlmsg_payload(cb->nlh, sizeof(*hdr));
+ if (hdr) {
ifindex = hdr->ifa_index;
} else {
if (cb->strict_check) {
diff --git a/net/mctp/neigh.c b/net/mctp/neigh.c
index 590f642413e4..05b899f22d90 100644
--- a/net/mctp/neigh.c
+++ b/net/mctp/neigh.c
@@ -250,7 +250,10 @@ static int mctp_rtm_getneigh(struct sk_buff *skb, struct netlink_callback *cb)
int idx;
} *cbctx = (void *)cb->ctx;
- ndmsg = nlmsg_data(cb->nlh);
+ ndmsg = nlmsg_payload(cb->nlh, sizeof(*ndmsg));
+ if (!ndmsg)
+ return -EINVAL;
+
req_ifindex = ndmsg->ndm_ifindex;
idx = 0;