When we startup fcoe check that we actually has an interface name and warn and abort othervise instead of just throwing a SEGV.
>From b69d97a9888fe36c3a552ff64afe24224bdb8f27 Mon Sep 17 00:00:00 2001
From: Ronnie Sahlberg <[EMAIL PROTECTED]>
Date: Tue, 24 Jun 2008 13:35:05 +1000
Subject: [PATCH 2/2] when we start up fcoe on an interface, check that
we actually have an
interface name passed to us and print an error and return -ENODEV
othervise.
Othervise we will SEGV trying to memcpy() from a null pointer 1 line
further down.
When we initialize fcoe from the fcoe module, return proper success/failure
back to tgtd so that it can abort/fail if the low level driver failed
to initialize.
Signed-off-by: Ronnie Sahlberg <[EMAIL PROTECTED]>
Signed-off-by: root <[EMAIL PROTECTED]>
---
usr/fcoe/fcoe_if.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/usr/fcoe/fcoe_if.c b/usr/fcoe/fcoe_if.c
index 906c30b..cc61408 100644
--- a/usr/fcoe/fcoe_if.c
+++ b/usr/fcoe/fcoe_if.c
@@ -164,6 +164,11 @@ int fcoe_create_interface(char *ifname)
/* todo */
fdev->fd_link_status = TRANS_LINK_UP;
+ if (!ifname) {
+ eprintf("no interface specified.\n");
+ return -ENODEV;
+ }
+
memcpy(fdev->ifname, ifname, IFNAMSIZ);
ret = fcoe_sock_open(fdev);
@@ -204,9 +209,7 @@ int fcoe_create_interface(char *ifname)
static int fcoe_init(int index, char *args)
{
eprintf("%s\n", args);
- fcoe_create_interface(args);
-
- return 0;
+ return fcoe_create_interface(args);
}
static struct tgt_driver fcoe = {
--
1.5.4.3
0002-when-we-start-up-fcoe-on-an-interface-check-that-we.patch.gz
Description: GNU Zip compressed data
_______________________________________________ Stgt-devel mailing list [email protected] https://lists.berlios.de/mailman/listinfo/stgt-devel
