aboutsummaryrefslogtreecommitdiffstats
path: root/main/linux-grsec/xsa43-pvops-linux-3.4.patch
blob: 124c369d2220cf2b1161552b514fb016968f18c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
commit 065ca03d6bd9ed25175ac22a7bd2d27d797524d1
Author: Natanael Copa <ncopa@alpinelinux.org>
Date:   Wed Feb 6 15:37:15 2013 +0000

    xen-pciback: rate limit error messages from xen_pcibk_enable_msi{,x}()
    
    ... as being guest triggerable (e.g. by invoking
    XEN_PCI_OP_enable_msi{,x} on a device not being MSI/MSI-X capable).
    
    This is CVE-2013-0231 / XSA-43.
    
    Also make the two messages uniform in both their wording and severity.
    
    Ported to linux-3.4.y
    
    Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>

diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c
index 97f5d26..7b9d50f 100644
--- a/drivers/xen/xen-pciback/pciback_ops.c
+++ b/drivers/xen/xen-pciback/pciback_ops.c
@@ -135,7 +135,6 @@ int xen_pcibk_enable_msi(struct xen_pcibk_device *pdev,
 			 struct pci_dev *dev, struct xen_pci_op *op)
 {
 	struct xen_pcibk_dev_data *dev_data;
-	int otherend = pdev->xdev->otherend_id;
 	int status;
 
 	if (unlikely(verbose_request))
@@ -144,8 +143,10 @@ int xen_pcibk_enable_msi(struct xen_pcibk_device *pdev,
 	status = pci_enable_msi(dev);
 
 	if (status) {
-		printk(KERN_ERR "error enable msi for guest %x status %x\n",
-			otherend, status);
+		if (printk_ratelimit())
+			printk(DRV_NAME ": %s: " \
+				"error enabling MSI for guest %u: err %d\n",
+				pci_name(dev), pdev->xdev->otherend_id, status);
 		op->value = 0;
 		return XEN_PCI_ERR_op_failed;
 	}
@@ -223,10 +224,11 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev,
 						pci_name(dev), i,
 						op->msix_entries[i].vector);
 		}
-	} else {
-		printk(KERN_WARNING DRV_NAME ": %s: failed to enable MSI-X: err %d!\n",
-			pci_name(dev), result);
-	}
+	} else
+		if (printk_ratelimit())
+			printk(DRV_NAME ": %s: " \
+				"error enabling MSI-X for guest %u: err %d!\n",
+				pci_name(dev), pdev->xdev->otherend_id, result);
 	kfree(entries);
 
 	op->value = result;