Commit 1716f536 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'stable/for-linus-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/ibft

Pull ibft update from Konrad Rzeszutek Wilk:
 "Adhere to the iBFT spec and extend the structure to handle more
  than two NICs"

* 'stable/for-linus-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/ibft:
  iscsi_ibft: Don't limits Targets and NICs to two
parents a6d5f9dc c0840603
...@@ -104,6 +104,7 @@ struct ibft_control { ...@@ -104,6 +104,7 @@ struct ibft_control {
u16 tgt0_off; u16 tgt0_off;
u16 nic1_off; u16 nic1_off;
u16 tgt1_off; u16 tgt1_off;
u16 expansion[0];
} __attribute__((__packed__)); } __attribute__((__packed__));
struct ibft_initiator { struct ibft_initiator {
...@@ -235,7 +236,7 @@ static int ibft_verify_hdr(char *t, struct ibft_hdr *hdr, int id, int length) ...@@ -235,7 +236,7 @@ static int ibft_verify_hdr(char *t, struct ibft_hdr *hdr, int id, int length)
"found %d instead!\n", t, id, hdr->id); "found %d instead!\n", t, id, hdr->id);
return -ENODEV; return -ENODEV;
} }
if (hdr->length != length) { if (length && hdr->length != length) {
printk(KERN_ERR "iBFT error: We expected the %s " \ printk(KERN_ERR "iBFT error: We expected the %s " \
"field header.length to have %d but " \ "field header.length to have %d but " \
"found %d instead!\n", t, length, hdr->length); "found %d instead!\n", t, length, hdr->length);
...@@ -749,16 +750,16 @@ static int __init ibft_register_kobjects(struct acpi_table_ibft *header) ...@@ -749,16 +750,16 @@ static int __init ibft_register_kobjects(struct acpi_table_ibft *header)
control = (void *)header + sizeof(*header); control = (void *)header + sizeof(*header);
end = (void *)control + control->hdr.length; end = (void *)control + control->hdr.length;
eot_offset = (void *)header + header->header.length - (void *)control; eot_offset = (void *)header + header->header.length - (void *)control;
rc = ibft_verify_hdr("control", (struct ibft_hdr *)control, id_control, rc = ibft_verify_hdr("control", (struct ibft_hdr *)control, id_control, 0);
sizeof(*control));
/* iBFT table safety checking */ /* iBFT table safety checking */
rc |= ((control->hdr.index) ? -ENODEV : 0); rc |= ((control->hdr.index) ? -ENODEV : 0);
rc |= ((control->hdr.length < sizeof(*control)) ? -ENODEV : 0);
if (rc) { if (rc) {
printk(KERN_ERR "iBFT error: Control header is invalid!\n"); printk(KERN_ERR "iBFT error: Control header is invalid!\n");
return rc; return rc;
} }
for (ptr = &control->initiator_off; ptr < end; ptr += sizeof(u16)) { for (ptr = &control->initiator_off; ptr + sizeof(u16) <= end; ptr += sizeof(u16)) {
offset = *(u16 *)ptr; offset = *(u16 *)ptr;
if (offset && offset < header->header.length && if (offset && offset < header->header.length &&
offset < eot_offset) { offset < eot_offset) {
......
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