Commit 7159e969 authored by Ed Cashin's avatar Ed Cashin Committed by Linus Torvalds

aoe: update and specify AoE address guards and error messages

In general, specific is better when it comes to messages about AoE usage
problems.  Also, explicit checks for the AoE broadcast addresses are
added.
Signed-off-by: default avatarEd Cashin <ecashin@coraid.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4bcce1a3
...@@ -49,8 +49,6 @@ struct aoe_hdr { ...@@ -49,8 +49,6 @@ struct aoe_hdr {
__be32 tag; __be32 tag;
}; };
#define AOE_MAXSHELF (0xffff-1) /* one less than the broadcast shelf address */
struct aoe_atahdr { struct aoe_atahdr {
unsigned char aflags; unsigned char aflags;
unsigned char errfeat; unsigned char errfeat;
......
...@@ -1349,15 +1349,14 @@ aoecmd_cfg_rsp(struct sk_buff *skb) ...@@ -1349,15 +1349,14 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
"Check shelf dip switches.\n"); "Check shelf dip switches.\n");
return; return;
} }
if (aoemajor > AOE_MAXSHELF) { if (aoemajor == 0xffff) {
pr_info("aoe: e%ld.%d: shelf number too large\n", pr_info("aoe: e%ld.%d: broadcast shelf number invalid\n",
aoemajor, (int) h->minor); aoemajor, (int) h->minor);
return; return;
} }
if (h->minor == 0xff) {
d = aoedev_by_aoeaddr(aoemajor, h->minor, 1); pr_info("aoe: e%ld.%d: broadcast slot number invalid\n",
if (d == NULL) { aoemajor, (int) h->minor);
pr_info("aoe: device allocation failure\n");
return; return;
} }
...@@ -1365,6 +1364,12 @@ aoecmd_cfg_rsp(struct sk_buff *skb) ...@@ -1365,6 +1364,12 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
if (n > aoe_maxout) /* keep it reasonable */ if (n > aoe_maxout) /* keep it reasonable */
n = aoe_maxout; n = aoe_maxout;
d = aoedev_by_aoeaddr(aoemajor, h->minor, 1);
if (d == NULL) {
pr_info("aoe: device allocation failure\n");
return;
}
spin_lock_irqsave(&d->lock, flags); spin_lock_irqsave(&d->lock, flags);
t = gettgt(d, h->src); t = gettgt(d, h->src);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment