__sock_diag_cmd() only validates nlmsg_len against sizeof(struct sock_diag_req) (2 bytes). smc_diag_handler_dump() schedules a dump without a further check, so the dump path reads diag_ext at offset 3 of struct smc_diag_req from uninitialised skb tailroom. Add the missing nlmsg_len guard, matching every other sock_diag handler. Fixes: f16a7dd5cf27 ("smc: netlink interface for SMC sockets") Signed-off-by: Mahanta Jambigi --- net/smc/smc_diag.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c index 15485a08d9a0..ed578279dcd0 100644 --- a/net/smc/smc_diag.c +++ b/net/smc/smc_diag.c @@ -245,6 +245,9 @@ static int smc_diag_handler_dump(struct sk_buff *skb, struct nlmsghdr *h) { struct net *net = sock_net(skb->sk); + if (nlmsg_len(h) < sizeof(struct smc_diag_req)) + return -EINVAL; + if (h->nlmsg_type == SOCK_DIAG_BY_FAMILY && h->nlmsg_flags & NLM_F_DUMP) { { -- 2.50.1 (Apple Git-155)