summaryrefslogtreecommitdiff
path: root/net/mctp/device.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2025-05-21 08:42:51 +0200
committerIngo Molnar <mingo@kernel.org>2025-05-21 08:45:03 +0200
commit412751aa6991501d7defeadecfede59043d1b5e8 (patch)
treeee5026e79128dd4eacb935f76564d7dcc105b24f /net/mctp/device.c
parente95534e107d2e9e136aa4d7cbededb3827e80074 (diff)
parenta5806cd506af5a7c19bcd596e4708b5c464bfd21 (diff)
Merge tag 'v6.15-rc7' into x86/core, to pick up fixes
Pick up build fixes from upstream to make this tree more testable. Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'net/mctp/device.c')
-rw-r--r--net/mctp/device.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/net/mctp/device.c b/net/mctp/device.c
index 8e0724c56723..7c0dcf3df319 100644
--- a/net/mctp/device.c
+++ b/net/mctp/device.c
@@ -117,11 +117,18 @@ static int mctp_dump_addrinfo(struct sk_buff *skb, struct netlink_callback *cb)
struct net_device *dev;
struct ifaddrmsg *hdr;
struct mctp_dev *mdev;
- int ifindex, rc;
-
- hdr = nlmsg_data(cb->nlh);
- // filter by ifindex if requested
- ifindex = hdr->ifa_index;
+ 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);
+ ifindex = hdr->ifa_index;
+ } else {
+ if (cb->strict_check) {
+ NL_SET_ERR_MSG(cb->extack, "mctp: Invalid header for addr dump request");
+ return -EINVAL;
+ }
+ }
rcu_read_lock();
for_each_netdev_dump(net, dev, mcb->ifindex) {