From: Kamal Mostafa <kamal@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@lists.ubuntu.com
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Kamal Mostafa <kamal@canonical.com>
Subject: [PATCH 01/75] xen/blkback: Check device permissions before allowing OP_DISCARD
Date: Tue, 30 Jul 2013 08:16:30 -0700 [thread overview]
Message-ID: <1375197464-27962-2-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1375197464-27962-1-git-send-email-kamal@canonical.com>
3.8.13.6 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
commit 604c499cbbcc3d5fe5fb8d53306aa0fae1990109 upstream.
We need to make sure that the device is not RO or that
the request is not past the number of sectors we want to
issue the DISCARD operation for.
This fixes CVE-2013-2140.
Acked-by: Jan Beulich <JBeulich@suse.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
[v1: Made it pr_warn instead of pr_debug]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
drivers/block/xen-blkback/blkback.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index ef6d9be..bdee5f8 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -656,7 +656,18 @@ static int dispatch_discard_io(struct xen_blkif *blkif,
int status = BLKIF_RSP_OKAY;
struct block_device *bdev = blkif->vbd.bdev;
unsigned long secure;
+ struct phys_req preq;
+
+ preq.sector_number = req->u.discard.sector_number;
+ preq.nr_sects = req->u.discard.nr_sectors;
+ err = xen_vbd_translate(&preq, blkif, WRITE);
+ if (err) {
+ pr_warn(DRV_PFX "access denied: DISCARD [%llu->%llu] on dev=%04x\n",
+ preq.sector_number,
+ preq.sector_number + preq.nr_sects, blkif->vbd.pdevice);
+ goto fail_response;
+ }
blkif->st_ds_req++;
xen_blkif_get(blkif);
@@ -667,7 +678,7 @@ static int dispatch_discard_io(struct xen_blkif *blkif,
err = blkdev_issue_discard(bdev, req->u.discard.sector_number,
req->u.discard.nr_sectors,
GFP_KERNEL, secure);
-
+fail_response:
if (err == -EOPNOTSUPP) {
pr_debug(DRV_PFX "discard op failed, not supported\n");
status = BLKIF_RSP_EOPNOTSUPP;
--
1.8.1.2
next prev parent reply other threads:[~2013-07-30 15:25 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-30 15:16 [ 3.8.y.z extended stable ] Linux 3.8.13.6 stable review Kamal Mostafa
2013-07-30 15:16 ` Kamal Mostafa [this message]
2013-07-30 15:16 ` [PATCH 02/75] ASoC: sglt5000: Fix the default value of CHIP_SSS_CTRL Kamal Mostafa
2013-07-30 15:16 ` [PATCH 03/75] ASoC: sglt5000: Fix SGTL5000_PLL_FRAC_DIV_MASK Kamal Mostafa
2013-07-30 15:16 ` [PATCH 04/75] drm/i915: Correct obj->mm_list link to dev_priv->dev_priv->mm.inactive_list Kamal Mostafa
2013-07-30 15:16 ` [PATCH 05/75] drm/i915: fix up ring cleanup for the i830/i845 CS tlb w/a Kamal Mostafa
2013-07-30 15:16 ` [PATCH 06/75] Partially revert "drm/i915: unconditionally use mt forcewake on hsw/ivb" Kamal Mostafa
2013-07-30 15:16 ` [PATCH 07/75] drm/i915: Fix write-read race with multiple rings Kamal Mostafa
2013-07-30 15:16 ` [PATCH 08/75] drm/i915: merge {i965, sandybridge}_write_fence_reg() Kamal Mostafa
2013-07-30 15:16 ` [PATCH 09/75] drm/i915: Fix incoherence with fence updates on Sandybridge+ Kamal Mostafa
2013-07-30 15:16 ` [PATCH 10/75] Revert "drm/i915: Workaround incoherence between fences and LLC across multiple CPUs" Kamal Mostafa
2013-07-30 15:16 ` [PATCH 11/75] drm/i915: rename sdvox_reg to hdmi_reg on HDMI context Kamal Mostafa
2013-07-30 15:16 ` [PATCH 12/75] drm/i915: don't setup hdmi for port D edp in ddi_init Kamal Mostafa
2013-07-30 15:16 ` [PATCH 13/75] drm/i915: Preserve the DDI_A_4_LANES bit from the bios Kamal Mostafa
2013-07-30 15:16 ` [PATCH 14/75] drm/radeon/hdmi: make sure we have an afmt block assigned Kamal Mostafa
2013-07-30 15:16 ` [PATCH 15/75] drm/radeon: allocate SA bo in the requested domain Kamal Mostafa
2013-07-30 15:16 ` [PATCH 16/75] drm/radeon: allow selection of alignment in the sub-allocator Kamal Mostafa
2013-07-30 15:16 ` [PATCH 17/75] ACPI / memhotplug: Fix a stale pointer in error path Kamal Mostafa
2013-07-30 15:16 ` [PATCH 18/75] PM / Sleep: avoid 'autosleep' in shutdown progress Kamal Mostafa
2013-07-30 15:16 ` [PATCH 19/75] ext4: fix error handling in ext4_ext_truncate() Kamal Mostafa
2013-07-30 15:16 ` [PATCH 20/75] radeon kms: do not flush uninitialized hotplug work Kamal Mostafa
2013-07-30 15:16 ` [PATCH 21/75] ALSA: asihpi: Fix unlocked snd_pcm_stop() call Kamal Mostafa
2013-07-30 15:16 ` [PATCH 22/75] ALSA: atiixp: " Kamal Mostafa
2013-07-30 15:16 ` [PATCH 23/75] ALSA: 6fire: " Kamal Mostafa
2013-07-30 15:16 ` [PATCH 24/75] ALSA: ua101: " Kamal Mostafa
2013-07-30 15:16 ` [PATCH 25/75] ALSA: usx2y: " Kamal Mostafa
2013-07-30 15:16 ` [PATCH 26/75] ALSA: pxa2xx: " Kamal Mostafa
2013-07-30 15:16 ` [PATCH 27/75] ASoC: atmel: " Kamal Mostafa
2013-07-30 15:16 ` [PATCH 28/75] ASoC: s6000: " Kamal Mostafa
2013-07-30 15:16 ` [PATCH 29/75] [media] saa7134: " Kamal Mostafa
2013-07-30 15:16 ` [PATCH 30/75] staging: line6: " Kamal Mostafa
2013-07-30 15:17 ` [PATCH 31/75] x86, suspend: Handle CPUs which fail to #GP on RDMSR Kamal Mostafa
2013-07-30 15:17 ` [PATCH 32/75] ALSA: hda - Add new GPU codec ID to snd-hda Kamal Mostafa
2013-07-30 18:42 ` [PATCH 33/75] drm/i915: fix long-standing SNB regression in power consumption after resume v2 Kamal Mostafa
2013-07-30 18:44 ` [PATCH 34/75] ACPI / video: ignore BIOS initial backlight value for Fujitsu E753 Kamal Mostafa
2013-07-30 18:44 ` [PATCH 35/75] arm64: mm: don't treat user cache maintenance faults as writes Kamal Mostafa
2013-07-30 18:44 ` [PATCH 36/75] Btrfs: fix lock leak when resuming snapshot deletion Kamal Mostafa
2013-07-30 18:44 ` [PATCH 37/75] Btrfs: re-add root to dead root list if we stop dropping it Kamal Mostafa
2013-07-30 18:44 ` [PATCH 38/75] drm/i915: inverted brightness quirk for Acer Aspire 4736Z Kamal Mostafa
2013-07-30 18:44 ` [PATCH 39/75] drm/i915: quirk no PCH_PWM_ENABLE for Dell XPS13 backlight Kamal Mostafa
2013-07-30 18:44 ` [PATCH 40/75] drm/i915: Serialize almost all register access Kamal Mostafa
2013-07-30 18:44 ` [PATCH 41/75] drm/i915: fix up gt init sequence fallout Kamal Mostafa
2013-07-30 18:44 ` [PATCH 42/75] powerpc/modules: Module CRC relocation fix causes perf issues Kamal Mostafa
2013-07-30 18:44 ` [PATCH 43/75] [PATCH] sparc32: vm_area_struct access for old Sun SPARCs Kamal Mostafa
2013-07-30 18:44 ` [PATCH 44/75] sparc64 address-congruence property Kamal Mostafa
2013-07-30 18:44 ` [PATCH 45/75] sparc: tsb must be flushed before tlb Kamal Mostafa
2013-07-30 18:44 ` [PATCH 46/75] bridge: fix switched interval for MLD Query types Kamal Mostafa
2013-07-30 18:44 ` [PATCH 47/75] ipv4: Fixed MD5 key lookups when adding/ removing MD5 to/ from TCP sockets Kamal Mostafa
2013-07-30 18:44 ` [PATCH 48/75] ipv6: don't call addrconf_dst_alloc again when enable lo Kamal Mostafa
2013-07-30 18:44 ` [PATCH 49/75] macvtap: fix recovery from gup errors Kamal Mostafa
2013-07-30 18:44 ` [PATCH 50/75] ipv6: ip6_sk_dst_check() must not assume ipv6 dst Kamal Mostafa
2013-07-30 18:44 ` [PATCH 51/75] af_key: fix info leaks in notify messages Kamal Mostafa
2013-07-30 18:44 ` [PATCH 52/75] sh_eth: fix unhandled RFE interrupt Kamal Mostafa
2013-07-30 18:44 ` [PATCH 53/75] neighbour: fix a race in neigh_destroy() Kamal Mostafa
2013-07-30 18:44 ` [PATCH 54/75] x25: Fix broken locking in ioctl error paths Kamal Mostafa
2013-07-30 18:44 ` [PATCH 55/75] net: Swap ver and type in pppoe_hdr Kamal Mostafa
2013-07-30 18:45 ` [PATCH 56/75] vti: remove duplicated code to fix a memory leak Kamal Mostafa
2013-07-30 18:45 ` [PATCH 57/75] ipv6,mcast: always hold idev->lock before mca_lock Kamal Mostafa
2013-07-30 18:45 ` [PATCH 58/75] l2tp: add missing .owner to struct pppox_proto Kamal Mostafa
2013-07-30 18:45 ` [PATCH 59/75] ipv6: call udp_push_pending_frames when uncorking a socket with AF_INET pending data Kamal Mostafa
2013-07-30 18:45 ` [PATCH 60/75] ipv6: ip6_append_data_mtu did not care about pmtudisc and frag_size Kamal Mostafa
2013-07-30 18:45 ` [PATCH 61/75] sunvnet: vnet_port_remove must call unregister_netdev Kamal Mostafa
2013-07-30 18:45 ` [PATCH 62/75] ifb: fix rcu_sched self-detected stalls Kamal Mostafa
2013-07-30 18:45 ` [PATCH 63/75] tuntap: correctly linearize skb when zerocopy is used Kamal Mostafa
2013-07-30 18:45 ` [PATCH 64/75] macvtap: " Kamal Mostafa
2013-07-30 18:45 ` [PATCH 65/75] ipv6: in case of link failure remove route directly instead of letting it expire Kamal Mostafa
2013-07-30 18:45 ` [PATCH 66/75] 9p: fix off by one causing access violations and memory corruption Kamal Mostafa
2013-07-30 18:45 ` [PATCH 67/75] dummy: fix oops when loading the dummy failed Kamal Mostafa
2013-07-30 18:45 ` [PATCH 68/75] ifb: fix oops when loading the ifb failed Kamal Mostafa
2013-07-30 18:45 ` [PATCH 69/75] ipv6: only static routes qualify for equal cost multipathing Kamal Mostafa
2013-07-30 18:45 ` [PATCH 70/75] atl1e: fix dma mapping warnings Kamal Mostafa
2013-07-30 18:45 ` [PATCH 71/75] atl1e: unmap partially mapped skb on dma error and free skb Kamal Mostafa
2013-07-30 18:45 ` [PATCH 72/75] ipv4: set transport header earlier Kamal Mostafa
2013-07-30 18:45 ` [PATCH 73/75] tuntap: do not zerocopy if iov needs more pages than MAX_SKB_FRAGS Kamal Mostafa
2013-07-30 18:45 ` [PATCH 74/75] macvtap: " Kamal Mostafa
2013-07-30 18:45 ` [PATCH 75/75] vlan: fix a race in egress prio management Kamal Mostafa
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=1375197464-27962-2-git-send-email-kamal@canonical.com \
--to=kamal@canonical.com \
--cc=kernel-team@lists.ubuntu.com \
--cc=konrad.wilk@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
all inboxes | Powered by JetHome®