Skip to content

Commit 5786282

Browse files
committed
Merge tag 'v6.1.147' into orange-pi-6.1-rk35xx
This is the 6.1.147 stable release * tag 'v6.1.147' of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux: Linux 6.1.147 nvmem: layouts: u-boot-env: remove crc32 endianness conversion mm/vmalloc: leave lazy MMU mode on PTE mapping error Bluetooth: HCI: Set extended advertising data synchronously ASoC: fsl_sai: Force a software reset when starting in consumer mode usb: dwc3: qcom: Don't leave BCR asserted usb: musb: fix gadget state on disconnect usb: musb: Add and use inline functions musb_{get,set}_state usb: hub: Don't try to recover devices lost during warm reset. usb: hub: Fix flushing of delayed work used for post resume purposes usb: hub: Fix flushing and scheduling of delayed work that tunes runtime pm usb: hub: fix detection of high tier USB3 devices behind suspended hubs clone_private_mnt(): make sure that caller has CAP_SYS_ADMIN in the right userns HID: mcp2221: Set driver data before I2C adapter add sched: Change nr_uninterruptible type to unsigned long Revert "cgroup_freezer: cgroup_freezing: Check if not frozen" net/sched: Return NULL when htb_lookup_leaf encounters an empty rbtree net: bridge: Do not offload IGMP/MLD messages net: vlan: fix VLAN 0 refcount imbalance of toggling filtering during runtime tls: always refresh the queue when reading sock Bluetooth: L2CAP: Fix attempting to adjust outgoing MTU netfilter: nf_conntrack: fix crash due to removal of uninitialised entry ipv6: mcast: Delay put pmc->idev in mld_del_delrec() net/mlx5: Correctly set gso_size when LRO is used Bluetooth: btusb: QCA: Fix downloading wrong NVM for WCN6855 GF variant without board ID Bluetooth: SMP: Fix using HCI_ERROR_REMOTE_USER_TERM on timeout Bluetooth: SMP: If an unallowed command is received consider it a failure Bluetooth: hci_sync: fix connectable extended advertising when using static random address Bluetooth: Fix null-ptr-deref in l2cap_sock_resume_cb() usb: net: sierra: check for no status endpoint hwmon: (corsair-cpro) Validate the size of the received input buffer selftests: net: increase inter-packet timeout in udpgro.sh nvme: fix misaccounting of nvme-mpath inflight I/O smb: client: fix use-after-free in cifs_oplock_break rpl: Fix use-after-free in rpl_do_srh_inline(). net/sched: sch_qfq: Fix race condition on qfq_aggregate net: emaclite: Fix missing pointer increment in aligned_read() cachefiles: Fix the incorrect return value in __cachefiles_write() bpf: Reject %p% format string in bprintf-like helpers comedi: Fix initialization of data for instructions that write to subdevice comedi: Fix use of uninitialized data in insn_rw_emulate_bits() comedi: Fix some signed shift left operations comedi: Fail COMEDI_INSNLIST ioctl if n_insns is too large comedi: das6402: Fix bit shift out of bounds comedi: das16m1: Fix bit shift out of bounds comedi: aio_iiro_16: Fix bit shift out of bounds comedi: pcl812: Fix bit shift out of bounds iio: adc: stm32-adc: Fix race in installing chained IRQ handler iio: adc: max1363: Reorder mode_list[] entries iio: adc: max1363: Fix MAX1363_4X_CHANS/MAX1363_8X_CHANS[] iio: accel: fxls8962af: Fix use after free in fxls8962af_fifo_flush soc: aspeed: lpc-snoop: Don't disable channels that aren't enabled soc: aspeed: lpc-snoop: Cleanup resources in stack-order smb: client: fix use-after-free in crypt_message when using async crypto pmdomain: governor: Consider CPU latency tolerance from pm_domain_cpu_gov mmc: sdhci_am654: Workaround for Errata i2312 mmc: sdhci-pci: Quirk for broken command queuing on Intel GLK-based Positivo models mmc: bcm2835: Fix dma_unmap_sg() nents value memstick: core: Zero initialize id_reg in h_memstick_read_dev_id() isofs: Verify inode mode when loading from disk dmaengine: nbpfaxi: Fix memory corruption in probe() af_packet: fix soft lockup issue caused by tpacket_snd() af_packet: fix the SO_SNDTIMEO constraint not effective on tpacked_snd() arm64: dts: freescale: imx8mm-verdin: Keep LDO5 always on net/mlx5: Update the list of the PCI supported devices phonet/pep: Move call to pn_skb_get_dst_sockaddr() earlier in pep_sock_accept() io_uring/poll: fix POLLERR handling tracing: Add down_write(trace_event_sem) when adding trace event HID: core: do not bypass hid_hw_raw_request HID: core: ensure __hid_request reserves the report ID as the first byte HID: core: ensure the allocated report buffer can contain the reserved report ID pch_uart: Fix dma_sync_sg_for_device() nents value Input: xpad - set correct controller type for Acer NGR200 thunderbolt: Fix bit masking in tb_dp_port_set_hops() i2c: stm32: fix the device used for the DMA map usb: gadget: configfs: Fix OOB read on empty string write USB: serial: ftdi_sio: add support for NDI EMGUIDE GEMINI USB: serial: option: add Foxconn T99W640 USB: serial: option: add Telit Cinterion FE910C04 (ECM) composition phy: tegra: xusb: Fix unbalanced regulator disable in UTMI PHY mode Signed-off-by: Khusika Dhamar Gusti <[email protected]>
2 parents 0429d7f + 3594f30 commit 5786282

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+741
-417
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
VERSION = 6
33
PATCHLEVEL = 1
4-
SUBLEVEL = 146
4+
SUBLEVEL = 147
55
EXTRAVERSION =
66
NAME = Curry Ramen
77

arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@
466466
};
467467

468468
reg_nvcc_sd: LDO5 {
469+
regulator-always-on;
469470
regulator-max-microvolt = <3300000>;
470471
regulator-min-microvolt = <1800000>;
471472
regulator-name = "On-module +V3.3_1.8_SD (LDO5)";

drivers/base/power/domain_governor.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/pm_domain.h>
99
#include <linux/pm_qos.h>
1010
#include <linux/hrtimer.h>
11+
#include <linux/cpu.h>
1112
#include <linux/cpuidle.h>
1213
#include <linux/cpumask.h>
1314
#include <linux/ktime.h>
@@ -345,6 +346,8 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd)
345346
struct cpuidle_device *dev;
346347
ktime_t domain_wakeup, next_hrtimer;
347348
ktime_t now = ktime_get();
349+
struct device *cpu_dev;
350+
s64 cpu_constraint, global_constraint;
348351
s64 idle_duration_ns;
349352
int cpu, i;
350353

@@ -355,6 +358,7 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd)
355358
if (!(genpd->flags & GENPD_FLAG_CPU_DOMAIN))
356359
return true;
357360

361+
global_constraint = cpu_latency_qos_limit();
358362
/*
359363
* Find the next wakeup for any of the online CPUs within the PM domain
360364
* and its subdomains. Note, we only need the genpd->cpus, as it already
@@ -368,8 +372,16 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd)
368372
if (ktime_before(next_hrtimer, domain_wakeup))
369373
domain_wakeup = next_hrtimer;
370374
}
375+
376+
cpu_dev = get_cpu_device(cpu);
377+
if (cpu_dev) {
378+
cpu_constraint = dev_pm_qos_raw_resume_latency(cpu_dev);
379+
if (cpu_constraint < global_constraint)
380+
global_constraint = cpu_constraint;
381+
}
371382
}
372383

384+
global_constraint *= NSEC_PER_USEC;
373385
/* The minimum idle duration is from now - until the next wakeup. */
374386
idle_duration_ns = ktime_to_ns(ktime_sub(domain_wakeup, now));
375387
if (idle_duration_ns <= 0)
@@ -382,8 +394,10 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd)
382394
*/
383395
i = genpd->state_idx;
384396
do {
385-
if (idle_duration_ns >= (genpd->states[i].residency_ns +
386-
genpd->states[i].power_off_latency_ns)) {
397+
if ((idle_duration_ns >= (genpd->states[i].residency_ns +
398+
genpd->states[i].power_off_latency_ns)) &&
399+
(global_constraint >= (genpd->states[i].power_on_latency_ns +
400+
genpd->states[i].power_off_latency_ns))) {
387401
genpd->state_idx = i;
388402
return true;
389403
}

drivers/bluetooth/btusb.c

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3251,6 +3251,32 @@ static const struct qca_device_info qca_devices_table[] = {
32513251
{ 0x00190200, 40, 4, 16 }, /* WCN785x 2.0 */
32523252
};
32533253

3254+
static u16 qca_extract_board_id(const struct qca_version *ver)
3255+
{
3256+
u16 flag = le16_to_cpu(ver->flag);
3257+
u16 board_id = 0;
3258+
3259+
if (((flag >> 8) & 0xff) == QCA_FLAG_MULTI_NVM) {
3260+
/* The board_id should be split into two bytes
3261+
* The 1st byte is chip ID, and the 2nd byte is platform ID
3262+
* For example, board ID 0x010A, 0x01 is platform ID. 0x0A is chip ID
3263+
* we have several platforms, and platform IDs are continuously added
3264+
* Platform ID:
3265+
* 0x00 is for Mobile
3266+
* 0x01 is for X86
3267+
* 0x02 is for Automotive
3268+
* 0x03 is for Consumer electronic
3269+
*/
3270+
board_id = (ver->chip_id << 8) + ver->platform_id;
3271+
}
3272+
3273+
/* Take 0xffff as invalid board ID */
3274+
if (board_id == 0xffff)
3275+
board_id = 0;
3276+
3277+
return board_id;
3278+
}
3279+
32543280
static int btusb_qca_send_vendor_req(struct usb_device *udev, u8 request,
32553281
void *data, u16 size)
32563282
{
@@ -3407,44 +3433,28 @@ static void btusb_generate_qca_nvm_name(char *fwname, size_t max_size,
34073433
const struct qca_version *ver)
34083434
{
34093435
u32 rom_version = le32_to_cpu(ver->rom_version);
3410-
u16 flag = le16_to_cpu(ver->flag);
3436+
const char *variant;
3437+
int len;
3438+
u16 board_id;
34113439

3412-
if (((flag >> 8) & 0xff) == QCA_FLAG_MULTI_NVM) {
3413-
/* The board_id should be split into two bytes
3414-
* The 1st byte is chip ID, and the 2nd byte is platform ID
3415-
* For example, board ID 0x010A, 0x01 is platform ID. 0x0A is chip ID
3416-
* we have several platforms, and platform IDs are continuously added
3417-
* Platform ID:
3418-
* 0x00 is for Mobile
3419-
* 0x01 is for X86
3420-
* 0x02 is for Automotive
3421-
* 0x03 is for Consumer electronic
3422-
*/
3423-
u16 board_id = (ver->chip_id << 8) + ver->platform_id;
3424-
const char *variant;
3440+
board_id = qca_extract_board_id(ver);
34253441

3426-
switch (le32_to_cpu(ver->ram_version)) {
3427-
case WCN6855_2_0_RAM_VERSION_GF:
3428-
case WCN6855_2_1_RAM_VERSION_GF:
3429-
variant = "_gf";
3430-
break;
3431-
default:
3432-
variant = "";
3433-
break;
3434-
}
3435-
3436-
if (board_id == 0) {
3437-
snprintf(fwname, max_size, "qca/nvm_usb_%08x%s.bin",
3438-
rom_version, variant);
3439-
} else {
3440-
snprintf(fwname, max_size, "qca/nvm_usb_%08x%s_%04x.bin",
3441-
rom_version, variant, board_id);
3442-
}
3443-
} else {
3444-
snprintf(fwname, max_size, "qca/nvm_usb_%08x.bin",
3445-
rom_version);
3442+
switch (le32_to_cpu(ver->ram_version)) {
3443+
case WCN6855_2_0_RAM_VERSION_GF:
3444+
case WCN6855_2_1_RAM_VERSION_GF:
3445+
variant = "_gf";
3446+
break;
3447+
default:
3448+
variant = NULL;
3449+
break;
34463450
}
34473451

3452+
len = snprintf(fwname, max_size, "qca/nvm_usb_%08x", rom_version);
3453+
if (variant)
3454+
len += snprintf(fwname + len, max_size - len, "%s", variant);
3455+
if (board_id)
3456+
len += snprintf(fwname + len, max_size - len, "_%04x", board_id);
3457+
len += snprintf(fwname + len, max_size - len, ".bin");
34483458
}
34493459

34503460
static int btusb_setup_qca_load_nvm(struct hci_dev *hdev,

drivers/comedi/comedi_fops.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,21 +1551,27 @@ static int do_insnlist_ioctl(struct comedi_device *dev,
15511551
}
15521552

15531553
for (i = 0; i < n_insns; ++i) {
1554+
unsigned int n = insns[i].n;
1555+
15541556
if (insns[i].insn & INSN_MASK_WRITE) {
15551557
if (copy_from_user(data, insns[i].data,
1556-
insns[i].n * sizeof(unsigned int))) {
1558+
n * sizeof(unsigned int))) {
15571559
dev_dbg(dev->class_dev,
15581560
"copy_from_user failed\n");
15591561
ret = -EFAULT;
15601562
goto error;
15611563
}
1564+
if (n < MIN_SAMPLES) {
1565+
memset(&data[n], 0, (MIN_SAMPLES - n) *
1566+
sizeof(unsigned int));
1567+
}
15621568
}
15631569
ret = parse_insn(dev, insns + i, data, file);
15641570
if (ret < 0)
15651571
goto error;
15661572
if (insns[i].insn & INSN_MASK_READ) {
15671573
if (copy_to_user(insns[i].data, data,
1568-
insns[i].n * sizeof(unsigned int))) {
1574+
n * sizeof(unsigned int))) {
15691575
dev_dbg(dev->class_dev,
15701576
"copy_to_user failed\n");
15711577
ret = -EFAULT;
@@ -1584,6 +1590,16 @@ static int do_insnlist_ioctl(struct comedi_device *dev,
15841590
return i;
15851591
}
15861592

1593+
#define MAX_INSNS MAX_SAMPLES
1594+
static int check_insnlist_len(struct comedi_device *dev, unsigned int n_insns)
1595+
{
1596+
if (n_insns > MAX_INSNS) {
1597+
dev_dbg(dev->class_dev, "insnlist length too large\n");
1598+
return -EINVAL;
1599+
}
1600+
return 0;
1601+
}
1602+
15871603
/*
15881604
* COMEDI_INSN ioctl
15891605
* synchronous instruction
@@ -1628,6 +1644,10 @@ static int do_insn_ioctl(struct comedi_device *dev,
16281644
ret = -EFAULT;
16291645
goto error;
16301646
}
1647+
if (insn->n < MIN_SAMPLES) {
1648+
memset(&data[insn->n], 0,
1649+
(MIN_SAMPLES - insn->n) * sizeof(unsigned int));
1650+
}
16311651
}
16321652
ret = parse_insn(dev, insn, data, file);
16331653
if (ret < 0)
@@ -2234,6 +2254,9 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd,
22342254
rc = -EFAULT;
22352255
break;
22362256
}
2257+
rc = check_insnlist_len(dev, insnlist.n_insns);
2258+
if (rc)
2259+
break;
22372260
insns = kcalloc(insnlist.n_insns, sizeof(*insns), GFP_KERNEL);
22382261
if (!insns) {
22392262
rc = -ENOMEM;
@@ -3085,6 +3108,9 @@ static int compat_insnlist(struct file *file, unsigned long arg)
30853108
if (copy_from_user(&insnlist32, compat_ptr(arg), sizeof(insnlist32)))
30863109
return -EFAULT;
30873110

3111+
rc = check_insnlist_len(dev, insnlist32.n_insns);
3112+
if (rc)
3113+
return rc;
30883114
insns = kcalloc(insnlist32.n_insns, sizeof(*insns), GFP_KERNEL);
30893115
if (!insns)
30903116
return -ENOMEM;

drivers/comedi/drivers.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,10 @@ int comedi_dio_insn_config(struct comedi_device *dev,
338338
unsigned int *data,
339339
unsigned int mask)
340340
{
341-
unsigned int chan_mask = 1 << CR_CHAN(insn->chanspec);
341+
unsigned int chan = CR_CHAN(insn->chanspec);
342342

343-
if (!mask)
344-
mask = chan_mask;
343+
if (!mask && chan < 32)
344+
mask = 1U << chan;
345345

346346
switch (data[0]) {
347347
case INSN_CONFIG_DIO_INPUT:
@@ -381,7 +381,7 @@ EXPORT_SYMBOL_GPL(comedi_dio_insn_config);
381381
unsigned int comedi_dio_update_state(struct comedi_subdevice *s,
382382
unsigned int *data)
383383
{
384-
unsigned int chanmask = (s->n_chan < 32) ? ((1 << s->n_chan) - 1)
384+
unsigned int chanmask = (s->n_chan < 32) ? ((1U << s->n_chan) - 1)
385385
: 0xffffffff;
386386
unsigned int mask = data[0] & chanmask;
387387
unsigned int bits = data[1];
@@ -614,6 +614,9 @@ static int insn_rw_emulate_bits(struct comedi_device *dev,
614614
unsigned int _data[2];
615615
int ret;
616616

617+
if (insn->n == 0)
618+
return 0;
619+
617620
memset(_data, 0, sizeof(_data));
618621
memset(&_insn, 0, sizeof(_insn));
619622
_insn.insn = INSN_BITS;
@@ -624,8 +627,8 @@ static int insn_rw_emulate_bits(struct comedi_device *dev,
624627
if (insn->insn == INSN_WRITE) {
625628
if (!(s->subdev_flags & SDF_WRITABLE))
626629
return -EINVAL;
627-
_data[0] = 1 << (chan - base_chan); /* mask */
628-
_data[1] = data[0] ? (1 << (chan - base_chan)) : 0; /* bits */
630+
_data[0] = 1U << (chan - base_chan); /* mask */
631+
_data[1] = data[0] ? (1U << (chan - base_chan)) : 0; /* bits */
629632
}
630633

631634
ret = s->insn_bits(dev, s, &_insn, _data);
@@ -708,7 +711,7 @@ static int __comedi_device_postconfig(struct comedi_device *dev)
708711

709712
if (s->type == COMEDI_SUBD_DO) {
710713
if (s->n_chan < 32)
711-
s->io_bits = (1 << s->n_chan) - 1;
714+
s->io_bits = (1U << s->n_chan) - 1;
712715
else
713716
s->io_bits = 0xffffffff;
714717
}

drivers/comedi/drivers/aio_iiro_16.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
177177
* Digital input change of state interrupts are optionally supported
178178
* using IRQ 2-7, 10-12, 14, or 15.
179179
*/
180-
if ((1 << it->options[1]) & 0xdcfc) {
180+
if (it->options[1] > 0 && it->options[1] < 16 &&
181+
(1 << it->options[1]) & 0xdcfc) {
181182
ret = request_irq(it->options[1], aio_iiro_16_cos, 0,
182183
dev->board_name, dev);
183184
if (ret == 0)

drivers/comedi/drivers/das16m1.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,8 @@ static int das16m1_attach(struct comedi_device *dev,
522522
devpriv->extra_iobase = dev->iobase + DAS16M1_8255_IOBASE;
523523

524524
/* only irqs 2, 3, 4, 5, 6, 7, 10, 11, 12, 14, and 15 are valid */
525-
if ((1 << it->options[1]) & 0xdcfc) {
525+
if (it->options[1] >= 2 && it->options[1] <= 15 &&
526+
(1 << it->options[1]) & 0xdcfc) {
526527
ret = request_irq(it->options[1], das16m1_interrupt, 0,
527528
dev->board_name, dev);
528529
if (ret == 0)

drivers/comedi/drivers/das6402.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,8 @@ static int das6402_attach(struct comedi_device *dev,
567567
das6402_reset(dev);
568568

569569
/* IRQs 2,3,5,6,7, 10,11,15 are valid for "enhanced" mode */
570-
if ((1 << it->options[1]) & 0x8cec) {
570+
if (it->options[1] > 0 && it->options[1] < 16 &&
571+
(1 << it->options[1]) & 0x8cec) {
571572
ret = request_irq(it->options[1], das6402_interrupt, 0,
572573
dev->board_name, dev);
573574
if (ret == 0) {

drivers/comedi/drivers/pcl812.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,8 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it)
11491149
if (!dev->pacer)
11501150
return -ENOMEM;
11511151

1152-
if ((1 << it->options[1]) & board->irq_bits) {
1152+
if (it->options[1] > 0 && it->options[1] < 16 &&
1153+
(1 << it->options[1]) & board->irq_bits) {
11531154
ret = request_irq(it->options[1], pcl812_interrupt, 0,
11541155
dev->board_name, dev);
11551156
if (ret == 0)

0 commit comments

Comments
 (0)