mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org, "Sasha Levin" <sasha.levin@oracle.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [17/84] 9p: fix off by one causing access violations and  memory corruption
Date: Wed, 31 Jul 2013 15:23:09 +0200	[thread overview]
Message-ID: <lsq.1375276989.852780586@decadent.org.uk> (raw)
In-Reply-To: <lsq.1375276989.251749228@decadent.org.uk>

3.2.50-rc1 review patch.  If anyone has any objections, please let me know.

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

From: Sasha Levin <sasha.levin@oracle.com>

[ Upstream commit 110ecd69a9feea82a152bbf9b12aba57e6396883 ]

p9_release_pages() would attempt to dereference one value past the end of
pages[]. This would cause the following crashes:

[ 6293.171817] BUG: unable to handle kernel paging request at ffff8807c96f3000
[ 6293.174146] IP: [<ffffffff8412793b>] p9_release_pages+0x3b/0x60
[ 6293.176447] PGD 79c5067 PUD 82c1e3067 PMD 82c197067 PTE 80000007c96f3060
[ 6293.180060] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
[ 6293.180060] Modules linked in:
[ 6293.180060] CPU: 62 PID: 174043 Comm: modprobe Tainted: G        W    3.10.0-next-20130710-sasha #3954
[ 6293.180060] task: ffff8807b803b000 ti: ffff880787dde000 task.ti: ffff880787dde000
[ 6293.180060] RIP: 0010:[<ffffffff8412793b>]  [<ffffffff8412793b>] p9_release_pages+0x3b/0x60
[ 6293.214316] RSP: 0000:ffff880787ddfc28  EFLAGS: 00010202
[ 6293.214316] RAX: 0000000000000001 RBX: ffff8807c96f2ff8 RCX: 0000000000000000
[ 6293.222017] RDX: ffff8807b803b000 RSI: 0000000000000001 RDI: ffffea001c7e3d40
[ 6293.222017] RBP: ffff880787ddfc48 R08: 0000000000000000 R09: 0000000000000000
[ 6293.222017] R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000001
[ 6293.222017] R13: 0000000000000001 R14: ffff8807cc50c070 R15: ffff8807cc50c070
[ 6293.222017] FS:  00007f572641d700(0000) GS:ffff8807f3600000(0000) knlGS:0000000000000000
[ 6293.256784] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 6293.256784] CR2: ffff8807c96f3000 CR3: 00000007c8e81000 CR4: 00000000000006e0
[ 6293.256784] Stack:
[ 6293.256784]  ffff880787ddfcc8 ffff880787ddfcc8 0000000000000000 ffff880787ddfcc8
[ 6293.256784]  ffff880787ddfd48 ffffffff84128be8 ffff880700000002 0000000000000001
[ 6293.256784]  ffff8807b803b000 ffff880787ddfce0 0000100000000000 0000000000000000
[ 6293.256784] Call Trace:
[ 6293.256784]  [<ffffffff84128be8>] p9_virtio_zc_request+0x598/0x630
[ 6293.256784]  [<ffffffff8115c610>] ? wake_up_bit+0x40/0x40
[ 6293.256784]  [<ffffffff841209b1>] p9_client_zc_rpc+0x111/0x3a0
[ 6293.256784]  [<ffffffff81174b78>] ? sched_clock_cpu+0x108/0x120
[ 6293.256784]  [<ffffffff84122a21>] p9_client_read+0xe1/0x2c0
[ 6293.256784]  [<ffffffff81708a90>] v9fs_file_read+0x90/0xc0
[ 6293.256784]  [<ffffffff812bd073>] vfs_read+0xc3/0x130
[ 6293.256784]  [<ffffffff811a78bd>] ? trace_hardirqs_on+0xd/0x10
[ 6293.256784]  [<ffffffff812bd5a2>] SyS_read+0x62/0xa0
[ 6293.256784]  [<ffffffff841a1a00>] tracesys+0xdd/0xe2
[ 6293.256784] Code: 66 90 48 89 fb 41 89 f5 48 8b 3f 48 85 ff 74 29 85 f6 74 25 45 31 e4 66 0f 1f 84 00 00 00 00 00 e8 eb 14 12 fd 41 ff c4 49 63 c4 <48> 8b 3c c3 48 85 ff 74 05 45 39 e5 75 e7 48 83 c4 08 5b 41 5c
[ 6293.256784] RIP  [<ffffffff8412793b>] p9_release_pages+0x3b/0x60
[ 6293.256784]  RSP <ffff880787ddfc28>
[ 6293.256784] CR2: ffff8807c96f3000
[ 6293.256784] ---[ end trace 50822ee72cd360fc ]---

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/9p/trans_common.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/9p/trans_common.c b/net/9p/trans_common.c
index de8df95..2ee3879 100644
--- a/net/9p/trans_common.c
+++ b/net/9p/trans_common.c
@@ -24,11 +24,11 @@
  */
 void p9_release_pages(struct page **pages, int nr_pages)
 {
-	int i = 0;
-	while (pages[i] && nr_pages--) {
-		put_page(pages[i]);
-		i++;
-	}
+	int i;
+
+	for (i = 0; i < nr_pages; i++)
+		if (pages[i])
+			put_page(pages[i]);
 }
 EXPORT_SYMBOL(p9_release_pages);
 


  parent reply	other threads:[~2013-07-31 13:26 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31 13:23 [00/84] 3.2.50-rc1 review Ben Hutchings
2013-07-31 13:23 ` [36/84] lockd: protect nlm_blocked access in nlmsvc_retry_blocked Ben Hutchings
2013-07-31 13:23 ` [54/84] Btrfs: fix lock leak when resuming snapshot deletion Ben Hutchings
2013-07-31 13:23 ` [32/84] xen/io/ring.h: new macro to detect whether there are too many requests on the ring Ben Hutchings
2013-07-31 13:23 ` [38/84] ACPI / memhotplug: Fix a stale pointer in error path Ben Hutchings
2013-07-31 13:23 ` [37/84] ext4: don't allow ext4_free_blocks() to fail due to ENOMEM Ben Hutchings
2013-07-31 13:23 ` [41/84] ALSA: asihpi: Fix unlocked snd_pcm_stop() call Ben Hutchings
2013-07-31 13:23 ` [04/84] ipv6: ip6_sk_dst_check() must not assume ipv6 dst Ben Hutchings
2013-07-31 13:23 ` [42/84] ALSA: atiixp: Fix unlocked snd_pcm_stop() call Ben Hutchings
2013-07-31 13:23 ` [44/84] ASoC: max98088 - fix element type of the register cache Ben Hutchings
2013-07-31 13:23 ` [72/84] staging: comedi: fix a race between do_cmd_ioctl() and read/write Ben Hutchings
2013-07-31 13:23 ` [70/84] USB: option: add D-Link DWM-152/C1 and DWM-156/C1 Ben Hutchings
2013-07-31 13:23 ` [01/84] bridge: fix switched interval for MLD Query types Ben Hutchings
2013-07-31 13:23 ` [79/84] xhci: fix null pointer dereference on ring_doorbell_for_active_rings Ben Hutchings
2013-07-31 13:23 ` [05/84] af_key: fix info leaks in notify messages Ben Hutchings
2013-07-31 13:23 ` [66/84] [SCSI] isci: Fix a race condition in the SSP task management path Ben Hutchings
2013-07-31 13:23 ` [45/84] ALSA: ua101: Fix unlocked snd_pcm_stop() call Ben Hutchings
2013-07-31 13:23 ` [74/84] powerpc/modules: Module CRC relocation fix causes perf issues Ben Hutchings
2013-07-31 13:23 ` [29/84] [SCSI] Fix incorrect memset in bnx2fc_parse_fcp_rsp Ben Hutchings
2013-07-31 13:23 ` [83/84] USB: mos7840: fix memory leak in open Ben Hutchings
2013-07-31 13:23 ` [84/84] usb: Clear both buffers when clearing a control transfer TT buffer Ben Hutchings
2013-07-31 13:23 ` [40/84] usb: dwc3: fix wrong bit mask in dwc3_event_type Ben Hutchings
2013-07-31 13:23 ` [35/84] ASoC: sglt5000: Fix SGTL5000_PLL_FRAC_DIV_MASK Ben Hutchings
2013-07-31 13:23 ` [02/84] ipv6: don't call addrconf_dst_alloc again when enable lo Ben Hutchings
2013-07-31 13:23 ` [26/84] ARM: OMAP: RX-51: change probe order of touchscreen and panel SPI devices Ben Hutchings
2013-08-01  5:49   ` Tomi Valkeinen
2013-08-01  9:32     ` Ben Hutchings
2013-08-02 20:14       ` Ben Hutchings
2013-07-31 13:23 ` [64/84] drm/radeon: improve dac adjust heuristics for legacy pdac Ben Hutchings
2013-07-31 13:23 ` [12/84] ipv6: call udp_push_pending_frames when uncorking a socket with AF_INET pending data Ben Hutchings
2013-07-31 13:23 ` Ben Hutchings [this message]
2013-07-31 13:23 ` [50/84] ALSA: hda - Add new GPU codec ID to snd-hda Ben Hutchings
2013-07-31 13:23 ` [78/84] usb: host: xhci: Enable XHCI_SPURIOUS_SUCCESS for all controllers with xhci 1.0 Ben Hutchings
2013-07-31 13:23 ` [75/84] USB: ti_usb_3410_5052: fix dynamic-id matching Ben Hutchings
2013-07-31 13:23 ` [77/84] xhci: Avoid NULL pointer deref when host dies Ben Hutchings
2013-07-31 13:23 ` [73/84] usb: option: add TP-LINK MA260 Ben Hutchings
2013-07-31 13:23 ` [52/84] ata: Fix DVD not dectected at some platform with Wellsburg PCH Ben Hutchings
2013-07-31 13:23 ` [10/84] ipv6,mcast: always hold idev->lock before mca_lock Ben Hutchings
2013-07-31 13:23 ` [51/84] ALSA: hda - Add new GPU codec ID to snd-hda Ben Hutchings
2013-07-31 13:23 ` [30/84] fanotify: info leak in copy_event_to_user() Ben Hutchings
2013-07-31 13:23 ` [03/84] macvtap: fix recovery from gup errors Ben Hutchings
2013-07-31 13:23 ` [49/84] staging: line6: Fix unlocked snd_pcm_stop() call Ben Hutchings
2013-07-31 13:23 ` [71/84] staging: comedi: COMEDI_CANCEL ioctl should wake up read/write Ben Hutchings
2013-07-31 13:23 ` [39/84] usb: dwc3: gadget: don't prevent gadget from being probed if we fail Ben Hutchings
2013-07-31 13:23 ` [07/84] neighbour: fix a race in neigh_destroy() Ben Hutchings
2013-07-31 13:23 ` [18/84] dummy: fix oops when loading the dummy failed Ben Hutchings
2013-07-31 13:23 ` [13/84] ipv6: ip6_append_data_mtu did not care about pmtudisc and frag_size Ben Hutchings
2013-07-31 13:23 ` [65/84] drm/radeon: fix combios tables on older cards Ben Hutchings
2013-07-31 13:23 ` [25/84] sparc: tsb must be flushed before tlb Ben Hutchings
2013-07-31 13:23 ` [56/84] ALSA: usb-audio: 6fire: return correct XRUN indication Ben Hutchings
2013-07-31 13:23 ` [21/84] atl1e: unmap partially mapped skb on dma error and free skb Ben Hutchings
2013-07-31 13:23 ` [48/84] ASoC: s6000: Fix unlocked snd_pcm_stop() call Ben Hutchings
2013-07-31 13:23 ` [43/84] ALSA: 6fire: " Ben Hutchings
2013-07-31 13:23 ` [55/84] Btrfs: re-add root to dead root list if we stop dropping it Ben Hutchings
2013-07-31 13:23 ` [11/84] l2tp: add missing .owner to struct pppox_proto Ben Hutchings
2013-07-31 13:23 ` [33/84] xen/blkback: Check for insane amounts of request on the ring (v6) Ben Hutchings
2013-07-31 13:23 ` [68/84] [SCSI] sd: fix crash when UA received on DIF enabled device Ben Hutchings
2013-07-31 13:23 ` [20/84] atl1e: fix dma mapping warnings Ben Hutchings
2013-07-31 13:23 ` [16/84] macvtap: correctly linearize skb when zerocopy is used Ben Hutchings
2013-07-31 13:23 ` [53/84] ACPI / video: ignore BIOS initial backlight value for Fujitsu E753 Ben Hutchings
2013-08-02 13:46   ` Luis Henriques
2013-08-02 14:24     ` Ben Hutchings
2013-07-31 13:23 ` [06/84] sh_eth: fix unhandled RFE interrupt Ben Hutchings
2013-07-31 13:23 ` [08/84] x25: Fix broken locking in ioctl error paths Ben Hutchings
2013-07-31 13:23 ` [31/84] tracing: Use current_uid() for critical time tracing Ben Hutchings
2013-07-31 13:23 ` [28/84] virtio_net: fix race in RX VQ processing Ben Hutchings
2013-07-31 13:23 ` [62/84] USB: cp210x: add MMB and PI ZigBee USB Device Support Ben Hutchings
2013-07-31 13:23 ` [23/84] sparc32: vm_area_struct access for old Sun SPARCs Ben Hutchings
2013-07-31 13:23 ` [15/84] ifb: fix rcu_sched self-detected stalls Ben Hutchings
2013-07-31 13:23 ` [59/84] USB: misc: Add Manhattan Hi-Speed USB DVI Converter to sisusbvga Ben Hutchings
2013-07-31 13:23 ` [46/84] ALSA: usx2y: Fix unlocked snd_pcm_stop() call Ben Hutchings
2013-07-31 13:23 ` [58/84] USB: storage: Add MicroVault Flash Drive to unusual_devs Ben Hutchings
2013-07-31 13:23 ` [60/84] USB: option: append Petatel NP10T device to GSM modems list Ben Hutchings
2013-07-31 13:23 ` [81/84] usb: serial: option: add Olivetti Olicard 200 Ben Hutchings
2013-07-31 13:23 ` [63/84] drm/radeon: Another card with wrong primary dac adj Ben Hutchings
2013-07-31 13:23 ` [24/84] sparc64 address-congruence property Ben Hutchings
2013-07-31 13:23 ` [19/84] ifb: fix oops when loading the ifb failed Ben Hutchings
2013-07-31 13:23 ` [61/84] usb: cp210x support SEL C662 Vendor/Device Ben Hutchings
2013-07-31 13:23 ` [34/84] ASoC: sglt5000: Fix the default value of CHIP_SSS_CTRL Ben Hutchings
2013-07-31 13:23 ` [27/84] virtio: support unlocked queue poll Ben Hutchings
2013-07-31 13:23 ` [67/84] [SCSI] qla2xxx: Properly set the tagging for commands Ben Hutchings
2013-07-31 13:23 ` [22/84] vlan: fix a race in egress prio management Ben Hutchings
2013-07-31 13:23 ` [80/84] usb: serial: option: blacklist ONDA MT689DC QMI interface Ben Hutchings
2013-07-31 13:23 ` [09/84] net: Swap ver and type in pppoe_hdr Ben Hutchings
2013-07-31 13:23 ` [14/84] sunvnet: vnet_port_remove must call unregister_netdev Ben Hutchings
2013-07-31 13:23 ` [47/84] ALSA: pxa2xx: Fix unlocked snd_pcm_stop() call Ben Hutchings
2013-07-31 13:23 ` [76/84] usb: serial: option: Add ONYX 3G device support Ben Hutchings
2013-07-31 13:23 ` [82/84] usb: serial: option.c: remove ONDA MT825UP product ID fromdriver Ben Hutchings
2013-07-31 13:23 ` [57/84] usb: serial: cp210x: Add USB ID for Netgear Switches embedded serial adapter Ben Hutchings
2013-07-31 13:23 ` [69/84] nfsd: nfsd_open: when dentry_open returns an error do not propagate as struct file Ben Hutchings
2013-08-01  9:30 ` [00/84] 3.2.50-rc1 review Ben Hutchings

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=lsq.1375276989.852780586@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sasha.levin@oracle.com \
    --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