aboutsummaryrefslogtreecommitdiffstats
path: root/net/mctp/device.c
diff options
context:
space:
mode:
authorJakub Kicinski <[email protected]>2025-05-15 18:22:32 +0000
committerJakub Kicinski <[email protected]>2025-05-15 18:28:30 +0000
commitbebd7b262638af611a0e699ba37c43ec2238801b (patch)
tree361c8116078d4923b630a5bff78614d136ba5716 /net/mctp/device.c
parentnet: prestera: Use to_delayed_work() (diff)
parentMerge tag 'net-6.15-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/net... (diff)
downloadkernel-bebd7b262638af611a0e699ba37c43ec2238801b.tar.gz
kernel-bebd7b262638af611a0e699ba37c43ec2238801b.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR (net-6.15-rc7). Conflicts: tools/testing/selftests/drivers/net/hw/ncdevmem.c 97c4e094a4b2 ("tests/ncdevmem: Fix double-free of queue array") 2f1a805f32ba ("selftests: ncdevmem: Implement devmem TCP TX") https://lore.kernel.org/[email protected] Adjacent changes: net/core/devmem.c net/core/devmem.h 0afc44d8cdf6 ("net: devmem: fix kernel panic when netlink socket close after module unload") bd61848900bf ("net: devmem: Implement TX path") Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/mctp/device.c')
-rw-r--r--net/mctp/device.c15
1 files changed, 11 insertions, 4 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;
+ int ifindex = 0, rc;
- hdr = nlmsg_data(cb->nlh);
- // filter by ifindex if requested
- ifindex = hdr->ifa_index;
+ /* 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) {