Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus-fwctl' of git://git.kernel.org/pub/scm/linux/kernel/git/fwctl/fwctl

Pull fwctl updates from Jason Gunthorpe:

- Fix mismatched kvalloc() kfree() on error paths

- Remove NOP dev_err_probe(), shouldn't print on error paths anyhow

- For mlx5 permit:
MLX5_CMD_OP_MODIFY_CONG_STATUS
MLX5_CMD_OP_QUERY_ADJACENT_FUNCTIONS_ID
MLX5_CMD_OP_DELEGATE_VHCA_MANAGEMENT
MLX5_CMD_OP_QUERY_DELEGATED_VHCA

- Use memdup_user in pds

* tag 'for-linus-fwctl' of git://git.kernel.org/pub/scm/linux/kernel/git/fwctl/fwctl:
pds_fwctl: Replace kzalloc + copy_from_user with memdup_user in pdsfc_fw_rpc
fwctl/mlx5: Add Adjacent function query commands and their scope
fwctl/mlx5: Allow MODIFY_CONG_STATUS command
pds_fwctl: Remove the use of dev_err_probe()
fwctl/mlx5: Fix memory alloc/free in mlx5ctl_fw_rpc()

+13 -14
+8 -1
drivers/fwctl/mlx5/main.c
··· 58 58 MLX5_CMD_OP_QUERY_DC_CNAK_TRACE = 0x716, 59 59 MLX5_CMD_OP_QUERY_NVMF_BACKEND_CONTROLLER = 0x722, 60 60 MLX5_CMD_OP_QUERY_NVMF_NAMESPACE_CONTEXT = 0x728, 61 + MLX5_CMD_OP_QUERY_ADJACENT_FUNCTIONS_ID = 0x730, 62 + MLX5_CMD_OP_DELEGATE_VHCA_MANAGEMENT = 0x731, 63 + MLX5_CMD_OP_QUERY_DELEGATED_VHCA = 0x732, 61 64 MLX5_CMD_OP_QUERY_BURST_SIZE = 0x813, 62 65 MLX5_CMD_OP_QUERY_DIAGNOSTIC_PARAMS = 0x819, 63 66 MLX5_CMD_OP_SET_DIAGNOSTIC_PARAMS = 0x820, ··· 191 188 * filter commands manually for now. 192 189 */ 193 190 switch (opcode) { 191 + case MLX5_CMD_OP_MODIFY_CONG_STATUS: 194 192 case MLX5_CMD_OP_POSTPONE_CONNECTED_QP_TIMEOUT: 195 193 case MLX5_CMD_OP_QUERY_ADAPTER: 196 194 case MLX5_CMD_OP_QUERY_ESW_FUNCTIONS: ··· 200 196 case MLX5_CMD_OP_QUERY_OTHER_HCA_CAP: 201 197 case MLX5_CMD_OP_QUERY_ROCE_ADDRESS: 202 198 case MLX5_CMD_OPCODE_QUERY_VUID: 199 + case MLX5_CMD_OP_DELEGATE_VHCA_MANAGEMENT: 203 200 /* 204 201 * FW limits SET_HCA_CAP on the tools UID to only the other function 205 202 * mode which is used for function pre-configuration ··· 286 281 case MLX5_CMD_OP_QUERY_XRQ: 287 282 case MLX5_CMD_OP_USER_QUERY_XRQ_DC_PARAMS_ENTRY: 288 283 case MLX5_CMD_OP_USER_QUERY_XRQ_ERROR_PARAMS: 284 + case MLX5_CMD_OP_QUERY_ADJACENT_FUNCTIONS_ID: 285 + case MLX5_CMD_OP_QUERY_DELEGATED_VHCA: 289 286 return scope >= FWCTL_RPC_DEBUG_READ_ONLY; 290 287 291 288 case MLX5_CMD_OP_SET_DIAGNOSTIC_PARAMS: ··· 352 345 */ 353 346 if (ret && ret != -EREMOTEIO) { 354 347 if (rpc_out != rpc_in) 355 - kfree(rpc_out); 348 + kvfree(rpc_out); 356 349 return ERR_PTR(ret); 357 350 } 358 351 return rpc_out;
+5 -13
drivers/fwctl/pds/main.c
··· 6 6 #include <linux/pci.h> 7 7 #include <linux/vmalloc.h> 8 8 #include <linux/bitfield.h> 9 + #include <linux/string.h> 9 10 10 11 #include <uapi/fwctl/fwctl.h> 11 12 #include <uapi/fwctl/pds.h> ··· 367 366 return ERR_PTR(err); 368 367 369 368 if (rpc->in.len > 0) { 370 - in_payload = kzalloc(rpc->in.len, GFP_KERNEL); 371 - if (!in_payload) { 372 - dev_err(dev, "Failed to allocate in_payload\n"); 373 - err = -ENOMEM; 374 - goto err_out; 375 - } 376 - 377 - if (copy_from_user(in_payload, u64_to_user_ptr(rpc->in.payload), 378 - rpc->in.len)) { 369 + in_payload = memdup_user(u64_to_user_ptr(rpc->in.payload), rpc->in.len); 370 + if (IS_ERR(in_payload)) { 379 371 dev_dbg(dev, "Failed to copy in_payload from user\n"); 380 - err = -EFAULT; 381 - goto err_in_payload; 372 + return in_payload; 382 373 } 383 374 384 375 in_payload_dma_addr = dma_map_single(dev->parent, in_payload, ··· 446 453 rpc->in.len, DMA_TO_DEVICE); 447 454 err_in_payload: 448 455 kfree(in_payload); 449 - err_out: 450 456 if (err) 451 457 return ERR_PTR(err); 452 458 ··· 473 481 pdsfc = fwctl_alloc_device(&padev->vf_pdev->dev, &pdsfc_ops, 474 482 struct pdsfc_dev, fwctl); 475 483 if (!pdsfc) 476 - return dev_err_probe(dev, -ENOMEM, "Failed to allocate fwctl device struct\n"); 484 + return -ENOMEM; 477 485 pdsfc->padev = padev; 478 486 479 487 err = pdsfc_identify(pdsfc);