rpms/kernel/F-11 linux-2.6-netdev-r8169-fix-lg-pkt-crash.patch, NONE, 1.1 linux-2.6-netdev-r8169-use-different-family-defaults.patch, NONE, 1.1 kernel.spec, 1.1651, 1.1652 via-sdmmc.patch, 1.1, 1.2

Chuck Ebbert cebbert at fedoraproject.org
Tue Jun 16 19:38:04 UTC 2009


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv10614

Modified Files:
	kernel.spec via-sdmmc.patch 
Added Files:
	linux-2.6-netdev-r8169-fix-lg-pkt-crash.patch 
	linux-2.6-netdev-r8169-use-different-family-defaults.patch 
Log Message:
Two r8169 driver updates from 2.6.30
Update via-sdmmc driver

linux-2.6-netdev-r8169-fix-lg-pkt-crash.patch:

--- NEW FILE linux-2.6-netdev-r8169-fix-lg-pkt-crash.patch ---
From: Eric Dumazet <eric.dumazet at gmail.com>
Date: Tue, 9 Jun 2009 11:01:02 +0000 (-0700)
Subject: r8169: fix crash when large packets are received
X-Git-Tag: v2.6.30~7^2~1
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=fdd7b4c3302c93f6833e338903ea77245eb510b4

r8169: fix crash when large packets are received

Michael Tokarev reported receiving a large packet could crash
a machine with RTL8169 NIC.
( original thread at http://lkml.org/lkml/2009/6/8/192 )

Problem is this driver tells that NIC frames up to 16383 bytes
can be received but provides skb to rx ring allocated with
smaller sizes (1536 bytes in case standard 1500 bytes MTU is used)

When a frame larger than what was allocated by driver is received,
dma transfert can occurs past the end of buffer and corrupt
kernel memory.

Fix is to tell to NIC what is the maximum size a frame can be.

This bug is very old, (before git introduction, linux-2.6.10), and
should be backported to stable versions.

Reported-by: Michael Tokarev <mjt at tls.msk.ru>
Signed-off-by: Eric Dumazet <eric.dumazet at gmail.com>
Tested-by: Michael Tokarev <mjt at tls.msk.ru>
Signed-off-by: David S. Miller <davem at davemloft.net>
---

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 8247a94..3b19e0c 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -66,7 +66,6 @@ static const int multicast_filter_limit = 32;
 #define RX_DMA_BURST	6	/* Maximum PCI burst, '6' is 1024 */
 #define TX_DMA_BURST	6	/* Maximum PCI burst, '6' is 1024 */
 #define EarlyTxThld	0x3F	/* 0x3F means NO early transmit */
-#define RxPacketMaxSize	0x3FE8	/* 16K - 1 - ETH_HLEN - VLAN - CRC... */
 #define SafeMtu		0x1c20	/* ... actually life sucks beyond ~7k */
 #define InterFrameGap	0x03	/* 3 means InterFrameGap = the shortest one */
 
@@ -2357,10 +2356,10 @@ static u16 rtl_rw_cpluscmd(void __iomem *ioaddr)
 	return cmd;
 }
 
-static void rtl_set_rx_max_size(void __iomem *ioaddr)
+static void rtl_set_rx_max_size(void __iomem *ioaddr, unsigned int rx_buf_sz)
 {
 	/* Low hurts. Let's disable the filtering. */
-	RTL_W16(RxMaxSize, 16383);
+	RTL_W16(RxMaxSize, rx_buf_sz);
 }
 
 static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version)
@@ -2407,7 +2406,7 @@ static void rtl_hw_start_8169(struct net_device *dev)
 
 	RTL_W8(EarlyTxThres, EarlyTxThld);
 
-	rtl_set_rx_max_size(ioaddr);
+	rtl_set_rx_max_size(ioaddr, tp->rx_buf_sz);
 
 	if ((tp->mac_version == RTL_GIGA_MAC_VER_01) ||
 	    (tp->mac_version == RTL_GIGA_MAC_VER_02) ||
@@ -2668,7 +2667,7 @@ static void rtl_hw_start_8168(struct net_device *dev)
 
 	RTL_W8(EarlyTxThres, EarlyTxThld);
 
-	rtl_set_rx_max_size(ioaddr);
+	rtl_set_rx_max_size(ioaddr, tp->rx_buf_sz);
 
 	tp->cp_cmd |= RTL_R16(CPlusCmd) | PktCntrDisable | INTT_1;
 
@@ -2846,7 +2845,7 @@ static void rtl_hw_start_8101(struct net_device *dev)
 
 	RTL_W8(EarlyTxThres, EarlyTxThld);
 
-	rtl_set_rx_max_size(ioaddr);
+	rtl_set_rx_max_size(ioaddr, tp->rx_buf_sz);
 
 	tp->cp_cmd |= rtl_rw_cpluscmd(ioaddr) | PCIMulRW;
 

linux-2.6-netdev-r8169-use-different-family-defaults.patch:

--- NEW FILE linux-2.6-netdev-r8169-use-different-family-defaults.patch ---
From: Jean Delvare <jdelvare at suse.de>
Date: Wed, 27 May 2009 03:54:48 +0000 (-0700)
Subject: r8169: Use a different default for each family
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=f21b75e9d6471d7f4e2110774819be7beafc86d5

r8169: Use a different default for each family

The r8169 driver supports 3 different families of network chips
(RTL8169, RTL8168 and RTL8101). When an unknown version is found, the
driver currently always defaults to the RTL8169 variant. This has very
little chance to ever work for chips of the other families. So better
define a per-family default.

Signed-off-by: Jean Delvare <jdelvare at suse.de>
Acked-by: Francois Romieu <romieu at fr.zoreil.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
---

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index fb2e50d..0ec0605 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -94,6 +94,7 @@ static const int multicast_filter_limit = 32;
 #define RTL_R32(reg)		((unsigned long) readl (ioaddr + (reg)))
 
 enum mac_version {
+	RTL_GIGA_MAC_NONE   = 0x00,
 	RTL_GIGA_MAC_VER_01 = 0x01, // 8169
 	RTL_GIGA_MAC_VER_02 = 0x02, // 8169S
 	RTL_GIGA_MAC_VER_03 = 0x03, // 8110S
@@ -1300,7 +1301,8 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp,
 		{ 0xfc800000, 0x00800000,	RTL_GIGA_MAC_VER_02 },
 		{ 0xfc800000, 0x00000000,	RTL_GIGA_MAC_VER_01 },
 
-		{ 0x00000000, 0x00000000,	RTL_GIGA_MAC_VER_01 }	/* Catch-all */
+		/* Catch-all */
+		{ 0x00000000, 0x00000000,	RTL_GIGA_MAC_NONE   }
 	}, *p = mac_info;
 	u32 reg;
 
@@ -1308,12 +1310,6 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp,
 	while ((reg & p->mask) != p->val)
 		p++;
 	tp->mac_version = p->mac_version;
-
-	if (p->mask == 0x00000000) {
-		struct pci_dev *pdev = tp->pci_dev;
-
-		dev_info(&pdev->dev, "unknown MAC (%08x)\n", reg);
-	}
 }
 
 static void rtl8169_print_mac_version(struct rtl8169_private *tp)
@@ -1889,6 +1885,7 @@ static const struct rtl_cfg_info {
 	u16 intr_event;
 	u16 napi_event;
 	unsigned features;
+	u8 default_ver;
 } rtl_cfg_infos [] = {
 	[RTL_CFG_0] = {
 		.hw_start	= rtl_hw_start_8169,
@@ -1897,7 +1894,8 @@ static const struct rtl_cfg_info {
 		.intr_event	= SYSErr | LinkChg | RxOverflow |
 				  RxFIFOOver | TxErr | TxOK | RxOK | RxErr,
 		.napi_event	= RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow,
-		.features	= RTL_FEATURE_GMII
+		.features	= RTL_FEATURE_GMII,
+		.default_ver	= RTL_GIGA_MAC_VER_01,
 	},
 	[RTL_CFG_1] = {
 		.hw_start	= rtl_hw_start_8168,
@@ -1906,7 +1904,8 @@ static const struct rtl_cfg_info {
 		.intr_event	= SYSErr | LinkChg | RxOverflow |
 				  TxErr | TxOK | RxOK | RxErr,
 		.napi_event	= TxErr | TxOK | RxOK | RxOverflow,
-		.features	= RTL_FEATURE_GMII | RTL_FEATURE_MSI
+		.features	= RTL_FEATURE_GMII | RTL_FEATURE_MSI,
+		.default_ver	= RTL_GIGA_MAC_VER_11,
 	},
 	[RTL_CFG_2] = {
 		.hw_start	= rtl_hw_start_8101,
@@ -1915,7 +1914,8 @@ static const struct rtl_cfg_info {
 		.intr_event	= SYSErr | LinkChg | RxOverflow | PCSTimeout |
 				  RxFIFOOver | TxErr | TxOK | RxOK | RxErr,
 		.napi_event	= RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow,
-		.features	= RTL_FEATURE_MSI
+		.features	= RTL_FEATURE_MSI,
+		.default_ver	= RTL_GIGA_MAC_VER_13,
 	}
 };
 
@@ -2096,6 +2096,15 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	/* Identify chip attached to board */
 	rtl8169_get_mac_version(tp, ioaddr);
 
+	/* Use appropriate default if unknown */
+	if (tp->mac_version == RTL_GIGA_MAC_NONE) {
+		if (netif_msg_probe(tp)) {
+			dev_notice(&pdev->dev,
+				   "unknown MAC, using family default\n");
+		}
+		tp->mac_version = cfg->default_ver;
+	}
+
 	rtl8169_print_mac_version(tp);
 
 	for (i = 0; i < ARRAY_SIZE(rtl_chip_info); i++) {
@@ -2103,13 +2112,9 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 			break;
 	}
 	if (i == ARRAY_SIZE(rtl_chip_info)) {
-		/* Unknown chip: assume array element #0, original RTL-8169 */
-		if (netif_msg_probe(tp)) {
-			dev_printk(KERN_DEBUG, &pdev->dev,
-				"unknown chip version, assuming %s\n",
-				rtl_chip_info[0].name);
-		}
-		i = 0;
+		dev_err(&pdev->dev,
+			"driver bug, MAC version not found in rtl_chip_info\n");
+		goto err_out_msi_5;
 	}
 	tp->chipset = i;
 


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1651
retrieving revision 1.1652
diff -u -p -r1.1651 -r1.1652
--- kernel.spec	16 Jun 2009 19:05:14 -0000	1.1651
+++ kernel.spec	16 Jun 2009 19:37:34 -0000	1.1652
@@ -667,6 +667,8 @@ Patch611: linux-2.6.29-alsa-update-quirk
 Patch612: alsa-hda-add-debugging.patch
 
 Patch630: net-revert-forcedeth-power-down-phy-when-interface-is.patch
+Patch641: linux-2.6-netdev-r8169-fix-lg-pkt-crash.patch
+Patch642: linux-2.6-netdev-r8169-use-different-family-defaults.patch
 
 Patch670: linux-2.6-ata-quirk.patch
 
@@ -1300,6 +1302,10 @@ ApplyPatch alsa-hda-add-debugging.patch
 # Networking
 ApplyPatch net-revert-forcedeth-power-down-phy-when-interface-is.patch
 
+# r8169 fixes from 2.6.30
+ApplyPatch linux-2.6-netdev-r8169-fix-lg-pkt-crash.patch
+ApplyPatch linux-2.6-netdev-r8169-use-different-family-defaults.patch
+
 # Misc fixes
 # The input layer spews crap no-one cares about.
 ApplyPatch linux-2.6-input-kill-stupid-messages.patch
@@ -2058,6 +2064,10 @@ fi
 # and build.
 
 %changelog
+* Tue Jun 16 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29.5-190
+- Two r8169 driver updates from 2.6.30
+- Update via-sdmmc driver
+
 * Tue Jun 16 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29.5-189
 - New debug patch for bug #494067, now enabled for non-debug kernels too.
 

via-sdmmc.patch:

Index: via-sdmmc.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/via-sdmmc.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- via-sdmmc.patch	13 Jun 2009 02:07:59 -0000	1.1
+++ via-sdmmc.patch	16 Jun 2009 19:37:34 -0000	1.2
@@ -1,20 +1,32 @@
 Subject: [MMC] via-sdmmc: v5 patch from lkml / April 01
-Now at patch ../patches/1-linux-2.6-via.git-c86dc84dad56ae01978456400a5a08f93cf04a59.patch
+Now at patch ../patches/01-linux-2.6-via.git-c86dc84dad56ae01978456400a5a08f93cf04a59.patch
 
 Subject: via-sdmmc: some cosmetic cleanups
-Now at patch ../patches/2-linux-2.6-via.git-50c0d950d0465929fe7e47ac5cbb64d8b48d6ddc.patch
+Now at patch ../patches/02-linux-2.6-via.git-50c0d950d0465929fe7e47ac5cbb64d8b48d6ddc.patch
 
 Subject: via-sdmmc: high-speed SD clock support, avoid overclocking
-Now at patch ../patches/3-linux-2.6-via.git-2ef0b437301d59814fab01401dcd458b7f7af73f.patch
+Now at patch ../patches/03-linux-2.6-via.git-2ef0b437301d59814fab01401dcd458b7f7af73f.patch
 
 Subject: via-sdmmc: Fix SD highspeed support
-Now at patch ../patches/4-linux-2.6-via.git-93c0e75de32e746d70379c59a1e6986eae6ead74.patch
+Now at patch ../patches/04-linux-2.6-via.git-93c0e75de32e746d70379c59a1e6986eae6ead74.patch
 
 Subject: [MMC] via-sdmmc: Fix syslog in case debugging is enabled
-Now at patch ../patches/5-linux-2.6-via.git-5ea96d44e4062a60889306ddbf6cb45ba78def8f.patch
+Now at patch ../patches/05-linux-2.6-via.git-5ea96d44e4062a60889306ddbf6cb45ba78def8f.patch
 
 Subject: mmc: via-sdmmc: Add 500ms card detection delay
-Now at patch ../patches/6-linux-2.6-via.git-306f169772343398f8786ac76d8f0ce19abf5697.patch
+Now at patch ../patches/06-linux-2.6-via.git-306f169772343398f8786ac76d8f0ce19abf5697.patch
+
+Subject: mmc: via-sdmmc: Rename register definition for more clarity
+Now at patch ../patches/07-linux-2.6-via.git-7f2a6ca468c282cb5176fa4059fd57b9b7026677.patch
+
+Subject: mmc: via-sdmmc: Make sure we actually power off when requested
+Now at patch ../patches/08-linux-2.6-via.git-0a5ee01234050c19e0b7e9a9168086e5df620145.patch
+
+Subject: mmc: via-mmc: Make sure we switch back from 3.3V to 1.8V
+Now at patch ../patches/09-linux-2.6-via.git-9799bc252796a2c4f9719755785d91febff454fe.patch
+
+Subject: mmc: via-sdmmc: Reorder module removal code
+Now at patch ../patches/10-linux-2.6-via.git-7807bb5f02592f553ee1954bf6cbf98bb6e0c875.patch
 
 --- work-2.6.29.4.orig/drivers/mmc/host/Kconfig
 +++ work-2.6.29.4/drivers/mmc/host/Kconfig
@@ -45,7 +57,7 @@ Now at patch ../patches/6-linux-2.6-via.
  
 --- /dev/null
 +++ work-2.6.29.4/drivers/mmc/host/via-sdmmc.c
-@@ -0,0 +1,1329 @@
+@@ -0,0 +1,1336 @@
 +/*
 + *  drivers/mmc/host/via-sdmmc.c - VIA SD/MMC Card Reader driver
 + *  Copyright (c) 2008, VIA Technologies Inc. All Rights Reserved.
@@ -277,13 +289,13 @@ Now at patch ../patches/6-linux-2.6-via.
 +#define VIA_CRDR_POW_180	0
 +#define VIA_CRDR_POW_330	1
 +/*
-+ * POWOFF : Power on/off select
++ * PAD_PWRON : Pad Power on/off select
 + * 0 : Power off
 + * 1 : Power on
 +  * NOTE : No mater what the actual value should be, this bit always
 + * read as 0. This is a hardware bug.
 + */
-+#define VIA_CRDR_PCICLKGATT_POWOFF	0x20
++#define VIA_CRDR_PCICLKGATT_PAD_PWRON	0x20
 +
 +#define VIA_CRDR_PCISDCCLK	0x5
 +
@@ -418,7 +430,7 @@ Now at patch ../patches/6-linux-2.6-via.
 +
 +	pm_pcictrl_reg->pciclkgat_reg = readb(addrbase + VIA_CRDR_PCICLKGATT);
 +	pm_pcictrl_reg->pciclkgat_reg |=
-+		VIA_CRDR_PCICLKGATT_POWSEL | VIA_CRDR_PCICLKGATT_POWOFF;
++		VIA_CRDR_PCICLKGATT_POWSEL | VIA_CRDR_PCICLKGATT_PAD_PWRON;
 +	pm_pcictrl_reg->pcisdclk_reg = readb(addrbase + VIA_CRDR_PCISDCCLK);
 +	pm_pcictrl_reg->pcidmaclk_reg = readb(addrbase + VIA_CRDR_PCIDMACLK);
 +	pm_pcictrl_reg->pciintctrl_reg = readb(addrbase + VIA_CRDR_PCIINTCTRL);
@@ -724,7 +736,7 @@ Now at patch ../patches/6-linux-2.6-via.
 +}
 +
 +static void via_sdc_set_power(struct via_crdr_mmc_host *host,
-+	unsigned short power)
++			      unsigned short power, unsigned int on)
 +{
 +	unsigned long flags;
 +	u8 gatt, pwr = VIA_CRDR_POW_180;
@@ -751,9 +763,14 @@ Now at patch ../patches/6-linux-2.6-via.
 +	host->power = pwr;
 +
 +	gatt = readb(host->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT);
-+	gatt |= VIA_CRDR_PCICLKGATT_POWOFF;
++	if (on)
++		gatt |= VIA_CRDR_PCICLKGATT_PAD_PWRON;
++	else
++		gatt &= ~VIA_CRDR_PCICLKGATT_PAD_PWRON;
 +	if (pwr == VIA_CRDR_POW_330)
 +		gatt |= VIA_CRDR_PCICLKGATT_POWSEL;
++	else
++		gatt &= ~VIA_CRDR_PCICLKGATT_POWSEL;
 +	writeb(gatt, host->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT);
 +
 +	mmiowb();
@@ -819,7 +836,9 @@ Now at patch ../patches/6-linux-2.6-via.
 +	spin_unlock_irqrestore(&host->lock, flags);
 +
 +	if (ios->power_mode != MMC_POWER_OFF)
-+		via_sdc_set_power(host, ios->vdd);
++		via_sdc_set_power(host, ios->vdd, 1);
++	else
++		via_sdc_set_power(host, ios->vdd, 0);
 +}
 +
 +static int via_sdc_get_ro(struct mmc_host *mmc)
@@ -860,7 +879,7 @@ Now at patch ../patches/6-linux-2.6-via.
 +
 +	spin_unlock_irqrestore(&host->lock, flags);
 +
-+	gatt = VIA_CRDR_PCICLKGATT_POWOFF;
++	gatt = VIA_CRDR_PCICLKGATT_PAD_PWRON;
 +	if (host->power == VIA_CRDR_POW_330)
 +		gatt |= VIA_CRDR_PCICLKGATT_POWSEL;
 +	writeb(gatt, host->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT);
@@ -1181,7 +1200,7 @@ Now at patch ../patches/6-linux-2.6-via.
 +
 +	sdhost->power = VIA_CRDR_POW_330;
 +
-+	gatt = VIA_CRDR_PCICLKGATT_POWSEL | VIA_CRDR_PCICLKGATT_POWOFF;
++	gatt = VIA_CRDR_PCICLKGATT_POWSEL | VIA_CRDR_PCICLKGATT_PAD_PWRON;
 +	writeb(gatt, sdhost->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT);
 +	msleep(3);
 +	gatt |= VIA_CRDR_PCICLKGATT_SFTRST;
@@ -1229,19 +1248,19 @@ Now at patch ../patches/6-linux-2.6-via.
 +
 +	sdhost = pci_get_drvdata(pcidev);
 +
++	mmc_remove_host(sdhost->mmc);
++
++	free_irq(pcidev->irq, sdhost);
++	
 +	tasklet_kill(&sdhost->finish_tasklet);
 +
 +	if (&sdhost->timer)
 +		del_timer_sync(&sdhost->timer);
 +
-+	mmc_remove_host(sdhost->mmc);
-+
-+	free_irq(pcidev->irq, sdhost);
-+
 +	writeb(0x0, sdhost->pcictrl_mmiobase + VIA_CRDR_PCIINTCTRL);
 +
 +	gatt = readb(sdhost->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT);
-+	gatt &= ~VIA_CRDR_PCICLKGATT_POWOFF;
++	gatt &= ~VIA_CRDR_PCICLKGATT_PAD_PWRON;
 +	writeb(gatt, sdhost->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT);
 +
 +	iounmap(sdhost->mmiobase);
@@ -1315,7 +1334,7 @@ Now at patch ../patches/6-linux-2.6-via.
 +
 +	sdhost = pci_get_drvdata(pcidev);
 +
-+	gatt = VIA_CRDR_PCICLKGATT_POWOFF;
++	gatt = VIA_CRDR_PCICLKGATT_PAD_PWRON;
 +	if (sdhost->power == VIA_CRDR_POW_330)
 +		gatt |= VIA_CRDR_PCICLKGATT_POWSEL;
 +	writeb(gatt, sdhost->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT);




More information about the fedora-extras-commits mailing list