linux-next: manual merge of the drivers-x86 tree with Linus' tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

Today's linux-next merge of the drivers-x86 tree got a conflict in:

  drivers/platform/x86/amd/pmf/tee-if.c

between commits:

  3da01394c0f7 ("platform/x86/amd/pmf: Remove smart_pc_status enum")
  20545af302bb ("platform/x86/amd/pmf: Add debugging message for missing policy data")
  e70961505808 ("platform/x86/amd/pmf: Fixup error handling for amd_pmf_init_smart_pc()")

from Linus' tree and commits:

  6ed210504a18 ("platform/x86/amd/pmf: Add missing __iomem attribute to policy_base")
  98cfcece0ab8 ("platform/x86/amd/pmf: Fix return value of amd_pmf_start_policy_engine()")
  a87d92223084 ("platform/x86/amd/pmf: Use struct for cookie header")
  1e7a14ee259e ("platform/x86/amd/pmf: Fix possible out-of-bound memory accesses")

from the drivers-x86 tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/platform/x86/amd/pmf/tee-if.c
index dcbe8f85e122,75370431a82e..000000000000
--- a/drivers/platform/x86/amd/pmf/tee-if.c
+++ b/drivers/platform/x86/amd/pmf/tee-if.c
@@@ -246,19 -246,22 +246,24 @@@ static void amd_pmf_invoke_cmd(struct w
  
  static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev)
  {
- 	u32 cookie, length;
+ 	struct cookie_header *header;
  	int res;
  
- 	cookie = readl(dev->policy_buf + POLICY_COOKIE_OFFSET);
- 	length = readl(dev->policy_buf + POLICY_COOKIE_LEN);
+ 	if (dev->policy_sz < POLICY_COOKIE_OFFSET + sizeof(*header))
+ 		return -EINVAL;
  
- 	if (cookie != POLICY_SIGN_COOKIE || !length) {
+ 	header = (struct cookie_header *)(dev->policy_buf + POLICY_COOKIE_OFFSET);
+ 
 -	if (header->sign != POLICY_SIGN_COOKIE || !header->length)
++	if (header->sign != POLICY_SIGN_COOKIE || !header->length) {
 +		dev_dbg(dev->dev, "cookie doesn't match\n");
  		return -EINVAL;
 +	}
  
+ 	if (dev->policy_sz < header->length + 512)
+ 		return -EINVAL;
+ 
  	/* Update the actual length */
- 	dev->policy_sz = length + 512;
+ 	dev->policy_sz = header->length + 512;
  	res = amd_pmf_invoke_cmd_init(dev);
  	if (res == TA_PMF_TYPE_SUCCESS) {
  		/* Now its safe to announce that smart pc is enabled */
@@@ -270,8 -273,8 +275,8 @@@
  		schedule_delayed_work(&dev->pb_work, msecs_to_jiffies(pb_actions_ms * 3));
  	} else {
  		dev_err(dev->dev, "ta invoke cmd init failed err: %x\n", res);
 -		dev->smart_pc_enabled = PMF_SMART_PC_DISABLED;
 +		dev->smart_pc_enabled = false;
- 		return res;
+ 		return -EIO;
  	}
  
  	return 0;
@@@ -436,46 -458,13 +441,46 @@@ int amd_pmf_init_smart_pc(struct amd_pm
  		return ret;
  
  	INIT_DELAYED_WORK(&dev->pb_work, amd_pmf_invoke_cmd);
 -	amd_pmf_set_dram_addr(dev, true);
 -	amd_pmf_get_bios_buffer(dev);
 -	dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL);
 -	if (!dev->prev_data)
 -		return -ENOMEM;
  
 -	return dev->smart_pc_enabled;
 +	ret = amd_pmf_set_dram_addr(dev, true);
 +	if (ret)
 +		goto error;
 +
 +	dev->policy_base = devm_ioremap(dev->dev, dev->policy_addr, dev->policy_sz);
 +	if (!dev->policy_base) {
 +		ret = -ENOMEM;
 +		goto error;
 +	}
 +
 +	dev->policy_buf = kzalloc(dev->policy_sz, GFP_KERNEL);
 +	if (!dev->policy_buf) {
 +		ret = -ENOMEM;
 +		goto error;
 +	}
 +
- 	memcpy(dev->policy_buf, dev->policy_base, dev->policy_sz);
++	memcpy_fromio(dev->policy_buf, dev->policy_base, dev->policy_sz);
 +
 +	amd_pmf_hex_dump_pb(dev);
 +
 +	dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL);
 +	if (!dev->prev_data) {
 +		ret = -ENOMEM;
 +		goto error;
 +	}
 +
 +	ret = amd_pmf_start_policy_engine(dev);
 +	if (ret)
 +		goto error;
 +
 +	if (pb_side_load)
 +		amd_pmf_open_pb(dev, dev->dbgfs_dir);
 +
 +	return 0;
 +
 +error:
 +	amd_pmf_deinit_smart_pc(dev);
 +
 +	return ret;
  }
  
  void amd_pmf_deinit_smart_pc(struct amd_pmf_dev *dev)

Attachment: pgpxi3NdsL9g0.pgp
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux