Skip to content

Commit da94001

Browse files
committed
Merge tag 'char-misc-5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH: "Here are some small char/misc driver fixes for 5.4-rc3. Nothing huge here. Some binder driver fixes (although it is still being discussed if these all fix the reported issues or not, so more might be coming later), some mei device ids and fixes, and a google firmware driver bugfix that fixes a regression, as well as some other tiny fixes. All have been in linux-next with no reported issues" * tag 'char-misc-5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: firmware: google: increment VPD key_len properly w1: ds250x: Fix build error without CRC16 virt: vbox: fix memory leak in hgcm_call_preprocess_linaddr binder: Fix comment headers on binder_alloc_prepare_to_free() binder: prevent UAF read in print_binder_transaction_log_entry() misc: fastrpc: prevent memory leak in fastrpc_dma_buf_attach mei: avoid FW version request on Ibex Peak and earlier mei: me: add comet point (lake) LP device ids
2 parents 9cbc634 + 442f1e7 commit da94001

File tree

13 files changed

+60
-18
lines changed

13 files changed

+60
-18
lines changed

drivers/android/binder.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#include <linux/sched/signal.h>
5858
#include <linux/sched/mm.h>
5959
#include <linux/seq_file.h>
60+
#include <linux/string.h>
6061
#include <linux/uaccess.h>
6162
#include <linux/pid_namespace.h>
6263
#include <linux/security.h>
@@ -66,6 +67,7 @@
6667
#include <linux/task_work.h>
6768

6869
#include <uapi/linux/android/binder.h>
70+
#include <uapi/linux/android/binderfs.h>
6971

7072
#include <asm/cacheflush.h>
7173

@@ -2876,7 +2878,7 @@ static void binder_transaction(struct binder_proc *proc,
28762878
e->target_handle = tr->target.handle;
28772879
e->data_size = tr->data_size;
28782880
e->offsets_size = tr->offsets_size;
2879-
e->context_name = proc->context->name;
2881+
strscpy(e->context_name, proc->context->name, BINDERFS_MAX_NAME);
28802882

28812883
if (reply) {
28822884
binder_inner_proc_lock(proc);

drivers/android/binder_alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static struct binder_buffer *binder_alloc_prepare_to_free_locked(
156156
}
157157

158158
/**
159-
* binder_alloc_buffer_lookup() - get buffer given user ptr
159+
* binder_alloc_prepare_to_free() - get buffer given user ptr
160160
* @alloc: binder_alloc for this proc
161161
* @user_ptr: User pointer to buffer data
162162
*

drivers/android/binder_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ struct binder_transaction_log_entry {
130130
int return_error_line;
131131
uint32_t return_error;
132132
uint32_t return_error_param;
133-
const char *context_name;
133+
char context_name[BINDERFS_MAX_NAME + 1];
134134
};
135135

136136
struct binder_transaction_log {

drivers/firmware/google/vpd_decode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static int vpd_decode_entry(const u32 max_len, const u8 *input_buf,
5252
if (max_len - consumed < *entry_len)
5353
return VPD_FAIL;
5454

55-
consumed += decoded_len;
55+
consumed += *entry_len;
5656
*_consumed = consumed;
5757
return VPD_OK;
5858
}

drivers/misc/fastrpc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ static int fastrpc_dma_buf_attach(struct dma_buf *dmabuf,
527527
FASTRPC_PHYS(buffer->phys), buffer->size);
528528
if (ret < 0) {
529529
dev_err(buffer->dev, "failed to get scatterlist from DMA API\n");
530+
kfree(a);
530531
return -EINVAL;
531532
}
532533

drivers/misc/mei/bus-fixup.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,21 @@ static void mei_mkhi_fix(struct mei_cl_device *cldev)
218218
{
219219
int ret;
220220

221+
/* No need to enable the client if nothing is needed from it */
222+
if (!cldev->bus->fw_f_fw_ver_supported &&
223+
!cldev->bus->hbm_f_os_supported)
224+
return;
225+
221226
ret = mei_cldev_enable(cldev);
222227
if (ret)
223228
return;
224229

225-
ret = mei_fwver(cldev);
226-
if (ret < 0)
227-
dev_err(&cldev->dev, "FW version command failed %d\n", ret);
230+
if (cldev->bus->fw_f_fw_ver_supported) {
231+
ret = mei_fwver(cldev);
232+
if (ret < 0)
233+
dev_err(&cldev->dev, "FW version command failed %d\n",
234+
ret);
235+
}
228236

229237
if (cldev->bus->hbm_f_os_supported) {
230238
ret = mei_osver(cldev);

drivers/misc/mei/hw-me-regs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@
7979
#define MEI_DEV_ID_CNP_H 0xA360 /* Cannon Point H */
8080
#define MEI_DEV_ID_CNP_H_4 0xA364 /* Cannon Point H 4 (iTouch) */
8181

82+
#define MEI_DEV_ID_CMP_LP 0x02e0 /* Comet Point LP */
83+
#define MEI_DEV_ID_CMP_LP_3 0x02e4 /* Comet Point LP 3 (iTouch) */
84+
8285
#define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */
8386

8487
#define MEI_DEV_ID_TGP_LP 0xA0E0 /* Tiger Lake Point LP */

drivers/misc/mei/hw-me.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,8 @@ static bool mei_me_fw_type_sps(struct pci_dev *pdev)
13551355
#define MEI_CFG_FW_SPS \
13561356
.quirk_probe = mei_me_fw_type_sps
13571357

1358+
#define MEI_CFG_FW_VER_SUPP \
1359+
.fw_ver_supported = 1
13581360

13591361
#define MEI_CFG_ICH_HFS \
13601362
.fw_status.count = 0
@@ -1392,31 +1394,41 @@ static const struct mei_cfg mei_me_ich10_cfg = {
13921394
MEI_CFG_ICH10_HFS,
13931395
};
13941396

1395-
/* PCH devices */
1396-
static const struct mei_cfg mei_me_pch_cfg = {
1397+
/* PCH6 devices */
1398+
static const struct mei_cfg mei_me_pch6_cfg = {
13971399
MEI_CFG_PCH_HFS,
13981400
};
13991401

1402+
/* PCH7 devices */
1403+
static const struct mei_cfg mei_me_pch7_cfg = {
1404+
MEI_CFG_PCH_HFS,
1405+
MEI_CFG_FW_VER_SUPP,
1406+
};
1407+
14001408
/* PCH Cougar Point and Patsburg with quirk for Node Manager exclusion */
14011409
static const struct mei_cfg mei_me_pch_cpt_pbg_cfg = {
14021410
MEI_CFG_PCH_HFS,
1411+
MEI_CFG_FW_VER_SUPP,
14031412
MEI_CFG_FW_NM,
14041413
};
14051414

14061415
/* PCH8 Lynx Point and newer devices */
14071416
static const struct mei_cfg mei_me_pch8_cfg = {
14081417
MEI_CFG_PCH8_HFS,
1418+
MEI_CFG_FW_VER_SUPP,
14091419
};
14101420

14111421
/* PCH8 Lynx Point with quirk for SPS Firmware exclusion */
14121422
static const struct mei_cfg mei_me_pch8_sps_cfg = {
14131423
MEI_CFG_PCH8_HFS,
1424+
MEI_CFG_FW_VER_SUPP,
14141425
MEI_CFG_FW_SPS,
14151426
};
14161427

14171428
/* Cannon Lake and newer devices */
14181429
static const struct mei_cfg mei_me_pch12_cfg = {
14191430
MEI_CFG_PCH8_HFS,
1431+
MEI_CFG_FW_VER_SUPP,
14201432
MEI_CFG_DMA_128,
14211433
};
14221434

@@ -1428,7 +1440,8 @@ static const struct mei_cfg *const mei_cfg_list[] = {
14281440
[MEI_ME_UNDEF_CFG] = NULL,
14291441
[MEI_ME_ICH_CFG] = &mei_me_ich_cfg,
14301442
[MEI_ME_ICH10_CFG] = &mei_me_ich10_cfg,
1431-
[MEI_ME_PCH_CFG] = &mei_me_pch_cfg,
1443+
[MEI_ME_PCH6_CFG] = &mei_me_pch6_cfg,
1444+
[MEI_ME_PCH7_CFG] = &mei_me_pch7_cfg,
14321445
[MEI_ME_PCH_CPT_PBG_CFG] = &mei_me_pch_cpt_pbg_cfg,
14331446
[MEI_ME_PCH8_CFG] = &mei_me_pch8_cfg,
14341447
[MEI_ME_PCH8_SPS_CFG] = &mei_me_pch8_sps_cfg,
@@ -1473,6 +1486,8 @@ struct mei_device *mei_me_dev_init(struct pci_dev *pdev,
14731486
mei_device_init(dev, &pdev->dev, &mei_me_hw_ops);
14741487
hw->cfg = cfg;
14751488

1489+
dev->fw_f_fw_ver_supported = cfg->fw_ver_supported;
1490+
14761491
return dev;
14771492
}
14781493

drivers/misc/mei/hw-me.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@
2020
* @fw_status: FW status
2121
* @quirk_probe: device exclusion quirk
2222
* @dma_size: device DMA buffers size
23+
* @fw_ver_supported: is fw version retrievable from FW
2324
*/
2425
struct mei_cfg {
2526
const struct mei_fw_status fw_status;
2627
bool (*quirk_probe)(struct pci_dev *pdev);
2728
size_t dma_size[DMA_DSCR_NUM];
29+
u32 fw_ver_supported:1;
2830
};
2931

3032

@@ -62,7 +64,8 @@ struct mei_me_hw {
6264
* @MEI_ME_UNDEF_CFG: Lower sentinel.
6365
* @MEI_ME_ICH_CFG: I/O Controller Hub legacy devices.
6466
* @MEI_ME_ICH10_CFG: I/O Controller Hub platforms Gen10
65-
* @MEI_ME_PCH_CFG: Platform Controller Hub platforms (Up to Gen8).
67+
* @MEI_ME_PCH6_CFG: Platform Controller Hub platforms (Gen6).
68+
* @MEI_ME_PCH7_CFG: Platform Controller Hub platforms (Gen7).
6669
* @MEI_ME_PCH_CPT_PBG_CFG:Platform Controller Hub workstations
6770
* with quirk for Node Manager exclusion.
6871
* @MEI_ME_PCH8_CFG: Platform Controller Hub Gen8 and newer
@@ -77,7 +80,8 @@ enum mei_cfg_idx {
7780
MEI_ME_UNDEF_CFG,
7881
MEI_ME_ICH_CFG,
7982
MEI_ME_ICH10_CFG,
80-
MEI_ME_PCH_CFG,
83+
MEI_ME_PCH6_CFG,
84+
MEI_ME_PCH7_CFG,
8185
MEI_ME_PCH_CPT_PBG_CFG,
8286
MEI_ME_PCH8_CFG,
8387
MEI_ME_PCH8_SPS_CFG,

drivers/misc/mei/mei_dev.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,8 @@ struct mei_fw_version {
426426
*
427427
* @fw_ver : FW versions
428428
*
429+
* @fw_f_fw_ver_supported : fw feature: fw version supported
430+
*
429431
* @me_clients_rwsem: rw lock over me_clients list
430432
* @me_clients : list of FW clients
431433
* @me_clients_map : FW clients bit map
@@ -506,6 +508,8 @@ struct mei_device {
506508

507509
struct mei_fw_version fw_ver[MEI_MAX_FW_VER_BLOCKS];
508510

511+
unsigned int fw_f_fw_ver_supported:1;
512+
509513
struct rw_semaphore me_clients_rwsem;
510514
struct list_head me_clients;
511515
DECLARE_BITMAP(me_clients_map, MEI_CLIENTS_MAX);

0 commit comments

Comments
 (0)