Driver core fixes for 6.2-rc5

Here are 3 small driver and kernel core fixes for 6.2-rc5.  They
 include:
   - potential gadget fixup in do_prlimit
   - device property refcount leak fix
   - test_async_probe bugfix for reported problem.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCY8wB5g8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+yl+5ACfbXPXK7nokMtxvs/9ybhH+IM63X0AmwYXZ5mK
 3dCNVFru/lAZzS7HaR5F
 =4fuA
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core fixes from Greg KH:
 "Here are three small driver and kernel core fixes for 6.2-rc5. They
  include:

   - potential gadget fixup in do_prlimit

   - device property refcount leak fix

   - test_async_probe bugfix for reported problem"

* tag 'driver-core-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  prlimit: do_prlimit needs to have a speculation check
  driver core: Fix test_async_probe_init saves device in wrong array
  device property: fix of node refcount leak in fwnode_graph_get_next_endpoint()
This commit is contained in:
Linus Torvalds 2023-01-21 11:17:23 -08:00
commit c88a311470
3 changed files with 15 additions and 7 deletions

View File

@ -997,26 +997,32 @@ struct fwnode_handle *
fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode, fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
struct fwnode_handle *prev) struct fwnode_handle *prev)
{ {
struct fwnode_handle *ep, *port_parent = NULL;
const struct fwnode_handle *parent; const struct fwnode_handle *parent;
struct fwnode_handle *ep;
/* /*
* If this function is in a loop and the previous iteration returned * If this function is in a loop and the previous iteration returned
* an endpoint from fwnode->secondary, then we need to use the secondary * an endpoint from fwnode->secondary, then we need to use the secondary
* as parent rather than @fwnode. * as parent rather than @fwnode.
*/ */
if (prev) if (prev) {
parent = fwnode_graph_get_port_parent(prev); port_parent = fwnode_graph_get_port_parent(prev);
else parent = port_parent;
} else {
parent = fwnode; parent = fwnode;
}
if (IS_ERR_OR_NULL(parent)) if (IS_ERR_OR_NULL(parent))
return NULL; return NULL;
ep = fwnode_call_ptr_op(parent, graph_get_next_endpoint, prev); ep = fwnode_call_ptr_op(parent, graph_get_next_endpoint, prev);
if (ep) if (ep)
return ep; goto out_put_port_parent;
return fwnode_graph_get_next_endpoint(parent->secondary, NULL); ep = fwnode_graph_get_next_endpoint(parent->secondary, NULL);
out_put_port_parent:
fwnode_handle_put(port_parent);
return ep;
} }
EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint); EXPORT_SYMBOL_GPL(fwnode_graph_get_next_endpoint);

View File

@ -145,7 +145,7 @@ static int __init test_async_probe_init(void)
calltime = ktime_get(); calltime = ktime_get();
for_each_online_cpu(cpu) { for_each_online_cpu(cpu) {
nid = cpu_to_node(cpu); nid = cpu_to_node(cpu);
pdev = &sync_dev[sync_id]; pdev = &async_dev[async_id];
*pdev = test_platform_device_register_node("test_async_driver", *pdev = test_platform_device_register_node("test_async_driver",
async_id, async_id,

View File

@ -1442,6 +1442,8 @@ static int do_prlimit(struct task_struct *tsk, unsigned int resource,
if (resource >= RLIM_NLIMITS) if (resource >= RLIM_NLIMITS)
return -EINVAL; return -EINVAL;
resource = array_index_nospec(resource, RLIM_NLIMITS);
if (new_rlim) { if (new_rlim) {
if (new_rlim->rlim_cur > new_rlim->rlim_max) if (new_rlim->rlim_cur > new_rlim->rlim_max)
return -EINVAL; return -EINVAL;