Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci/ixgbe Fix error path in ixgbe_attach() and ixgbe...
details: https://anonhg.NetBSD.org/src/rev/d99085e83f28
branches: trunk
changeset: 809847:d99085e83f28
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Wed Aug 05 03:42:11 2015 +0000
description:
Fix error path in ixgbe_attach() and ixgbe_detatch() to prevent panic.
diffstat:
sys/dev/pci/ixgbe/ixgbe.c | 9 +++++++--
sys/dev/pci/ixgbe/ixgbe_osdep.h | 3 ++-
2 files changed, 9 insertions(+), 3 deletions(-)
diffs (67 lines):
diff -r e411f1c6717c -r d99085e83f28 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Tue Aug 04 18:28:09 2015 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Wed Aug 05 03:42:11 2015 +0000
@@ -59,7 +59,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/*$FreeBSD: head/sys/dev/ixgbe/ixgbe.c 250108 2013-04-30 16:18:29Z luigi $*/
-/*$NetBSD: ixgbe.c,v 1.31 2015/08/03 05:43:01 msaitoh Exp $*/
+/*$NetBSD: ixgbe.c,v 1.32 2015/08/05 03:42:11 msaitoh Exp $*/
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -510,6 +510,7 @@
adapter->osdep.pc = pa->pa_pc;
adapter->osdep.tag = pa->pa_tag;
adapter->osdep.dmat = pa->pa_dmat;
+ adapter->osdep.attached = false;
ent = ixgbe_lookup(pa);
@@ -681,6 +682,7 @@
ixgbe_netmap_attach(adapter);
#endif /* DEV_NETMAP */
INIT_DEBUGOUT("ixgbe_attach: end");
+ adapter->osdep.attached = true;
return;
err_late:
ixgbe_free_transmit_structures(adapter);
@@ -716,6 +718,8 @@
u32 ctrl_ext;
INIT_DEBUGOUT("ixgbe_detach: begin");
+ if (adapter->osdep.attached == false)
+ return 0;
#if NVLAN > 0
/* Make sure VLANs are not using driver */
@@ -2791,7 +2795,8 @@
else
(adapter->msix != 0) ? (rid = 1):(rid = 0);
- pci_intr_disestablish(adapter->osdep.pc, adapter->osdep.intr);
+ if (adapter->osdep.intr != NULL)
+ pci_intr_disestablish(adapter->osdep.pc, adapter->osdep.intr);
adapter->osdep.intr = NULL;
#if defined(NETBSD_MSI_OR_MSIX)
diff -r e411f1c6717c -r d99085e83f28 sys/dev/pci/ixgbe/ixgbe_osdep.h
--- a/sys/dev/pci/ixgbe/ixgbe_osdep.h Tue Aug 04 18:28:09 2015 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_osdep.h Wed Aug 05 03:42:11 2015 +0000
@@ -31,7 +31,7 @@
******************************************************************************/
/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_osdep.h 247822 2013-03-04 23:07:40Z jfv $*/
-/*$NetBSD: ixgbe_osdep.h,v 1.7 2015/04/24 07:00:51 msaitoh Exp $*/
+/*$NetBSD: ixgbe_osdep.h,v 1.8 2015/08/05 03:42:11 msaitoh Exp $*/
#ifndef _IXGBE_OS_H_
#define _IXGBE_OS_H_
@@ -171,6 +171,7 @@
device_t dev;
pci_intr_handle_t ih;
void *intr;
+ bool attached;
};
/* These routines are needed by the shared code */
Home |
Main Index |
Thread Index |
Old Index