Commit 7dedcca0 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull iBFT fix from Konrad Rzeszutek Wilk:
 "One single fix from Chris to workaround UEFI platforms failing with
  iSCSI IBFT"

* 'stable/for-linus-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/ibft:
  iscsi_ibft: filter null v4-mapped v6 addresses
parents 456fdb26 e6050b61
...@@ -186,8 +186,20 @@ struct ibft_kobject { ...@@ -186,8 +186,20 @@ struct ibft_kobject {
static struct iscsi_boot_kset *boot_kset; static struct iscsi_boot_kset *boot_kset;
/* fully null address */
static const char nulls[16]; static const char nulls[16];
/* IPv4-mapped IPv6 ::ffff:0.0.0.0 */
static const char mapped_nulls[16] = { 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00 };
static int address_not_null(u8 *ip)
{
return (memcmp(ip, nulls, 16) && memcmp(ip, mapped_nulls, 16));
}
/* /*
* Helper functions to parse data properly. * Helper functions to parse data properly.
*/ */
...@@ -445,7 +457,7 @@ static umode_t ibft_check_nic_for(void *data, int type) ...@@ -445,7 +457,7 @@ static umode_t ibft_check_nic_for(void *data, int type)
rc = S_IRUGO; rc = S_IRUGO;
break; break;
case ISCSI_BOOT_ETH_IP_ADDR: case ISCSI_BOOT_ETH_IP_ADDR:
if (memcmp(nic->ip_addr, nulls, sizeof(nic->ip_addr))) if (address_not_null(nic->ip_addr))
rc = S_IRUGO; rc = S_IRUGO;
break; break;
case ISCSI_BOOT_ETH_SUBNET_MASK: case ISCSI_BOOT_ETH_SUBNET_MASK:
...@@ -456,21 +468,19 @@ static umode_t ibft_check_nic_for(void *data, int type) ...@@ -456,21 +468,19 @@ static umode_t ibft_check_nic_for(void *data, int type)
rc = S_IRUGO; rc = S_IRUGO;
break; break;
case ISCSI_BOOT_ETH_GATEWAY: case ISCSI_BOOT_ETH_GATEWAY:
if (memcmp(nic->gateway, nulls, sizeof(nic->gateway))) if (address_not_null(nic->gateway))
rc = S_IRUGO; rc = S_IRUGO;
break; break;
case ISCSI_BOOT_ETH_PRIMARY_DNS: case ISCSI_BOOT_ETH_PRIMARY_DNS:
if (memcmp(nic->primary_dns, nulls, if (address_not_null(nic->primary_dns))
sizeof(nic->primary_dns)))
rc = S_IRUGO; rc = S_IRUGO;
break; break;
case ISCSI_BOOT_ETH_SECONDARY_DNS: case ISCSI_BOOT_ETH_SECONDARY_DNS:
if (memcmp(nic->secondary_dns, nulls, if (address_not_null(nic->secondary_dns))
sizeof(nic->secondary_dns)))
rc = S_IRUGO; rc = S_IRUGO;
break; break;
case ISCSI_BOOT_ETH_DHCP: case ISCSI_BOOT_ETH_DHCP:
if (memcmp(nic->dhcp, nulls, sizeof(nic->dhcp))) if (address_not_null(nic->dhcp))
rc = S_IRUGO; rc = S_IRUGO;
break; break;
case ISCSI_BOOT_ETH_VLAN: case ISCSI_BOOT_ETH_VLAN:
...@@ -536,23 +546,19 @@ static umode_t __init ibft_check_initiator_for(void *data, int type) ...@@ -536,23 +546,19 @@ static umode_t __init ibft_check_initiator_for(void *data, int type)
rc = S_IRUGO; rc = S_IRUGO;
break; break;
case ISCSI_BOOT_INI_ISNS_SERVER: case ISCSI_BOOT_INI_ISNS_SERVER:
if (memcmp(init->isns_server, nulls, if (address_not_null(init->isns_server))
sizeof(init->isns_server)))
rc = S_IRUGO; rc = S_IRUGO;
break; break;
case ISCSI_BOOT_INI_SLP_SERVER: case ISCSI_BOOT_INI_SLP_SERVER:
if (memcmp(init->slp_server, nulls, if (address_not_null(init->slp_server))
sizeof(init->slp_server)))
rc = S_IRUGO; rc = S_IRUGO;
break; break;
case ISCSI_BOOT_INI_PRI_RADIUS_SERVER: case ISCSI_BOOT_INI_PRI_RADIUS_SERVER:
if (memcmp(init->pri_radius_server, nulls, if (address_not_null(init->pri_radius_server))
sizeof(init->pri_radius_server)))
rc = S_IRUGO; rc = S_IRUGO;
break; break;
case ISCSI_BOOT_INI_SEC_RADIUS_SERVER: case ISCSI_BOOT_INI_SEC_RADIUS_SERVER:
if (memcmp(init->sec_radius_server, nulls, if (address_not_null(init->sec_radius_server))
sizeof(init->sec_radius_server)))
rc = S_IRUGO; rc = S_IRUGO;
break; break;
case ISCSI_BOOT_INI_INITIATOR_NAME: case ISCSI_BOOT_INI_INITIATOR_NAME:
......
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