[6.0]sched: fix an oops when dump the qdisc of loopback device

Solution Verified - Updated -

Issue

  • The loopback device use noqueue_qdisc for qdisc, and the noqueue_qdisc's dev_queue is  noqueue_netdev_queue, but the noqueue_netdev_queue.dev is NULL.

  • When dumping the loopback device's qdisc use netlink with nlmsg_type=RTM_GETQDISC, nlmsg_flags=NLM_F_REQUEST, and tcmsg.tcm_parent = TC_H_ROOT, it will call the function tc_fill_qdisc() to get the qdisc, but in function tc_fill_qdisc(), the qdisc_dev(q)->ifindex will reference an null pointer, and causes the OOPS.

   int main(int argc, char *argv[])
   {
        struct {
                struct nlmsghdr nlmsg;
                struct tcmsg tcmsg;
        } msg;
        ...
        fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
        ...
        msg.nlmsg.nlmsg_type = RTM_GETQDISC;
        msg.nlmsg.nlmsg_flags = NLM_F_REQUESTM_F_ACK;
        msg.tcmsg.tcm_parent = TC_H_ROOT;
        send(fd, &msg, sizeof msg, 0);
        ...
   }

Environment

  • Red Hat Enterprise Linux 6.0 Snapshot10
  • Architecture: x86_64

  • Kernel Version: kernel-2.6.32-59.el6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.