linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Dave Jones <davej@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>,
	Cong Wang <amwang@redhat.com>
Subject: [ 59/75] rds: limit the size allocated by rds_message_alloc()
Date: Mon, 18 Mar 2013 14:07:22 -0700	[thread overview]
Message-ID: <20130318210514.493054162@linuxfoundation.org> (raw)
In-Reply-To: <20130318210510.203500214@linuxfoundation.org>

3.8-stable review patch.  If anyone has any objections, please let me know.

------------------


From: Cong Wang <amwang@redhat.com>

[ Upstream commit ece6b0a2b25652d684a7ced4ae680a863af041e0 ]

Dave Jones reported the following bug:

"When fed mangled socket data, rds will trust what userspace gives it,
and tries to allocate enormous amounts of memory larger than what
kmalloc can satisfy."

WARNING: at mm/page_alloc.c:2393 __alloc_pages_nodemask+0xa0d/0xbe0()
Hardware name: GA-MA78GM-S2H
Modules linked in: vmw_vsock_vmci_transport vmw_vmci vsock fuse bnep dlci bridge 8021q garp stp mrp binfmt_misc l2tp_ppp l2tp_core rfcomm s
Pid: 24652, comm: trinity-child2 Not tainted 3.8.0+ #65
Call Trace:
 [<ffffffff81044155>] warn_slowpath_common+0x75/0xa0
 [<ffffffff8104419a>] warn_slowpath_null+0x1a/0x20
 [<ffffffff811444ad>] __alloc_pages_nodemask+0xa0d/0xbe0
 [<ffffffff8100a196>] ? native_sched_clock+0x26/0x90
 [<ffffffff810b2128>] ? trace_hardirqs_off_caller+0x28/0xc0
 [<ffffffff810b21cd>] ? trace_hardirqs_off+0xd/0x10
 [<ffffffff811861f8>] alloc_pages_current+0xb8/0x180
 [<ffffffff8113eaaa>] __get_free_pages+0x2a/0x80
 [<ffffffff811934fe>] kmalloc_order_trace+0x3e/0x1a0
 [<ffffffff81193955>] __kmalloc+0x2f5/0x3a0
 [<ffffffff8104df0c>] ? local_bh_enable_ip+0x7c/0xf0
 [<ffffffffa0401ab3>] rds_message_alloc+0x23/0xb0 [rds]
 [<ffffffffa04043a1>] rds_sendmsg+0x2b1/0x990 [rds]
 [<ffffffff810b21cd>] ? trace_hardirqs_off+0xd/0x10
 [<ffffffff81564620>] sock_sendmsg+0xb0/0xe0
 [<ffffffff810b2052>] ? get_lock_stats+0x22/0x70
 [<ffffffff810b24be>] ? put_lock_stats.isra.23+0xe/0x40
 [<ffffffff81567f30>] sys_sendto+0x130/0x180
 [<ffffffff810b872d>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffff816c547b>] ? _raw_spin_unlock_irq+0x3b/0x60
 [<ffffffff816cd767>] ? sysret_check+0x1b/0x56
 [<ffffffff810b8695>] ? trace_hardirqs_on_caller+0x115/0x1a0
 [<ffffffff81341d8e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
 [<ffffffff816cd742>] system_call_fastpath+0x16/0x1b
---[ end trace eed6ae990d018c8b ]---

Reported-by: Dave Jones <davej@redhat.com>
Cc: Dave Jones <davej@redhat.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
Acked-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/rds/message.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/net/rds/message.c
+++ b/net/rds/message.c
@@ -197,6 +197,9 @@ struct rds_message *rds_message_alloc(un
 {
 	struct rds_message *rm;
 
+	if (extra_len > KMALLOC_MAX_SIZE - sizeof(struct rds_message))
+		return NULL;
+
 	rm = kzalloc(sizeof(struct rds_message) + extra_len, gfp);
 	if (!rm)
 		goto out;



  parent reply	other threads:[~2013-03-18 21:07 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-18 21:06 [ 00/75] 3.8.4-stable review Greg Kroah-Hartman
2013-03-18 21:06 ` [ 01/75] qcaux: add Franklin U600 Greg Kroah-Hartman
2013-03-18 21:06 ` [ 02/75] xen/pciback: Dont disable a PCI device that is already disabled Greg Kroah-Hartman
2013-03-18 21:06 ` [ 03/75] virtio: rng: disallow multiple device registrations, fixes crashes Greg Kroah-Hartman
2013-03-18 21:06 ` [ 04/75] USB: option: add Huawei E5331 Greg Kroah-Hartman
2013-03-18 21:06 ` [ 05/75] USB: cdc-wdm: fix buffer overflow Greg Kroah-Hartman
2013-03-18 21:06 ` [ 06/75] tools: usb: ffs-test: Fix build failure Greg Kroah-Hartman
2013-03-18 21:06 ` [ 07/75] usb: dwc3: core: dont forget to free coherent memory Greg Kroah-Hartman
2013-03-18 21:06 ` [ 08/75] usb: cp210x new Vendor/Device IDs Greg Kroah-Hartman
2013-03-18 21:06 ` [ 09/75] USB: added support for Cinterions products AH6 and PLS8 Greg Kroah-Hartman
2013-03-18 21:06 ` [ 10/75] usb: serial: Add Rigblaster Advantage to device table Greg Kroah-Hartman
2013-03-18 21:06 ` [ 11/75] USB: storage: fix Huawei mode switching regression Greg Kroah-Hartman
2013-03-18 21:06 ` [ 12/75] USB: EHCI: work around silicon bug in Intels EHCI controllers Greg Kroah-Hartman
2013-03-19 16:34   ` Sven Joachim
2013-03-19 18:17     ` Alan Stern
2013-03-19 18:43       ` Sven Joachim
2013-03-19 20:10         ` Alan Stern
2013-03-19 20:28           ` Sven Joachim
2013-03-19 21:00             ` Alan Stern
2013-03-19 21:44               ` Sven Joachim
2013-03-20 20:08                 ` Greg Kroah-Hartman
2013-03-20 20:14                   ` Sven Joachim
2013-03-20 20:28                     ` Greg Kroah-Hartman
2013-03-20 20:41                       ` Alan Stern
2013-03-20 22:28                         ` Greg Kroah-Hartman
2013-03-21 14:35                           ` Alan Stern
2013-03-19 18:03   ` Stephen Warren
2013-03-18 21:06 ` [ 13/75] USB: EHCI: dont check DMA values in QH overlays Greg Kroah-Hartman
2013-03-18 21:06 ` [ 14/75] staging: vt6656: Fix oops on resume from suspend Greg Kroah-Hartman
2013-03-18 21:06 ` [ 15/75] staging: comedi: dt9812: use CR_CHAN() for channel number Greg Kroah-Hartman
2013-03-18 21:06 ` [ 16/75] qcserial: bind to DM/DIAG port on Gobi 1K devices Greg Kroah-Hartman
2013-03-18 21:06 ` [ 17/75] signal: always clear sa_restorer on execve Greg Kroah-Hartman
2013-03-18 21:06 ` [ 18/75] ext3: Fix format string issues Greg Kroah-Hartman
2013-03-18 21:06 ` [ 19/75] tty/8250_pnp: serial port detection regression since v3.7 Greg Kroah-Hartman
2013-03-18 21:06 ` [ 20/75] serial: 8250: Keep 8250.<xxxx> module options functional after driver rename Greg Kroah-Hartman
2013-03-18 21:06 ` [ 21/75] serial: 8250_pci: add support for another kind of NetMos Technology PCI 9835 Multi-I/O Controller Greg Kroah-Hartman
2013-03-18 21:06 ` [ 22/75] tty: serial: fix typo "ARCH_S5P6450" Greg Kroah-Hartman
2013-03-18 21:06 ` [ 23/75] tty: serial: fix typo "SERIAL_S3C2412" Greg Kroah-Hartman
2013-03-18 21:06 ` [ 24/75] tty/serial: Add support for Altera serial port Greg Kroah-Hartman
2013-03-18 21:06 ` [ 25/75] TTY: disable debugging warning Greg Kroah-Hartman
2013-03-18 21:06 ` [ 26/75] TTY: do not reset masters packet mode Greg Kroah-Hartman
2013-03-18 21:06 ` [ 27/75] Fix 4 port and add support for 8 port Unknown PCI serial port cards Greg Kroah-Hartman
2013-03-18 21:06 ` [ 28/75] ARM: kirkwood: fix to retain gbe MAC addresses for DT kernels Greg Kroah-Hartman
2013-03-18 21:06 ` [ 29/75] perf,x86: fix kernel crash with PEBS/BTS after suspend/resume Greg Kroah-Hartman
2013-03-18 21:11   ` Stephane Eranian
2013-03-18 21:20     ` Greg Kroah-Hartman
2013-03-18 21:35       ` Stephane Eranian
2013-03-18 23:00         ` Greg Kroah-Hartman
2013-03-18 21:06 ` [ 30/75] ALSA: seq: Fix missing error handling in snd_seq_timer_open() Greg Kroah-Hartman
2013-03-18 21:06 ` [ 31/75] ARM: w1-gpio: fix erroneous gpio requests Greg Kroah-Hartman
2013-03-18 21:06 ` [ 32/75] hwmon: (pmbus/ltc2978) Fix temperature reporting Greg Kroah-Hartman
2013-03-18 21:06 ` [ 33/75] hwmon: (lineage-pem) Add missing terminating entry for pem_[input|fan]_attributes Greg Kroah-Hartman
2013-03-18 21:06 ` [ 34/75] w1-gpio: remove erroneous __exit and __exit_p() Greg Kroah-Hartman
2013-03-18 21:06 ` [ 35/75] w1: fix oops when w1_search is called from netlink connector Greg Kroah-Hartman
2013-03-18 21:06 ` [ 36/75] powerpc: Fix STAB initialization Greg Kroah-Hartman
2013-03-18 21:07 ` [ 37/75] powerpc: Fix cputable entry for 970MP rev 1.0 Greg Kroah-Hartman
2013-03-18 21:07 ` [ 38/75] powerpc: Make VSID_BITS* dependency explicit Greg Kroah-Hartman
2013-03-18 21:07 ` [ 39/75] powerpc: Update kernel VSID range Greg Kroah-Hartman
2013-03-18 21:07 ` [ 40/75] powerpc: Rename USER_ESID_BITS* to ESID_BITS* Greg Kroah-Hartman
2013-03-18 21:07 ` [ 41/75] ARM: davinci: edma: fix dmaengine induced null pointer dereference on da830 Greg Kroah-Hartman
2013-03-19 16:25   ` Luis Henriques
     [not found]   ` <f20a6d0dd7604c0fa6ed95604a8dfb35@DLEE70.ent.ti.com>
2013-03-19 17:27     ` Matt Porter
2013-03-19 18:25       ` Luis Henriques
2013-03-18 21:07 ` [ 42/75] selinux: use GFP_ATOMIC under spin_lock Greg Kroah-Hartman
2013-03-18 21:07 ` [ 43/75] perf,x86: fix wrmsr_on_cpu() warning on suspend/resume Greg Kroah-Hartman
2013-03-18 21:07 ` [ 44/75] perf,x86: fix link failure for non-Intel configs Greg Kroah-Hartman
2013-03-18 21:07 ` [ 45/75] s390: critical section cleanup vs. machine checks Greg Kroah-Hartman
2013-03-18 21:07 ` [ 46/75] s390/mm: fix flush_tlb_kernel_range() Greg Kroah-Hartman
2013-03-18 21:07 ` [ 47/75] btrfs: use rcu_barrier() to wait for bdev puts at unmount Greg Kroah-Hartman
2013-03-18 21:07 ` [ 48/75] mtd: nand: reintroduce NAND_NO_READRDY as NAND_NEED_READRDY Greg Kroah-Hartman
2013-03-18 21:07 ` [ 49/75] kbuild: fix make headers_check with make 3.80 Greg Kroah-Hartman
2013-03-18 21:07 ` [ 50/75] atmel_lcdfb: fix 16-bpp modes on older SOCs Greg Kroah-Hartman
2013-03-18 21:07 ` [ 51/75] net/mlx4_en: Initialize RFS filters lock and list in init_netdev Greg Kroah-Hartman
2013-03-18 21:07 ` [ 52/75] net/mlx4_en: Disable RFS when running in SRIOV mode Greg Kroah-Hartman
2013-03-18 21:07 ` [ 53/75] block: use i_size_write() in bd_set_size() Greg Kroah-Hartman
2013-03-18 21:07 ` [ 54/75] loopdev: fix a deadlock Greg Kroah-Hartman
2013-03-18 21:07 ` [ 55/75] loopdev: remove an user triggerable oops Greg Kroah-Hartman
2013-03-18 21:07 ` [ 56/75] net/sctp: Validate parameter size for SCTP_GET_ASSOC_STATS Greg Kroah-Hartman
2013-03-18 21:07 ` [ 57/75] l2tp: Restore socket refcount when sendmsg succeeds Greg Kroah-Hartman
2013-03-18 21:07 ` [ 58/75] atl1c: restore buffer state Greg Kroah-Hartman
2013-03-18 21:07 ` Greg Kroah-Hartman [this message]
2013-03-18 21:07 ` [ 60/75] net: ipv6: Dont purge default router if accept_ra=2 Greg Kroah-Hartman
2013-03-18 21:07 ` [ 61/75] tcp: fix double-counted receiver RTT when leaving receiver fast path Greg Kroah-Hartman
2013-03-18 21:07 ` [ 62/75] tun: add a missing nf_reset() in tun_net_xmit() Greg Kroah-Hartman
2013-03-18 21:07 ` [ 63/75] vxlan: fix oops when delete netns containing vxlan Greg Kroah-Hartman
2013-03-18 21:07 ` [ 64/75] bonding: fire NETDEV_RELEASE event only on 0 slaves Greg Kroah-Hartman
2013-03-18 21:07 ` [ 65/75] team: unsyc the devices addresses when port is removed Greg Kroah-Hartman
2013-03-18 21:07 ` [ 66/75] macvlan: Set IFF_UNICAST_FLT flag to prevent unnecessary promisc mode Greg Kroah-Hartman
2013-03-18 21:07 ` [ 67/75] netlabel: correctly list all the static label mappings Greg Kroah-Hartman
2013-03-18 21:07 ` [ 68/75] bridging: fix rx_handlers return code Greg Kroah-Hartman
2013-03-18 21:07 ` [ 69/75] ipv6: stop multicast forwarding to process interface scoped addresses Greg Kroah-Hartman
2013-03-18 21:07 ` [ 70/75] bridge: fix mdb info leaks Greg Kroah-Hartman
2013-03-18 21:07 ` [ 71/75] rtnl: fix info leak on RTM_GETLINK request for VF devices Greg Kroah-Hartman
2013-03-18 21:07 ` [ 72/75] dcbnl: fix various netlink info leaks Greg Kroah-Hartman
2013-03-18 21:07 ` [ 73/75] 6lowpan: Fix endianness issue in is_addr_link_local() Greg Kroah-Hartman
2013-03-18 21:07 ` [ 74/75] Revert "drm/i915: enable irqs earlier when resuming" Greg Kroah-Hartman
2013-03-27 15:45   ` Ilya Tumaykin
2013-03-27 16:52     ` Daniel Vetter
2013-03-18 21:07 ` [ 75/75] Revert "drm/i915: reorder setup sequence to have irqs for output setup" Greg Kroah-Hartman
2013-03-19  0:51 ` [ 00/75] 3.8.4-stable review Shuah Khan
2013-03-19  0:57   ` Greg Kroah-Hartman
2013-03-19  1:09     ` Shuah Khan
2013-03-19  2:00       ` Greg Kroah-Hartman
2013-03-19  4:00         ` Shuah Khan
2013-03-19  4:07           ` Greg Kroah-Hartman
2013-03-19 15:51             ` Shuah Khan

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=20130318210514.493054162@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=amwang@redhat.com \
    --cc=davej@redhat.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=venkat.x.venkatsubra@oracle.com \
    /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;
as well as URLs for NNTP newsgroup(s).