]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
isdn: mISDN: hfcsusb: Fix possible null-pointer dereferences in start_isoc_chain()
authorJia-Ju Bai <baijiaju1990@gmail.com>
Fri, 26 Jul 2019 08:27:36 +0000 (16:27 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 17 Sep 2019 16:02:18 +0000 (18:02 +0200)
commitf90f5642765818769251e9402948f3a2576671f0
tree5e8ac5138b3acaa22d306fa1961a158d89899bde
parent1574a6284b4acb39879aa50463af2430bfaac317
isdn: mISDN: hfcsusb: Fix possible null-pointer dereferences in start_isoc_chain()

BugLink: https://bugs.launchpad.net/bugs/1842114
[ Upstream commit a0d57a552b836206ad7705a1060e6e1ce5a38203 ]

In start_isoc_chain(), usb_alloc_urb() on line 1392 may fail
and return NULL. At this time, fifo->iso[i].urb is assigned to NULL.

Then, fifo->iso[i].urb is used at some places, such as:
LINE 1405:    fill_isoc_urb(fifo->iso[i].urb, ...)
                  urb->number_of_packets = num_packets;
                  urb->transfer_flags = URB_ISO_ASAP;
                  urb->actual_length = 0;
                  urb->interval = interval;
LINE 1416:    fifo->iso[i].urb->...
LINE 1419:    fifo->iso[i].urb->...

Thus, possible null-pointer dereferences may occur.

To fix these bugs, "continue" is added to avoid using fifo->iso[i].urb
when it is NULL.

These bugs are found by a static analysis tool STCheck written by us.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/isdn/hardware/mISDN/hfcsusb.c