diff mbox

[PowerPC] Next May 8 boot failure: OOPS during ibmveth moduleinit

Message ID 20090512174451.eeed4126.sfr@canb.auug.org.au
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Stephen Rothwell May 12, 2009, 7:44 a.m. UTC
Hi Dave,

This fixes it (I wonder if this bug is lurking in any other drivers):

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Tue, 12 May 2009 17:24:02 +1000
Subject: [PATCH] net/ibmveth: fix panic in probe

netdev->dev_addr changed from being an array to being a pointer, so we
should not take its address for memcpy().

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/net/ibmveth.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Jiri Pirko May 12, 2009, 8:16 a.m. UTC | #1
Tue, May 12, 2009 at 09:44:51AM CEST, sfr@canb.auug.org.au wrote:
>Hi Dave,
>
>This fixes it (I wonder if this bug is lurking in any other drivers):
Grepping the sources I see some other places suffering this problem. I'll send
patch for this.
>
>From: Stephen Rothwell <sfr@canb.auug.org.au>
>Date: Tue, 12 May 2009 17:24:02 +1000
>Subject: [PATCH] net/ibmveth: fix panic in probe
>
>netdev->dev_addr changed from being an array to being a pointer, so we
>should not take its address for memcpy().
Nice!
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>
>Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
>---
> drivers/net/ibmveth.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
>index 7902e5e..8daffad 100644
>--- a/drivers/net/ibmveth.c
>+++ b/drivers/net/ibmveth.c
>@@ -1285,7 +1285,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_
>  	netdev->features |= NETIF_F_LLTX;
> 	spin_lock_init(&adapter->stats_lock);
> 
>-	memcpy(&netdev->dev_addr, &adapter->mac_addr, netdev->addr_len);
>+	memcpy(netdev->dev_addr, &adapter->mac_addr, netdev->addr_len);
> 
> 	for(i = 0; i<IbmVethNumBufferPools; i++) {
> 		struct kobject *kobj = &adapter->rx_buff_pool[i].kobj;
>-- 
>1.6.3
>
>
>-- 
>Cheers,
>Stephen Rothwell                    sfr@canb.auug.org.au
>http://www.canb.auug.org.au/~sfr/
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wei Yongjun May 12, 2009, 8:17 a.m. UTC | #2
Stephen Rothwell wrote:
> Hi Dave,
>
> This fixes it (I wonder if this bug is lurking in any other drivers):
>   

Yes, there are some other exists. This spatch script can help to found this.
(http://www.emn.fr/x-info/coccinelle/)

# cat netdev_dev_addr.cocci
@@
struct net_device *dev;
@@
memcpy(
- &dev->dev_addr
+ dev->dev_addr
, ...);

@@
struct net_device *dev;
expression E;
@@
memcpy(E,
- &dev->dev_addr
+ dev->dev_addr
, ...);

@@
expression E;
@@
- &E->dev_addr
+ E->dev_addr


> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Tue, 12 May 2009 17:24:02 +1000
> Subject: [PATCH] net/ibmveth: fix panic in probe
>
> netdev->dev_addr changed from being an array to being a pointer, so we
> should not take its address for memcpy().
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>  drivers/net/ibmveth.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
> index 7902e5e..8daffad 100644
> --- a/drivers/net/ibmveth.c
> +++ b/drivers/net/ibmveth.c
> @@ -1285,7 +1285,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_
>   	netdev->features |= NETIF_F_LLTX;
>  	spin_lock_init(&adapter->stats_lock);
>  
> -	memcpy(&netdev->dev_addr, &adapter->mac_addr, netdev->addr_len);
> +	memcpy(netdev->dev_addr, &adapter->mac_addr, netdev->addr_len);
>  
>  	for(i = 0; i<IbmVethNumBufferPools; i++) {
>  		struct kobject *kobj = &adapter->rx_buff_pool[i].kobj;
>   

maybe this line should be fix too.


@@ -1368,7 +1368,7 @@ static void ibmveth_proc_unregister_driv
 static int ibmveth_show(struct seq_file *seq, void *v)
 {
 	struct ibmveth_adapter *adapter = seq->private;
-	char *current_mac = ((char*) &adapter->netdev->dev_addr);
+	char *current_mac = ((char*) adapter->netdev->dev_addr);
 	char *firmware_mac = ((char*) &adapter->mac_addr) ;
 
 	seq_printf(seq, "%s %s\n\n", ibmveth_driver_string, ibmveth_driver_version);


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Rothwell May 13, 2009, 6:39 a.m. UTC | #3
Hi Dave,

On Tue, 12 May 2009 17:44:51 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Tue, 12 May 2009 17:24:02 +1000
> Subject: [PATCH] net/ibmveth: fix panic in probe
> 
> netdev->dev_addr changed from being an array to being a pointer, so we
> should not take its address for memcpy().

I have applied this to linux-next until you decide what to do with it.
diff mbox

Patch

diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 7902e5e..8daffad 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -1285,7 +1285,7 @@  static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_
  	netdev->features |= NETIF_F_LLTX;
 	spin_lock_init(&adapter->stats_lock);
 
-	memcpy(&netdev->dev_addr, &adapter->mac_addr, netdev->addr_len);
+	memcpy(netdev->dev_addr, &adapter->mac_addr, netdev->addr_len);
 
 	for(i = 0; i<IbmVethNumBufferPools; i++) {
 		struct kobject *kobj = &adapter->rx_buff_pool[i].kobj;