090-CVE-2013-1763.patch 997 B

123456789101112131415161718192021222324252627
  1. From 6e601a53566d84e1ffd25e7b6fe0b6894ffd79c0 Mon Sep 17 00:00:00 2001
  2. From: Mathias Krause <minipli@googlemail.com>
  3. Date: Sat, 23 Feb 2013 01:13:47 +0000
  4. Subject: sock_diag: Fix out-of-bounds access to sock_diag_handlers[]
  5. Userland can send a netlink message requesting SOCK_DIAG_BY_FAMILY
  6. with a family greater or equal then AF_MAX -- the array size of
  7. sock_diag_handlers[]. The current code does not test for this
  8. condition therefore is vulnerable to an out-of-bound access opening
  9. doors for a privilege escalation.
  10. Signed-off-by: Mathias Krause <minipli@googlemail.com>
  11. Acked-by: Eric Dumazet <edumazet@google.com>
  12. Signed-off-by: David S. Miller <davem@davemloft.net>
  13. ---
  14. --- a/net/core/sock_diag.c
  15. +++ b/net/core/sock_diag.c
  16. @@ -126,6 +126,9 @@ static int __sock_diag_rcv_msg(struct sk
  17. if (nlmsg_len(nlh) < sizeof(*req))
  18. return -EINVAL;
  19. + if (req->sdiag_family >= AF_MAX)
  20. + return -EINVAL;
  21. +
  22. hndl = sock_diag_lock_handler(req->sdiag_family);
  23. if (hndl == NULL)
  24. err = -ENOENT;