Merge tag 'v4.19.325-cip125' of https://git.kernel.org/pub/scm/linux/kernel/git/cip/linux-cip into android13-4.19-kona

version 4.19.325-cip125

* tag 'v4.19.325-cip125' of https://git.kernel.org/pub/scm/linux/kernel/git/cip/linux-cip:
  CIP: Bump version suffix to -cip125 after merge from cip/linux-4.19.y-st tree
  Update localversion-st, tree is up-to-date with 5.4.300.
  mm/khugepaged: fix ->anon_vma race
  mm/hugetlb: fix folio is still mapped when deleted
  i40e: add mask to apply valid bits for itr_idx
  i40e: add validation for ring_len param
  i40e: increase max descriptors for XL710
  mm/migrate_device: don't add folio to be freed to LRU in migrate_device_finalize()
  fbcon: Fix OOB access in font allocation
  fbcon: fix integer overflow in fbcon_do_set_font
  i40e: add max boundary check for VF filters
  i40e: fix input validation logic for action_meta
  i40e: fix idx validation in i40e_validate_queue_map
  drm/gma500: Fix null dereference in hdmi teardown
  can: peak_usb: fix shift-out-of-bounds issue
  can: mcba_usb: populate ndo_change_mtu() to prevent buffer overflow
  can: sun4i_can: populate ndo_change_mtu() to prevent buffer overflow
  can: hi311x: populate ndo_change_mtu() to prevent buffer overflow
  can: rcar_can: rcar_can_resume(): fix s2ram with PSCI
  usb: core: Add 0x prefix to quirks debug output
  ALSA: usb-audio: Fix build with CONFIG_INPUT=n
  ALSA: usb-audio: Convert comma to semicolon
  ALSA: usb-audio: Add mixer quirk for Sony DualSense PS5
  ALSA: usb-audio: Remove unneeded wmb() in mixer_quirks
  ALSA: usb-audio: Simplify NULL comparison in mixer_quirks
  ALSA: usb-audio: Avoid multiple assignments in mixer_quirks
  ALSA: usb-audio: Fix block comments in mixer_quirks
  KVM: SVM: Sync TPR from LAPIC into VMCB::V_TPR even if AVIC is active
  net: rfkill: gpio: Fix crash due to dereferencering uninitialized pointer
  net: rfkill: gpio: add DT support
  serial: sc16is7xx: fix bug in flow control levels init
  USB: gadget: dummy-hcd: Fix locking bug in RT-enabled kernels
  usb: gadget: dummy_hcd: remove usage of list iterator past the loop body
  ASoC: wm8974: Correct PLL rate rounding
  ASoC: wm8940: Correct typo in control name
  mmc: mvsdio: Fix dma_unmap_sg() nents value
  power: supply: bq27xxx: restrict no-battery detection to bq27000
  power: supply: bq27xxx: fix error return in case of no bq27000 hdq battery
  nilfs2: fix CFI failure when accessing /sys/fs/nilfs2/features/*
  cnic: Fix use-after-free bugs in cnic_delete_task
  net: liquidio: fix overflow in octeon_init_instr_queue()
  tcp: Clear tcp_sk(sk)->fastopen_rsk in tcp_disconnect().
  i40e: remove redundant memory barrier when cleaning Tx descs
  net: natsemi: fix `rx_dropped` double accounting on `netif_rx()` failure
  cgroup: split cgroup_destroy_wq into 3 workqueues
  pcmcia: omap_cf: Mark driver struct with __refdata to prevent section mismatch
  ALSA: firewire-motu: drop EPOLLOUT from poll return values as write is not supported
  mm/memory-failure: fix VM_BUG_ON_PAGE(PagePoisoned(page)) when unpoison memory
  phy: ti-pipe3: fix device leak at unbind
  dmaengine: qcom: bam_dma: Fix DT error handling for num-channels/ees
  dmaengine: ti: edma: Fix memory allocation size for queue_priority_map
  i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path
  igb: fix link test skipping when interface is admin down
  net: fec: Fix possible NPD in fec_enet_phy_reset_after_clk_enable()
  USB: serial: option: add Telit Cinterion LE910C4-WWX new compositions
  tty: hvc_console: Call hvc_kick in hvc_write unconditionally
  mtd: nand: raw: atmel: Respect tAR, tCLR in read setup timing
  mtd: nand: raw: atmel: Fix comment in timings preparation
  mm/khugepaged: fix the address passed to notifier on testing young
  ocfs2: fix recursive semaphore deadlock in fiemap call
  EDAC/altera: Delete an inappropriate dma_free_coherent() call
  net: Fix null-ptr-deref by sock_lock_init_class_and_name() and rmmod.
  cifs: fix integer overflow in match_server()
  spi: spi-fsl-lpspi: Set correct chip-select polarity bit
  pcmcia: Add error handling for add_interval() in do_validate_mem()
  randstruct: gcc-plugin: Fix attribute addition
  randstruct: gcc-plugin: Remove bogus void member
  vmxnet3: update MTU after device quiesce
  iio: light: opt3001: fix deadlock due to concurrent flag access
  KVM: x86: Take irqfds.lock when adding/deleting IRQ bypass producer
  cpufreq/sched: Explicitly synchronize limits_changed flag handling
  mm/slub: avoid accessing metadata when pointer is invalid in object_err()
  e1000e: fix heap overflow in e1000_set_eeprom
  batman-adv: fix OOB read/write in network-coding decode
  drm/amdgpu: drop hw access in non-DC audio fini
  wifi: mwifiex: Initialize the chan_stats array to zero
  pcmcia: Fix a NULL pointer dereference in __iodyn_find_io_region()
  ALSA: usb-audio: Add mute TLV for playback volumes on some devices
  ppp: fix memory leak in pad_compress_skb
  ax25: properly unshare skbs in ax25_kiss_rcv()
  net: thunder_bgx: decrement cleanup index before use
  net: thunder_bgx: add a missing of_node_put
  wifi: libertas: cap SSID len in lbs_associate()
  wifi: cw1200: cap SSID length in cw1200_do_join()
  net: ethernet: mtk_eth_soc: fix tx vlan tag for llc packets
  i40e: Fix potential invalid access when MAC list is empty
  icmp: fix icmp_ndo_send address translation for reply direction
  mISDN: Fix memory leak in dsp_hwec_enable()
  xirc2ps_cs: fix register access when enabling FullDuplex
  Bluetooth: Fix use-after-free in l2cap_sock_cleanup_listen()
  netfilter: conntrack: helper: Replace -EEXIST by -EBUSY
  powerpc: boot: Remove leading zero in label in udelay()

Change-Id: I2c31de17310aeb8f59d10e02bc91f20cf80279e3
This commit is contained in:
Thomas Turner committed 2025-10-25 11:29:53 +01:00
commit 5976bf775a
82 files changed
+755 -220

No files matched your search

+2 -2
View File
@@ -46,12 +46,12 @@ udelay:
srwi r4,r4,16
cmpwi 0,r4,1 /* 601 ? */
bne .Ludelay_not_601
00: li r0,86 /* Instructions / microsecond? */
0: li r0,86 /* Instructions / microsecond? */
mtctr r0
10: addi r0,r0,0 /* NOP */
bdnz 10b
subic. r3,r3,1
bne 00b
bne 0b
blr
.Ludelay_not_601:
+1 -2
View File
@@ -5580,8 +5580,7 @@ static inline void sync_lapic_to_cr8(struct kvm_vcpu *vcpu)
struct vcpu_svm *svm = to_svm(vcpu);
u64 cr8;
if (svm_nested_virtualize_tpr(vcpu) ||
kvm_vcpu_apicv_active(vcpu))
if (svm_nested_virtualize_tpr(vcpu))
return;
cr8 = kvm_get_cr8(vcpu);
+14 -2
View File
@@ -9774,11 +9774,18 @@ int kvm_arch_irq_bypass_add_producer(struct irq_bypass_consumer *cons,
{
struct kvm_kernel_irqfd *irqfd =
container_of(cons, struct kvm_kernel_irqfd, consumer);
struct kvm *kvm = irqfd->kvm;
int ret;
spin_lock_irq(&kvm->irqfds.lock);
irqfd->producer = prod;
return kvm_x86_ops->update_pi_irte(irqfd->kvm,
ret = kvm_x86_ops->update_pi_irte(irqfd->kvm,
prod->irq, irqfd->gsi, 1);
spin_unlock_irq(&kvm->irqfds.lock);
return ret;
}
void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,
@@ -9787,9 +9794,9 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,
int ret;
struct kvm_kernel_irqfd *irqfd =
container_of(cons, struct kvm_kernel_irqfd, consumer);
struct kvm *kvm = irqfd->kvm;
WARN_ON(irqfd->producer != prod);
irqfd->producer = NULL;
/*
* When producer of consumer is unregistered, we change back to
@@ -9797,10 +9804,15 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,
* when the irq is masked/disabled or the consumer side (KVM
* int this case doesn't want to receive the interrupts.
*/
spin_lock_irq(&kvm->irqfds.lock);
irqfd->producer = NULL;
ret = kvm_x86_ops->update_pi_irte(irqfd->kvm, prod->irq, irqfd->gsi, 0);
if (ret)
printk(KERN_INFO "irq bypass consumer (token %p) unregistration"
" fails: %d\n", irqfd->consumer.token, ret);
spin_unlock_irq(&kvm->irqfds.lock);
}
int kvm_arch_update_irqfd_routing(struct kvm *kvm, unsigned int host_irq,
+6 -2
View File
@@ -1275,13 +1275,17 @@ static int bam_dma_probe(struct platform_device *pdev)
if (bdev->controlled_remotely) {
ret = of_property_read_u32(pdev->dev.of_node, "num-channels",
&bdev->num_channels);
if (ret)
if (ret) {
dev_err(bdev->dev, "num-channels unspecified in dt\n");
return ret;
}
ret = of_property_read_u32(pdev->dev.of_node, "qcom,num-ees",
&bdev->num_ees);
if (ret)
if (ret) {
dev_err(bdev->dev, "num-ees unspecified in dt\n");
return ret;
}
}
bdev->bamclk = devm_clk_get(bdev->dev, "bam_clk");
+2 -2
View File
@@ -1971,8 +1971,8 @@ static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata,
* priority. So Q0 is the highest priority queue and the last queue has
* the lowest priority.
*/
queue_priority_map = devm_kcalloc(dev, ecc->num_tc + 1, sizeof(s8),
GFP_KERNEL);
queue_priority_map = devm_kcalloc(dev, ecc->num_tc + 1,
sizeof(*queue_priority_map), GFP_KERNEL);
if (!queue_priority_map)
return -ENOMEM;
-1
View File
@@ -142,7 +142,6 @@ static ssize_t altr_sdr_mc_err_inject_write(struct file *file,
ptemp = dma_alloc_coherent(mci->pdev, 16, &dma_handle, GFP_KERNEL);
if (!ptemp) {
dma_free_coherent(mci->pdev, 16, ptemp, dma_handle);
edac_printk(KERN_ERR, EDAC_MC,
"Inject: Buffer Allocation error\n");
return -ENOMEM;
-5
View File
@@ -1437,17 +1437,12 @@ static int dce_v10_0_audio_init(struct amdgpu_device *adev)
static void dce_v10_0_audio_fini(struct amdgpu_device *adev)
{
int i;
if (!amdgpu_audio)
return;
if (!adev->mode_info.audio.enabled)
return;
for (i = 0; i < adev->mode_info.audio.num_pins; i++)
dce_v10_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
adev->mode_info.audio.enabled = false;
}
-5
View File
@@ -1479,17 +1479,12 @@ static int dce_v11_0_audio_init(struct amdgpu_device *adev)
static void dce_v11_0_audio_fini(struct amdgpu_device *adev)
{
int i;
if (!amdgpu_audio)
return;
if (!adev->mode_info.audio.enabled)
return;
for (i = 0; i < adev->mode_info.audio.num_pins; i++)
dce_v11_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
adev->mode_info.audio.enabled = false;
}
-5
View File
@@ -1348,17 +1348,12 @@ static int dce_v6_0_audio_init(struct amdgpu_device *adev)
static void dce_v6_0_audio_fini(struct amdgpu_device *adev)
{
int i;
if (!amdgpu_audio)
return;
if (!adev->mode_info.audio.enabled)
return;
for (i = 0; i < adev->mode_info.audio.num_pins; i++)
dce_v6_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
adev->mode_info.audio.enabled = false;
}
-5
View File
@@ -1400,17 +1400,12 @@ static int dce_v8_0_audio_init(struct amdgpu_device *adev)
static void dce_v8_0_audio_fini(struct amdgpu_device *adev)
{
int i;
if (!amdgpu_audio)
return;
if (!adev->mode_info.audio.enabled)
return;
for (i = 0; i < adev->mode_info.audio.num_pins; i++)
dce_v8_0_audio_enable(adev, &adev->mode_info.audio.pin[i], false);
adev->mode_info.audio.enabled = false;
}
+1 -1
View File
@@ -739,8 +739,8 @@ void oaktrail_hdmi_teardown(struct drm_device *dev)
if (hdmi_dev) {
pdev = hdmi_dev->dev;
pci_set_drvdata(pdev, NULL);
oaktrail_hdmi_i2c_exit(pdev);
pci_set_drvdata(pdev, NULL);
iounmap(hdmi_dev->regs);
kfree(hdmi_dev);
pci_dev_put(pdev);
+3 -2
View File
@@ -699,8 +699,9 @@ static irqreturn_t opt3001_irq(int irq, void *_iio)
struct opt3001 *opt = iio_priv(iio);
int ret;
bool wake_result_ready_queue = false;
bool ok_to_ignore_lock = opt->ok_to_ignore_lock;
if (!opt->ok_to_ignore_lock)
if (!ok_to_ignore_lock)
mutex_lock(&opt->lock);
ret = i2c_smbus_read_word_swapped(opt->client, OPT3001_CONFIGURATION);
@@ -737,7 +738,7 @@ static irqreturn_t opt3001_irq(int irq, void *_iio)
}
out:
if (!opt->ok_to_ignore_lock)
if (!ok_to_ignore_lock)
mutex_unlock(&opt->lock);
if (wake_result_ready_queue)
+3 -3
View File
@@ -68,14 +68,14 @@ void dsp_hwec_enable(struct dsp *dsp, const char *arg)
goto _do;
{
char *dup, *tok, *name, *val;
char *dup, *next, *tok, *name, *val;
int tmp;
dup = kstrdup(arg, GFP_ATOMIC);
dup = next = kstrdup(arg, GFP_ATOMIC);
if (!dup)
return;
while ((tok = strsep(&dup, ","))) {
while ((tok = strsep(&next, ","))) {
if (!strlen(tok))
continue;
name = strsep(&tok, "=");
+1 -1
View File
@@ -295,7 +295,7 @@ static u32 mvsd_finish_data(struct mvsd_host *host, struct mmc_data *data,
host->pio_ptr = NULL;
host->pio_size = 0;
} else {
dma_unmap_sg(mmc_dev(host->mmc), data->sg, host->sg_frags,
dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
mmc_get_dma_dir(data));
}
+14 -4
View File
@@ -1333,13 +1333,23 @@ static int atmel_smc_nand_prepare_smcconf(struct atmel_nand *nand,
return ret;
/*
* The write cycle timing is directly matching tWC, but is also
* Read setup timing depends on the operation done on the NAND:
*
* NRD_SETUP = max(tAR, tCLR)
*/
timeps = max(conf->timings.sdr.tAR_min, conf->timings.sdr.tCLR_min);
ncycles = DIV_ROUND_UP(timeps, mckperiodps);
totalcycles += ncycles;
ret = atmel_smc_cs_conf_set_setup(smcconf, ATMEL_SMC_NRD_SHIFT, ncycles);
if (ret)
return ret;
/*
* The read cycle timing is directly matching tRC, but is also
* dependent on the setup and hold timings we calculated earlier,
* which gives:
*
* NRD_CYCLE = max(tRC, NRD_PULSE + NRD_HOLD)
*
* NRD_SETUP is always 0.
* NRD_CYCLE = max(tRC, NRD_SETUP + NRD_PULSE + NRD_HOLD)
*/
ncycles = DIV_ROUND_UP(conf->timings.sdr.tRC_min, mckperiodps);
ncycles = max(totalcycles, ncycles);
+1 -7
View File
@@ -874,7 +874,6 @@ static int __maybe_unused rcar_can_resume(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
struct rcar_can_priv *priv = netdev_priv(ndev);
u16 ctlr;
int err;
if (!netif_running(ndev))
@@ -886,12 +885,7 @@ static int __maybe_unused rcar_can_resume(struct device *dev)
return err;
}
ctlr = readw(&priv->regs->ctlr);
ctlr &= ~RCAR_CAN_CTLR_SLPM;
writew(ctlr, &priv->regs->ctlr);
ctlr &= ~RCAR_CAN_CTLR_CANM;
writew(ctlr, &priv->regs->ctlr);
priv->can.state = CAN_STATE_ERROR_ACTIVE;
rcar_can_start(ndev);
netif_device_attach(ndev);
netif_start_queue(ndev);
+1
View File
@@ -825,6 +825,7 @@ static const struct net_device_ops hi3110_netdev_ops = {
.ndo_open = hi3110_open,
.ndo_stop = hi3110_stop,
.ndo_start_xmit = hi3110_hard_start_xmit,
.ndo_change_mtu = can_change_mtu,
};
static const struct of_device_id hi3110_of_match[] = {
+1
View File
@@ -752,6 +752,7 @@ static const struct net_device_ops sun4ican_netdev_ops = {
.ndo_open = sun4ican_open,
.ndo_stop = sun4ican_close,
.ndo_start_xmit = sun4ican_start_xmit,
.ndo_change_mtu = can_change_mtu,
};
static const struct of_device_id sun4ican_of_match[] = {
+1
View File
@@ -780,6 +780,7 @@ static const struct net_device_ops mcba_netdev_ops = {
.ndo_open = mcba_usb_open,
.ndo_stop = mcba_usb_close,
.ndo_start_xmit = mcba_usb_start_xmit,
.ndo_change_mtu = can_change_mtu,
};
/* Microchip CANBUS has hardcoded bittiming values by default.
+1 -1
View File
@@ -92,7 +92,7 @@ void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now)
u32 delta_ts = time_ref->ts_dev_2 - time_ref->ts_dev_1;
if (time_ref->ts_dev_2 < time_ref->ts_dev_1)
delta_ts &= (1 << time_ref->adapter->ts_used_bits) - 1;
delta_ts &= (1ULL << time_ref->adapter->ts_used_bits) - 1;
time_ref->ts_total += delta_ts;
}
+1 -2
View File
@@ -4221,8 +4221,7 @@ static void cnic_cm_stop_bnx2x_hw(struct cnic_dev *dev)
cnic_bnx2x_delete_wait(dev, 0);
cancel_delayed_work(&cp->delete_task);
flush_workqueue(cnic_wq);
cancel_delayed_work_sync(&cp->delete_task);
if (atomic_read(&cp->iscsi_conn) != 0)
netdev_warn(dev->netdev, "%d iSCSI connections not destroyed\n",
@@ -139,7 +139,7 @@ int octeon_init_instr_queue(struct octeon_device *oct,
oct->io_qmask.iq |= BIT_ULL(iq_no);
/* Set the 32B/64B mode for each input queue */
oct->io_qmask.iq64B |= ((conf->instr_type == 64) << iq_no);
oct->io_qmask.iq64B |= ((u64)(conf->instr_type == 64) << iq_no);
iq->iqcmd_64B = (conf->instr_type == 64);
oct->fn_list.setup_iq_regs(oct, iq_no);
@@ -1506,14 +1506,18 @@ static int bgx_init_of_phy(struct bgx *bgx)
* this cortina phy, for which there is no driver
* support, ignore it.
*/
if (phy_np &&
!of_device_is_compatible(phy_np, "cortina,cs4223-slice")) {
if (phy_np) {
if (!of_device_is_compatible(phy_np, "cortina,cs4223-slice")) {
/* Wait until the phy drivers are available */
pd = of_phy_find_device(phy_np);
if (!pd)
if (!pd) {
of_node_put(phy_np);
goto defer;
}
bgx->lmac[lmac].phydev = pd;
}
of_node_put(phy_np);
}
lmac++;
if (lmac == bgx->max_lmac) {
@@ -1528,11 +1532,11 @@ defer:
* for phy devices we may have already found.
*/
while (lmac) {
lmac--;
if (bgx->lmac[lmac].phydev) {
put_device(&bgx->lmac[lmac].phydev->mdio.dev);
bgx->lmac[lmac].phydev = NULL;
}
lmac--;
}
of_node_put(node);
return -EPROBE_DEFER;
@@ -1970,6 +1970,7 @@ static void fec_enet_phy_reset_after_clk_enable(struct net_device *ndev)
*/
phy_dev = of_phy_find_device(fep->phy_node);
phy_reset_after_clk_enable(phy_dev);
if (phy_dev)
put_device(&phy_dev->mdio.dev);
}
}
+7 -3
View File
@@ -552,12 +552,12 @@ static int e1000_set_eeprom(struct net_device *netdev,
{
struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
size_t total_len, max_len;
u16 *eeprom_buff;
void *ptr;
int max_len;
int ret_val = 0;
int first_word;
int last_word;
int ret_val = 0;
void *ptr;
u16 i;
if (eeprom->len == 0)
@@ -572,6 +572,10 @@ static int e1000_set_eeprom(struct net_device *netdev,
max_len = hw->nvm.word_size * 2;
if (check_add_overflow(eeprom->offset, eeprom->len, &total_len) ||
total_len > max_len)
return -EFBIG;
first_word = eeprom->offset >> 1;
last_word = (eeprom->offset + eeprom->len - 1) >> 1;
eeprom_buff = kmalloc(max_len, GFP_KERNEL);
+1
View File
@@ -46,6 +46,7 @@
#define I40E_MAX_VEB 16
#define I40E_MAX_NUM_DESCRIPTORS 4096
#define I40E_MAX_NUM_DESCRIPTORS_XL710 8160
#define I40E_MAX_CSR_SPACE (4 * 1024 * 1024 - 64 * 1024)
#define I40E_DEFAULT_NUM_DESCRIPTORS 512
#define I40E_REQ_DESCRIPTOR_MULTIPLE 32
@@ -320,7 +320,7 @@ static void i40e_client_add_instance(struct i40e_pf *pf)
return;
}
mac = list_first_entry(&cdev->lan_info.netdev->dev_addrs.list,
mac = list_first_entry_or_null(&cdev->lan_info.netdev->dev_addrs.list,
struct netdev_hw_addr, list);
if (mac)
ether_addr_copy(cdev->lan_info.lanmac, mac->addr);
+19 -6
View File
@@ -1449,6 +1449,18 @@ static void i40e_get_drvinfo(struct net_device *netdev,
drvinfo->n_priv_flags += I40E_GL_PRIV_FLAGS_STR_LEN;
}
static u32 i40e_get_max_num_descriptors(struct i40e_pf *pf)
{
struct i40e_hw *hw = &pf->hw;
switch (hw->mac.type) {
case I40E_MAC_XL710:
return I40E_MAX_NUM_DESCRIPTORS_XL710;
default:
return I40E_MAX_NUM_DESCRIPTORS;
}
}
static void i40e_get_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ring)
{
@@ -1456,8 +1468,8 @@ static void i40e_get_ringparam(struct net_device *netdev,
struct i40e_pf *pf = np->vsi->back;
struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];
ring->rx_max_pending = I40E_MAX_NUM_DESCRIPTORS;
ring->tx_max_pending = I40E_MAX_NUM_DESCRIPTORS;
ring->rx_max_pending = i40e_get_max_num_descriptors(pf);
ring->tx_max_pending = i40e_get_max_num_descriptors(pf);
ring->rx_mini_max_pending = 0;
ring->rx_jumbo_max_pending = 0;
ring->rx_pending = vsi->rx_rings[0]->count;
@@ -1480,12 +1492,12 @@ static bool i40e_active_tx_ring_index(struct i40e_vsi *vsi, u16 index)
static int i40e_set_ringparam(struct net_device *netdev,
struct ethtool_ringparam *ring)
{
u32 new_rx_count, new_tx_count, max_num_descriptors;
struct i40e_ring *tx_rings = NULL, *rx_rings = NULL;
struct i40e_netdev_priv *np = netdev_priv(netdev);
struct i40e_hw *hw = &np->vsi->back->hw;
struct i40e_vsi *vsi = np->vsi;
struct i40e_pf *pf = vsi->back;
u32 new_rx_count, new_tx_count;
u16 tx_alloc_queue_pairs;
int timeout = 50;
int i, err = 0;
@@ -1493,14 +1505,15 @@ static int i40e_set_ringparam(struct net_device *netdev,
if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
return -EINVAL;
if (ring->tx_pending > I40E_MAX_NUM_DESCRIPTORS ||
max_num_descriptors = i40e_get_max_num_descriptors(pf);
if (ring->tx_pending > max_num_descriptors ||
ring->tx_pending < I40E_MIN_NUM_DESCRIPTORS ||
ring->rx_pending > I40E_MAX_NUM_DESCRIPTORS ||
ring->rx_pending > max_num_descriptors ||
ring->rx_pending < I40E_MIN_NUM_DESCRIPTORS) {
netdev_info(netdev,
"Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d]\n",
ring->tx_pending, ring->rx_pending,
I40E_MIN_NUM_DESCRIPTORS, I40E_MAX_NUM_DESCRIPTORS);
I40E_MIN_NUM_DESCRIPTORS, max_num_descriptors);
return -EINVAL;
}
+1 -1
View File
@@ -3799,7 +3799,7 @@ free_queue_irqs:
irq_num = pf->msix_entries[base + vector].vector;
irq_set_affinity_notifier(irq_num, NULL);
irq_set_affinity_hint(irq_num, NULL);
free_irq(irq_num, &vsi->q_vectors[vector]);
free_irq(irq_num, vsi->q_vectors[vector]);
}
return err;
}
@@ -800,9 +800,6 @@ static bool i40e_clean_tx_irq(struct i40e_vsi *vsi,
if (!eop_desc)
break;
/* prevent any other reads prior to eop_desc */
smp_rmb();
i40e_trace(clean_tx_irq, tx_ring, tx_desc, tx_buf);
/* we have caught up to head, no work left to do */
if (tx_head == tx_desc)
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2013 - 2018 Intel Corporation. */
#include <linux/bitfield.h>
#include "i40e.h"
/*********************notification routines***********************/
@@ -387,7 +388,7 @@ static void i40e_config_irq_link_list(struct i40e_vf *vf, u16 vsi_id,
(qtype << I40E_QINT_RQCTL_NEXTQ_TYPE_SHIFT) |
(pf_queue_id << I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT) |
BIT(I40E_QINT_RQCTL_CAUSE_ENA_SHIFT) |
(itr_idx << I40E_QINT_RQCTL_ITR_INDX_SHIFT);
FIELD_PREP(I40E_QINT_RQCTL_ITR_INDX_MASK, itr_idx);
wr32(hw, reg_idx, reg);
}
@@ -594,6 +595,13 @@ static int i40e_config_vsi_tx_queue(struct i40e_vf *vf, u16 vsi_id,
/* only set the required fields */
tx_ctx.base = info->dma_ring_addr / 128;
/* ring_len has to be multiple of 8 */
if (!IS_ALIGNED(info->ring_len, 8) ||
info->ring_len > I40E_MAX_NUM_DESCRIPTORS_XL710) {
ret = -EINVAL;
goto error_context;
}
tx_ctx.qlen = info->ring_len;
tx_ctx.rdylist = le16_to_cpu(vsi->info.qs_handle[0]);
tx_ctx.rdylist_act = 0;
@@ -659,6 +667,13 @@ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id,
/* only set the required fields */
rx_ctx.base = info->dma_ring_addr / 128;
/* ring_len has to be multiple of 32 */
if (!IS_ALIGNED(info->ring_len, 32) ||
info->ring_len > I40E_MAX_NUM_DESCRIPTORS_XL710) {
ret = -EINVAL;
goto error_param;
}
rx_ctx.qlen = info->ring_len;
if (info->splithdr_enabled) {
@@ -2187,8 +2202,10 @@ static int i40e_validate_queue_map(struct i40e_vf *vf, u16 vsi_id,
u16 vsi_queue_id, queue_id;
for_each_set_bit(vsi_queue_id, &queuemap, I40E_MAX_VSI_QP) {
if (vf->adq_enabled) {
vsi_id = vf->ch[vsi_queue_id / I40E_MAX_VF_VSI].vsi_id;
u16 idx = vsi_queue_id / I40E_MAX_VF_VSI;
if (vf->adq_enabled && idx < vf->num_tc) {
vsi_id = vf->ch[idx].vsi_id;
queue_id = (vsi_queue_id % I40E_DEFAULT_QUEUES_PER_VF);
} else {
queue_id = vsi_queue_id;
@@ -3176,7 +3193,7 @@ static int i40e_validate_cloud_filter(struct i40e_vf *vf,
/* action_meta is TC number here to which the filter is applied */
if (!tc_filter->action_meta ||
tc_filter->action_meta > vf->num_tc) {
tc_filter->action_meta >= vf->num_tc) {
dev_info(&pf->pdev->dev, "VF %d: Invalid TC number %u\n",
vf->vf_id, tc_filter->action_meta);
goto err;
@@ -3474,6 +3491,8 @@ err:
aq_ret);
}
#define I40E_MAX_VF_CLOUD_FILTER 0xFF00
/**
* i40e_vc_add_cloud_filter
* @vf: pointer to the VF info
@@ -3513,6 +3532,14 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)
goto err_out;
}
if (vf->num_cloud_filters >= I40E_MAX_VF_CLOUD_FILTER) {
dev_warn(&pf->pdev->dev,
"VF %d: Max number of filters reached, can't apply cloud filter\n",
vf->vf_id);
aq_ret = -ENOSPC;
goto err_out;
}
cfilter = kzalloc(sizeof(*cfilter), GFP_KERNEL);
if (!cfilter)
return -ENOMEM;
+1 -4
View File
@@ -2067,11 +2067,8 @@ static void igb_diag_test(struct net_device *netdev,
} else {
dev_info(&adapter->pdev->dev, "online testing starting\n");
/* PHY is powered down when interface is down */
if (if_running && igb_link_test(adapter, &data[TEST_LINK]))
if (igb_link_test(adapter, &data[TEST_LINK]))
eth_test->flags |= ETH_TEST_FL_FAILED;
else
data[TEST_LINK] = 0;
/* Online tests aren't run; pass by default */
data[TEST_REG] = 0;
+9 -1
View File
@@ -883,6 +883,13 @@ static int mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
bool gso = false;
int tx_num;
if (skb_vlan_tag_present(skb) &&
!eth_proto_is_802_3(eth_hdr(skb)->h_proto)) {
skb = __vlan_hwaccel_push_inside(skb);
if (!skb)
goto dropped;
}
/* normally we can rely on the stack not calling this more than once,
* however we have 2 queues running on the same ring so we need to lock
* the ring access
@@ -928,8 +935,9 @@ static int mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
drop:
spin_unlock(&eth->page_lock);
stats->tx_dropped++;
dev_kfree_skb_any(skb);
dropped:
stats->tx_dropped++;
return NETDEV_TX_OK;
}
+6 -7
View File
@@ -832,7 +832,7 @@ static void rx_irq(struct net_device *ndev)
struct ns83820 *dev = PRIV(ndev);
struct rx_info *info = &dev->rx_info;
unsigned next_rx;
int rx_rc, len;
int len;
u32 cmdsts;
__le32 *desc;
unsigned long flags;
@@ -893,8 +893,10 @@ static void rx_irq(struct net_device *ndev)
if (likely(CMDSTS_OK & cmdsts)) {
#endif
skb_put(skb, len);
if (unlikely(!skb))
if (unlikely(!skb)) {
ndev->stats.rx_dropped++;
goto netdev_mangle_me_harder_failed;
}
if (cmdsts & CMDSTS_DEST_MULTI)
ndev->stats.multicast++;
ndev->stats.rx_packets++;
@@ -913,15 +915,12 @@ static void rx_irq(struct net_device *ndev)
__vlan_hwaccel_put_tag(skb, htons(ETH_P_IPV6), tag);
}
#endif
rx_rc = netif_rx(skb);
if (NET_RX_DROP == rx_rc) {
netdev_mangle_me_harder_failed:
ndev->stats.rx_dropped++;
}
netif_rx(skb);
} else {
dev_kfree_skb_irq(skb);
}
netdev_mangle_me_harder_failed:
nr++;
next_rx = info->next_rx;
desc = info->descs + (DESC_SIZE * next_rx);
+1 -1
View File
@@ -1584,7 +1584,7 @@ do_reset(struct net_device *dev, int full)
msleep(40); /* wait 40 msec to let it complete */
}
if (full_duplex)
PutByte(XIRCREG1_ECR, GetByte(XIRCREG1_ECR | FullDuplex));
PutByte(XIRCREG1_ECR, GetByte(XIRCREG1_ECR) | FullDuplex);
} else { /* No MII */
SelectPage(0);
value = GetByte(XIRCREG_ESR); /* read the ESR */
+3 -3
View File
@@ -1534,7 +1534,6 @@ pad_compress_skb(struct ppp *ppp, struct sk_buff *skb)
*/
if (net_ratelimit())
netdev_err(ppp->dev, "ppp: compressor dropped pkt\n");
kfree_skb(skb);
consume_skb(new_skb);
new_skb = NULL;
}
@@ -1636,9 +1635,10 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb)
"down - pkt dropped.\n");
goto drop;
}
skb = pad_compress_skb(ppp, skb);
if (!skb)
new_skb = pad_compress_skb(ppp, skb);
if (!new_skb)
goto drop;
skb = new_skb;
}
/*
+3 -2
View File
@@ -2998,8 +2998,6 @@ vmxnet3_change_mtu(struct net_device *netdev, int new_mtu)
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
int err = 0;
netdev->mtu = new_mtu;
/*
* Reset_work may be in the middle of resetting the device, wait for its
* completion.
@@ -3013,6 +3011,7 @@ vmxnet3_change_mtu(struct net_device *netdev, int new_mtu)
/* we need to re-create the rx queue based on the new mtu */
vmxnet3_rq_destroy_all(adapter);
netdev->mtu = new_mtu;
vmxnet3_adjust_rx_ring_size(adapter);
err = vmxnet3_rq_create_all(adapter);
if (err) {
@@ -3029,6 +3028,8 @@ vmxnet3_change_mtu(struct net_device *netdev, int new_mtu)
"Closing it\n", err);
goto out;
}
} else {
netdev->mtu = new_mtu;
}
out:
+6 -3
View File
@@ -1102,10 +1102,13 @@ static int lbs_associate(struct lbs_private *priv,
/* add SSID TLV */
rcu_read_lock();
ssid_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SSID);
if (ssid_eid)
pos += lbs_add_ssid_tlv(pos, ssid_eid + 2, ssid_eid[1]);
else
if (ssid_eid) {
u32 ssid_len = min(ssid_eid[1], IEEE80211_MAX_SSID_LEN);
pos += lbs_add_ssid_tlv(pos, ssid_eid + 2, ssid_len);
} else {
lbs_deb_assoc("no SSID\n");
}
rcu_read_unlock();
/* add DS param TLV */
@@ -4248,8 +4248,9 @@ int mwifiex_init_channel_scan_gap(struct mwifiex_adapter *adapter)
* additional active scan request for hidden SSIDs on passive channels.
*/
adapter->num_in_chan_stats = 2 * (n_channels_bg + n_channels_a);
adapter->chan_stats = vmalloc(array_size(sizeof(*adapter->chan_stats),
adapter->num_in_chan_stats));
adapter->chan_stats = kcalloc(adapter->num_in_chan_stats,
sizeof(*adapter->chan_stats),
GFP_KERNEL);
if (!adapter->chan_stats)
return -ENOMEM;
+2 -2
View File
@@ -637,7 +637,7 @@ static int _mwifiex_fw_dpc(const struct firmware *firmware, void *context)
goto done;
err_add_intf:
vfree(adapter->chan_stats);
kfree(adapter->chan_stats);
err_init_chan_scan:
wiphy_unregister(adapter->wiphy);
wiphy_free(adapter->wiphy);
@@ -1453,7 +1453,7 @@ static void mwifiex_uninit_sw(struct mwifiex_adapter *adapter)
wiphy_free(adapter->wiphy);
adapter->wiphy = NULL;
vfree(adapter->chan_stats);
kfree(adapter->chan_stats);
mwifiex_free_cmd_buffers(adapter);
}
+1 -1
View File
@@ -1292,7 +1292,7 @@ static void cw1200_do_join(struct cw1200_common *priv)
rcu_read_lock();
ssidie = ieee80211_bss_get_ie(bss, WLAN_EID_SSID);
if (ssidie) {
join.ssid_len = ssidie[1];
join.ssid_len = min(ssidie[1], IEEE80211_MAX_SSID_LEN);
memcpy(join.ssid, &ssidie[2], join.ssid_len);
}
rcu_read_unlock();
+7 -1
View File
@@ -331,7 +331,13 @@ static int __exit omap_cf_remove(struct platform_device *pdev)
return 0;
}
static struct platform_driver omap_cf_driver = {
/*
* omap_cf_remove() lives in .exit.text. For drivers registered via
* platform_driver_probe() this is ok because they cannot get unbound at
* runtime. So mark the driver struct with __refdata to prevent modpost
* triggering a section mismatch warning.
*/
static struct platform_driver omap_cf_driver __refdata = {
.driver = {
.name = (char *) driver_name,
},
+3
View File
@@ -65,6 +65,9 @@ static struct resource *__iodyn_find_io_region(struct pcmcia_socket *s,
unsigned long min = base;
int ret;
if (!res)
return NULL;
data.mask = align - 1;
data.offset = base & data.mask;
+3 -1
View File
@@ -378,7 +378,9 @@ static int do_validate_mem(struct pcmcia_socket *s,
if (validate && !s->fake_cis) {
/* move it to the validated data set */
add_interval(&s_data->mem_db_valid, base, size);
ret = add_interval(&s_data->mem_db_valid, base, size);
if (ret)
return ret;
sub_interval(&s_data->mem_db, base, size);
}
+13
View File
@@ -508,12 +508,20 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy)
return 0;
}
static void ti_pipe3_put_device(void *_dev)
{
struct device *dev = _dev;
put_device(dev);
}
static int ti_pipe3_get_sysctrl(struct ti_pipe3 *phy)
{
struct device *dev = phy->dev;
struct device_node *node = dev->of_node;
struct device_node *control_node;
struct platform_device *control_pdev;
int ret;
phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,
"syscon-phy-power");
@@ -544,6 +552,11 @@ static int ti_pipe3_get_sysctrl(struct ti_pipe3 *phy)
}
phy->control_dev = &control_pdev->dev;
ret = devm_add_action_or_reset(dev, ti_pipe3_put_device,
phy->control_dev);
if (ret)
return ret;
}
if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) {
+2 -2
View File
@@ -1556,8 +1556,8 @@ static void bq27xxx_battery_update_unlocked(struct bq27xxx_device_info *di)
bool has_singe_flag = di->opts & BQ27XXX_O_ZERO;
cache.flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, has_singe_flag);
if ((cache.flags & 0xff) == 0xff)
cache.flags = -1; /* read error */
if (di->chip == BQ27000 && (cache.flags & 0xff) == 0xff)
cache.flags = -ENODEV; /* bq27000 hdq read error */
if (cache.flags >= 0) {
cache.temperature = bq27xxx_battery_read_temperature(di);
if (has_ci_flag && (cache.flags & BQ27000_FLAG_CI)) {
+5 -2
View File
@@ -5,6 +5,7 @@
// Copyright 2016 Freescale Semiconductor, Inc.
// Copyright 2018 NXP Semiconductors
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/delay.h>
@@ -56,7 +57,7 @@
#define IER_TDIE BIT(0)
#define CFGR1_PCSCFG BIT(27)
#define CFGR1_PINCFG (BIT(24)|BIT(25))
#define CFGR1_PCSPOL BIT(8)
#define CFGR1_PCSPOL_MASK GENMASK(11, 8)
#define CFGR1_NOSTALL BIT(3)
#define CFGR1_MASTER BIT(0)
#define RSR_RXEMPTY BIT(1)
@@ -312,7 +313,9 @@ static int fsl_lpspi_config(struct fsl_lpspi_data *fsl_lpspi)
else
temp = CFGR1_PINCFG;
if (fsl_lpspi->config.mode & SPI_CS_HIGH)
temp |= CFGR1_PCSPOL;
temp |= FIELD_PREP(CFGR1_PCSPOL_MASK,
BIT(fsl_lpspi->config.chip_select));
writel(temp, fsl_lpspi->base + IMX7ULP_CFGR1);
temp = readl(fsl_lpspi->base + IMX7ULP_CR);
+2 -2
View File
@@ -543,9 +543,9 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count
}
/*
* Racy, but harmless, kick thread if there is still pending data.
* Kick thread to flush if there's still pending data
* or to wakeup the write queue.
*/
if (hp->n_outbuf)
hvc_kick();
return written;
+2 -11
View File
@@ -1032,16 +1032,6 @@ static int sc16is7xx_startup(struct uart_port *port)
sc16is7xx_port_write(port, SC16IS7XX_FCR_REG,
SC16IS7XX_FCR_FIFO_BIT);
/* Enable EFR */
sc16is7xx_port_write(port, SC16IS7XX_LCR_REG,
SC16IS7XX_LCR_CONF_MODE_B);
regcache_cache_bypass(s->regmap, true);
/* Enable write access to enhanced features and internal clock div */
sc16is7xx_port_write(port, SC16IS7XX_EFR_REG,
SC16IS7XX_EFR_ENABLE_BIT);
/* Enable TCR/TLR */
sc16is7xx_port_update(port, SC16IS7XX_MCR_REG,
SC16IS7XX_MCR_TCRTLR_BIT,
@@ -1053,7 +1043,8 @@ static int sc16is7xx_startup(struct uart_port *port)
SC16IS7XX_TCR_RX_RESUME(24) |
SC16IS7XX_TCR_RX_HALT(48));
regcache_cache_bypass(s->regmap, false);
/* Disable TCR/TLR access */
sc16is7xx_port_update(port, SC16IS7XX_MCR_REG, SC16IS7XX_MCR_TCRTLR_BIT, 0);
/* Now, initialize the UART */
sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, SC16IS7XX_LCR_WORD_LEN_8);
+1 -1
View File
@@ -728,7 +728,7 @@ void usb_detect_quirks(struct usb_device *udev)
udev->quirks ^= usb_detect_dynamic_quirks(udev);
if (udev->quirks)
dev_dbg(&udev->dev, "USB quirks for this device: %x\n",
dev_dbg(&udev->dev, "USB quirks for this device: 0x%x\n",
udev->quirks);
#ifdef CONFIG_USB_DEFAULT_PERSIST
+10 -9
View File
@@ -762,7 +762,7 @@ static int dummy_dequeue(struct usb_ep *_ep, struct usb_request *_req)
struct dummy *dum;
int retval = -EINVAL;
unsigned long flags;
struct dummy_request *req = NULL;
struct dummy_request *req = NULL, *iter;
if (!_ep || !_req)
return retval;
@@ -772,25 +772,26 @@ static int dummy_dequeue(struct usb_ep *_ep, struct usb_request *_req)
if (!dum->driver)
return -ESHUTDOWN;
local_irq_save(flags);
spin_lock(&dum->lock);
list_for_each_entry(req, &ep->queue, queue) {
if (&req->req == _req) {
list_del_init(&req->queue);
spin_lock_irqsave(&dum->lock, flags);
list_for_each_entry(iter, &ep->queue, queue) {
if (&iter->req != _req)
continue;
list_del_init(&iter->queue);
_req->status = -ECONNRESET;
req = iter;
retval = 0;
break;
}
}
spin_unlock(&dum->lock);
if (retval == 0) {
dev_dbg(udc_dev(dum),
"dequeued req %p from %s, len %d buf %p\n",
req, _ep->name, _req->length, _req->buf);
spin_unlock(&dum->lock);
usb_gadget_giveback_request(_ep, _req);
spin_lock(&dum->lock);
}
local_irq_restore(flags);
spin_unlock_irqrestore(&dum->lock, flags);
return retval;
}
+11
View File
@@ -1322,7 +1322,18 @@ static const struct usb_device_id option_ids[] = {
.driver_info = NCTRL(0) | RSVD(3) },
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1033, 0xff), /* Telit LE910C1-EUX (ECM) */
.driver_info = NCTRL(0) },
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1034, 0xff), /* Telit LE910C4-WWX (rmnet) */
.driver_info = RSVD(2) },
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1035, 0xff) }, /* Telit LE910C4-WWX (ECM) */
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1036, 0xff) }, /* Telit LE910C4-WWX */
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1037, 0xff), /* Telit LE910C4-WWX (rmnet) */
.driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) },
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1038, 0xff), /* Telit LE910C4-WWX (rmnet) */
.driver_info = NCTRL(0) | RSVD(3) },
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x103b, 0xff), /* Telit LE910C4-WWX */
.driver_info = NCTRL(0) | NCTRL(1) },
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x103c, 0xff), /* Telit LE910C4-WWX */
.driver_info = NCTRL(0) },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG0),
.driver_info = RSVD(0) | RSVD(1) | NCTRL(2) | RSVD(3) },
{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG1),
+10 -3
View File
@@ -2460,7 +2460,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
unsigned charcount = font->charcount;
int w = font->width;
int h = font->height;
int size;
int size, alloc_size;
int i, csum;
u8 *new_data, *data = font->data;
int pitch = PITCH(font->width);
@@ -2487,9 +2487,16 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
if (fbcon_invalid_charcount(info, charcount))
return -EINVAL;
size = CALC_FONTSZ(h, pitch, charcount);
/* Check for integer overflow in font size calculation */
if (check_mul_overflow(h, pitch, &size) ||
check_mul_overflow(size, charcount, &size))
return -EINVAL;
new_data = kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, GFP_USER);
/* Check for overflow in allocation size calculation */
if (check_add_overflow(FONT_EXTRA_WORDS * sizeof(int), size, &alloc_size))
return -EINVAL;
new_data = kmalloc(alloc_size, GFP_USER);
if (!new_data)
return -ENOMEM;
+5
View File
@@ -1874,6 +1874,11 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
__func__);
goto cifs_parse_mount_err;
}
if (option < SMB_ECHO_INTERVAL_MIN ||
option > SMB_ECHO_INTERVAL_MAX) {
cifs_dbg(VFS, "echo interval is out of bounds\n");
goto cifs_parse_mount_err;
}
vol->echo_interval = option;
break;
case Opt_snapshot:
+6 -8
View File
@@ -445,13 +445,13 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
/*
* If page is mapped, it was faulted in after being
* unmapped in caller. Unmap (again) now after taking
* the fault mutex. The mutex will prevent faults
* until we finish removing the page.
*
* This race can only happen in the hole punch case.
* Getting here in a truncate operation is a bug.
* unmapped in caller or hugetlb_vmdelete_list() skips
* unmapping it due to fail to grab lock. Unmap (again)
* while holding the fault mutex. The mutex will prevent
* faults until we finish removing the page. Hold page
* lock to guarantee no concurrent migration.
*/
lock_page(page);
if (unlikely(page_mapped(page))) {
BUG_ON(truncate_op);
@@ -461,8 +461,6 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
(index + 1) * pages_per_huge_page(h));
i_mmap_unlock_write(mapping);
}
lock_page(page);
/*
* We must free the huge page and remove from page
* cache (remove_huge_page) BEFORE removing the
+2 -2
View File
@@ -1081,7 +1081,7 @@ void nilfs_sysfs_delete_device_group(struct the_nilfs *nilfs)
************************************************************************/
static ssize_t nilfs_feature_revision_show(struct kobject *kobj,
struct attribute *attr, char *buf)
struct kobj_attribute *attr, char *buf)
{
return sysfs_emit(buf, "%d.%d\n",
NILFS_CURRENT_REV, NILFS_MINOR_REV);
@@ -1093,7 +1093,7 @@ static const char features_readme_str[] =
"(1) revision\n\tshow current revision of NILFS file system driver.\n";
static ssize_t nilfs_feature_README_show(struct kobject *kobj,
struct attribute *attr,
struct kobj_attribute *attr,
char *buf)
{
return sysfs_emit(buf, features_readme_str);
+4 -4
View File
@@ -50,16 +50,16 @@ struct nilfs_sysfs_dev_subgroups {
struct completion sg_segments_kobj_unregister;
};
#define NILFS_COMMON_ATTR_STRUCT(name) \
#define NILFS_KOBJ_ATTR_STRUCT(name) \
struct nilfs_##name##_attr { \
struct attribute attr; \
ssize_t (*show)(struct kobject *, struct attribute *, \
ssize_t (*show)(struct kobject *, struct kobj_attribute *, \
char *); \
ssize_t (*store)(struct kobject *, struct attribute *, \
ssize_t (*store)(struct kobject *, struct kobj_attribute *, \
const char *, size_t); \
}
NILFS_COMMON_ATTR_STRUCT(feature);
NILFS_KOBJ_ATTR_STRUCT(feature);
#define NILFS_DEV_ATTR_STRUCT(name) \
struct nilfs_##name##_attr { \
+9 -1
View File
@@ -712,6 +712,8 @@ out:
* it not only handles the fiemap for inlined files, but also deals
* with the fast symlink, cause they have no difference for extent
* mapping per se.
*
* Must be called with ip_alloc_sem semaphore held.
*/
static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh,
struct fiemap_extent_info *fieinfo,
@@ -723,6 +725,7 @@ static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh,
u64 phys;
u32 flags = FIEMAP_EXTENT_DATA_INLINE|FIEMAP_EXTENT_LAST;
struct ocfs2_inode_info *oi = OCFS2_I(inode);
lockdep_assert_held_read(&oi->ip_alloc_sem);
di = (struct ocfs2_dinode *)di_bh->b_data;
if (ocfs2_inode_is_fast_symlink(inode))
@@ -738,8 +741,11 @@ static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh,
phys += offsetof(struct ocfs2_dinode,
id2.i_data.id_data);
/* Release the ip_alloc_sem to prevent deadlock on page fault */
up_read(&OCFS2_I(inode)->ip_alloc_sem);
ret = fiemap_fill_next_extent(fieinfo, 0, phys, id_count,
flags);
down_read(&OCFS2_I(inode)->ip_alloc_sem);
if (ret < 0)
return ret;
}
@@ -810,9 +816,11 @@ int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
len_bytes = (u64)le16_to_cpu(rec.e_leaf_clusters) << osb->s_clustersize_bits;
phys_bytes = le64_to_cpu(rec.e_blkno) << osb->sb->s_blocksize_bits;
virt_bytes = (u64)le32_to_cpu(rec.e_cpos) << osb->s_clustersize_bits;
/* Release the ip_alloc_sem to prevent deadlock on page fault */
up_read(&OCFS2_I(inode)->ip_alloc_sem);
ret = fiemap_fill_next_extent(fieinfo, virt_bytes, phys_bytes,
len_bytes, fe_flags);
down_read(&OCFS2_I(inode)->ip_alloc_sem);
if (ret)
break;
+36
View File
@@ -326,6 +326,8 @@ struct bpf_local_storage;
* @sk_clockid: clockid used by time-based scheduling (SO_TXTIME)
* @sk_txtime_deadline_mode: set deadline mode for SO_TXTIME
* @sk_txtime_unused: unused txtime flags
* @sk_owner: reference to the real owner of the socket that calls
* sock_lock_init_class_and_name().
*/
struct sock {
/*
@@ -506,6 +508,10 @@ struct sock {
#endif
struct rcu_head sk_rcu;
#if IS_ENABLED(CONFIG_PROVE_LOCKING) && IS_ENABLED(CONFIG_MODULES)
struct module *sk_owner;
#endif
#if IS_ENABLED(CONFIG_DEBUG_SPINLOCK) || IS_ENABLED(CONFIG_DEBUG_LOCK_ALLOC)
ANDROID_KABI_RESERVE(1);
#else
@@ -1545,6 +1551,35 @@ static inline void sock_release_ownership(struct sock *sk)
}
}
#if IS_ENABLED(CONFIG_PROVE_LOCKING) && IS_ENABLED(CONFIG_MODULES)
static inline void sk_owner_set(struct sock *sk, struct module *owner)
{
__module_get(owner);
sk->sk_owner = owner;
}
static inline void sk_owner_clear(struct sock *sk)
{
sk->sk_owner = NULL;
}
static inline void sk_owner_put(struct sock *sk)
{
module_put(sk->sk_owner);
}
#else
static inline void sk_owner_set(struct sock *sk, struct module *owner)
{
}
static inline void sk_owner_clear(struct sock *sk)
{
}
static inline void sk_owner_put(struct sock *sk)
{
}
#endif
/*
* Macro so as to not evaluate some arguments when
* lockdep is not enabled.
@@ -1554,6 +1589,7 @@ static inline void sock_release_ownership(struct sock *sk)
*/
#define sock_lock_init_class_and_name(sk, sname, skey, name, key) \
do { \
sk_owner_set(sk, THIS_MODULE); \
sk->sk_lock.owned = 0; \
init_waitqueue_head(&sk->sk_lock.wq); \
spin_lock_init(&(sk)->sk_lock.slock); \
+36 -7
View File
@@ -112,8 +112,31 @@ struct percpu_rw_semaphore cgroup_threadgroup_rwsem;
* of concurrent destructions. Use a separate workqueue so that cgroup
* destruction work items don't end up filling up max_active of system_wq
* which may lead to deadlock.
*
* A cgroup destruction should enqueue work sequentially to:
* cgroup_offline_wq: use for css offline work
* cgroup_release_wq: use for css release work
* cgroup_free_wq: use for free work
*
* Rationale for using separate workqueues:
* The cgroup root free work may depend on completion of other css offline
* operations. If all tasks were enqueued to a single workqueue, this could
* create a deadlock scenario where:
* - Free work waits for other css offline work to complete.
* - But other css offline work is queued after free work in the same queue.
*
* Example deadlock scenario with single workqueue (cgroup_destroy_wq):
* 1. umount net_prio
* 2. net_prio root destruction enqueues work to cgroup_destroy_wq (CPUx)
* 3. perf_event CSS A offline enqueues work to same cgroup_destroy_wq (CPUx)
* 4. net_prio cgroup_destroy_root->cgroup_lock_and_drain_offline.
* 5. net_prio root destruction blocks waiting for perf_event CSS A offline,
* which can never complete as it's behind in the same queue and
* workqueue's max_active is 1.
*/
static struct workqueue_struct *cgroup_destroy_wq;
static struct workqueue_struct *cgroup_offline_wq;
static struct workqueue_struct *cgroup_release_wq;
static struct workqueue_struct *cgroup_free_wq;
/* generate an array of cgroup subsystem pointers */
#define SUBSYS(_x) [_x ## _cgrp_id] = &_x ## _cgrp_subsys,
@@ -5114,7 +5137,7 @@ static void css_release_work_fn(struct work_struct *work)
mutex_unlock(&cgroup_mutex);
INIT_RCU_WORK(&css->destroy_rwork, css_free_rwork_fn);
queue_rcu_work(cgroup_destroy_wq, &css->destroy_rwork);
queue_rcu_work(cgroup_free_wq, &css->destroy_rwork);
}
static void css_release(struct percpu_ref *ref)
@@ -5123,7 +5146,7 @@ static void css_release(struct percpu_ref *ref)
container_of(ref, struct cgroup_subsys_state, refcnt);
INIT_WORK(&css->destroy_work, css_release_work_fn);
queue_work(cgroup_destroy_wq, &css->destroy_work);
queue_work(cgroup_release_wq, &css->destroy_work);
}
static void init_and_link_css(struct cgroup_subsys_state *css,
@@ -5254,7 +5277,7 @@ err_list_del:
err_free_css:
list_del_rcu(&css->rstat_css_node);
INIT_RCU_WORK(&css->destroy_rwork, css_free_rwork_fn);
queue_rcu_work(cgroup_destroy_wq, &css->destroy_rwork);
queue_rcu_work(cgroup_free_wq, &css->destroy_rwork);
return ERR_PTR(err);
}
@@ -5494,7 +5517,7 @@ static void css_killed_ref_fn(struct percpu_ref *ref)
if (atomic_dec_and_test(&css->online_cnt)) {
INIT_WORK(&css->destroy_work, css_killed_work_fn);
queue_work(cgroup_destroy_wq, &css->destroy_work);
queue_work(cgroup_offline_wq, &css->destroy_work);
}
}
@@ -5869,8 +5892,14 @@ static int __init cgroup_wq_init(void)
* We would prefer to do this in cgroup_init() above, but that
* is called before init_workqueues(): so leave this until after.
*/
cgroup_destroy_wq = alloc_workqueue("cgroup_destroy", 0, 1);
BUG_ON(!cgroup_destroy_wq);
cgroup_offline_wq = alloc_workqueue("cgroup_offline", 0, 1);
BUG_ON(!cgroup_offline_wq);
cgroup_release_wq = alloc_workqueue("cgroup_release", 0, 1);
BUG_ON(!cgroup_release_wq);
cgroup_free_wq = alloc_workqueue("cgroup_free", 0, 1);
BUG_ON(!cgroup_free_wq);
return 0;
}
core_initcall(cgroup_wq_init);
+24 -4
View File
@@ -113,9 +113,20 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time)
if (!cpufreq_this_cpu_can_update(sg_policy->policy))
return false;
if (unlikely(sg_policy->limits_changed)) {
sg_policy->limits_changed = false;
if (unlikely(READ_ONCE(sg_policy->limits_changed))) {
WRITE_ONCE(sg_policy->limits_changed, false);
sg_policy->need_freq_update = true;
/*
* The above limits_changed update must occur before the reads
* of policy limits in cpufreq_driver_resolve_freq() or a policy
* limits update might be missed, so use a memory barrier to
* ensure it.
*
* This pairs with the write memory barrier in sugov_limits().
*/
smp_mb();
return true;
}
@@ -638,7 +649,7 @@ static void sugov_walt_adjust(struct sugov_cpu *sg_cpu, unsigned long *util,
static inline void ignore_dl_rate_limit(struct sugov_cpu *sg_cpu, struct sugov_policy *sg_policy)
{
if (cpu_bw_dl(cpu_rq(sg_cpu->cpu)) > sg_cpu->bw_dl)
sg_policy->limits_changed = true;
WRITE_ONCE(sg_policy->limits_changed, true);
}
static inline unsigned long target_util(struct sugov_policy *sg_policy,
@@ -1409,7 +1420,16 @@ static void sugov_limits(struct cpufreq_policy *policy)
raw_spin_unlock_irqrestore(&sg_policy->update_lock, flags);
}
sg_policy->limits_changed = true;
/*
* The limits_changed update below must take place before the updates
* of policy limits in cpufreq_set_policy() or a policy limits update
* might be missed, so use a memory barrier to ensure it.
*
* This pairs with the memory barrier in sugov_should_update_freq().
*/
smp_wmb();
WRITE_ONCE(sg_policy->limits_changed, true);
}
static struct cpufreq_governor schedutil_gov = {
+1 -1
View File
@@ -1 +1 @@
-cip124
-cip125
+1 -1
View File
@@ -1 +1 @@
-st8
-st9
+14 -2
View File
@@ -1225,7 +1225,7 @@ static int khugepaged_scan_pmd(struct mm_struct *mm,
}
if (pte_young(pteval) ||
page_is_young(page) || PageReferenced(page) ||
mmu_notifier_test_young(vma->vm_mm, address))
mmu_notifier_test_young(vma->vm_mm, _address))
referenced++;
}
if (writable) {
@@ -1285,7 +1285,7 @@ static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff)
i_mmap_lock_write(mapping);
vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) {
/* probably overkill */
if (vma->anon_vma)
if (READ_ONCE(vma->anon_vma))
continue;
addr = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
if (addr & ~HPAGE_PMD_MASK)
@@ -1307,6 +1307,18 @@ static void retract_page_tables(struct address_space *mapping, pgoff_t pgoff)
spinlock_t *ptl;
unsigned long end = addr + HPAGE_PMD_SIZE;
/*
* Re-check whether we have an ->anon_vma, because
* collapse_and_free_pmd() requires that either no
* ->anon_vma exists or the anon_vma is locked.
* We already checked ->anon_vma above, but that check
* is racy because ->anon_vma can be populated under the
* mmap_sem in read mode.
*/
if (vma->anon_vma) {
up_write(&mm->mmap_sem);
continue;
}
mmu_notifier_invalidate_range_start(mm, addr,
end);
ptl = pmd_lock(mm, pmd);
+3 -4
View File
@@ -1548,10 +1548,9 @@ int unpoison_memory(unsigned long pfn)
static DEFINE_RATELIMIT_STATE(unpoison_rs, DEFAULT_RATELIMIT_INTERVAL,
DEFAULT_RATELIMIT_BURST);
if (!pfn_valid(pfn))
return -ENXIO;
p = pfn_to_page(pfn);
p = pfn_to_online_page(pfn);
if (!p)
return -EIO;
page = compound_head(p);
if (!PageHWPoison(p)) {
+2 -6
View File
@@ -2886,21 +2886,17 @@ static void migrate_vma_finalize(struct migrate_vma *migrate)
newpage = page;
}
if (!is_zone_device_page(newpage))
lru_cache_add(newpage);
remove_migration_ptes(page, newpage, false);
unlock_page(page);
migrate->cpages--;
if (is_zone_device_page(page))
put_page(page);
else
putback_lru_page(page);
if (newpage != page) {
unlock_page(newpage);
if (is_zone_device_page(newpage))
put_page(newpage);
else
putback_lru_page(newpage);
}
}
}
+5
View File
@@ -726,7 +726,12 @@ void object_err(struct kmem_cache *s, struct page *page,
u8 *object, char *reason)
{
slab_bug(s, "%s", reason);
if (!object || !check_valid_pointer(s, page, object)) {
print_page_info(page);
pr_err("Invalid pointer 0x%p\n", object);
} else {
print_trailer(s, page, object);
}
slab_panic(reason);
}
+4
View File
@@ -436,6 +436,10 @@ free:
int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *ptype, struct net_device *orig_dev)
{
skb = skb_share_check(skb, GFP_ATOMIC);
if (!skb)
return NET_RX_DROP;
skb_orphan(skb);
if (!net_eq(dev_net(dev), &init_net)) {
+6 -1
View File
@@ -1706,7 +1706,12 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb,
coding_len = ntohs(coded_packet_tmp.coded_len);
if (coding_len > skb->len)
/* ensure dst buffer is large enough (payload only) */
if (coding_len + h_size > skb->len)
return NULL;
/* ensure src buffer is large enough (payload only) */
if (coding_len + h_size > nc_packet->skb->len)
return NULL;
/* Here the magic is reversed:
+3
View File
@@ -1207,7 +1207,10 @@ static int l2cap_sock_release(struct socket *sock)
if (!sk)
return 0;
lock_sock_nested(sk, L2CAP_NESTING_PARENT);
l2cap_sock_cleanup_listen(sk);
release_sock(sk);
bt_sock_unlink(&l2cap_sk_list, sk);
err = l2cap_sock_shutdown(sock, 2);
+5
View File
@@ -1503,6 +1503,8 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
*/
static inline void sock_lock_init(struct sock *sk)
{
sk_owner_clear(sk);
if (sk->sk_kern_sock)
sock_lock_init_class_and_name(
sk,
@@ -1588,6 +1590,9 @@ static void sk_prot_free(struct proto *prot, struct sock *sk)
cgroup_sk_free(&sk->sk_cgrp_data);
mem_cgroup_sk_free(sk);
security_sk_free(sk);
sk_owner_put(sk);
if (slab != NULL)
kmem_cache_free(slab, sk);
else
+4 -2
View File
@@ -795,11 +795,12 @@ void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info)
struct sk_buff *cloned_skb = NULL;
struct ip_options opts = { 0 };
enum ip_conntrack_info ctinfo;
enum ip_conntrack_dir dir;
struct nf_conn *ct;
__be32 orig_ip;
ct = nf_ct_get(skb_in, &ctinfo);
if (!ct || !(ct->status & IPS_SRC_NAT)) {
if (!ct || !(READ_ONCE(ct->status) & IPS_NAT_MASK)) {
__icmp_send(skb_in, type, code, info, &opts);
return;
}
@@ -814,7 +815,8 @@ void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info)
goto out;
orig_ip = ip_hdr(skb_in)->saddr;
ip_hdr(skb_in)->saddr = ct->tuplehash[0].tuple.src.u3.ip;
dir = CTINFO2DIR(ctinfo);
ip_hdr(skb_in)->saddr = ct->tuplehash[dir].tuple.src.u3.ip;
__icmp_send(skb_in, type, code, info, &opts);
ip_hdr(skb_in)->saddr = orig_ip;
out:
+5
View File
@@ -2570,6 +2570,7 @@ int tcp_disconnect(struct sock *sk, int flags)
struct inet_connection_sock *icsk = inet_csk(sk);
struct tcp_sock *tp = tcp_sk(sk);
int old_state = sk->sk_state;
struct request_sock *req;
u32 seq;
if (old_state != TCP_CLOSE)
@@ -2665,6 +2666,10 @@ int tcp_disconnect(struct sock *sk, int flags)
/* Clean up fastopen related fields */
req = rcu_dereference_protected(tp->fastopen_rsk,
lockdep_sock_is_held(sk));
if (req)
reqsk_fastopen_remove(sk, req, false);
tcp_free_fastopen_req(tp);
inet->defer_connect = 0;
+4 -2
View File
@@ -54,11 +54,12 @@ void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info)
struct inet6_skb_parm parm = { 0 };
struct sk_buff *cloned_skb = NULL;
enum ip_conntrack_info ctinfo;
enum ip_conntrack_dir dir;
struct in6_addr orig_ip;
struct nf_conn *ct;
ct = nf_ct_get(skb_in, &ctinfo);
if (!ct || !(ct->status & IPS_SRC_NAT)) {
if (!ct || !(READ_ONCE(ct->status) & IPS_NAT_MASK)) {
__icmpv6_send(skb_in, type, code, info, &parm);
return;
}
@@ -73,7 +74,8 @@ void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info)
goto out;
orig_ip = ipv6_hdr(skb_in)->saddr;
ipv6_hdr(skb_in)->saddr = ct->tuplehash[0].tuple.src.u3.in6;
dir = CTINFO2DIR(ctinfo);
ipv6_hdr(skb_in)->saddr = ct->tuplehash[dir].tuple.src.u3.in6;
__icmpv6_send(skb_in, type, code, info, &parm);
ipv6_hdr(skb_in)->saddr = orig_ip;
out:
+2 -2
View File
@@ -413,7 +413,7 @@ int nf_conntrack_helper_register(struct nf_conntrack_helper *me)
(cur->tuple.src.l3num == NFPROTO_UNSPEC ||
cur->tuple.src.l3num == me->tuple.src.l3num) &&
cur->tuple.dst.protonum == me->tuple.dst.protonum) {
ret = -EEXIST;
ret = -EBUSY;
goto out;
}
}
@@ -424,7 +424,7 @@ int nf_conntrack_helper_register(struct nf_conntrack_helper *me)
hlist_for_each_entry(cur, &nf_ct_helper_hash[h], hnode) {
if (nf_ct_tuple_src_mask_cmp(&cur->tuple, &me->tuple,
&mask)) {
ret = -EEXIST;
ret = -EBUSY;
goto out;
}
}
+19 -3
View File
@@ -92,16 +92,25 @@ static int rfkill_gpio_acpi_probe(struct device *dev,
static int rfkill_gpio_probe(struct platform_device *pdev)
{
struct rfkill_gpio_data *rfkill;
const char *type_name = NULL;
const char *name_property;
const char *type_property;
struct gpio_desc *gpio;
const char *type_name;
int ret;
rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL);
if (!rfkill)
return -ENOMEM;
device_property_read_string(&pdev->dev, "name", &rfkill->name);
device_property_read_string(&pdev->dev, "type", &type_name);
if (dev_of_node(&pdev->dev)) {
name_property = "label";
type_property = "radio-type";
} else {
name_property = "name";
type_property = "type";
}
device_property_read_string(&pdev->dev, name_property, &rfkill->name);
device_property_read_string(&pdev->dev, type_property, &type_name);
if (!rfkill->name)
rfkill->name = dev_name(&pdev->dev);
@@ -183,12 +192,19 @@ static const struct acpi_device_id rfkill_acpi_match[] = {
MODULE_DEVICE_TABLE(acpi, rfkill_acpi_match);
#endif
static const struct of_device_id rfkill_of_match[] __maybe_unused = {
{ .compatible = "rfkill-gpio", },
{ },
};
MODULE_DEVICE_TABLE(of, rfkill_of_match);
static struct platform_driver rfkill_gpio_driver = {
.probe = rfkill_gpio_probe,
.remove = rfkill_gpio_remove,
.driver = {
.name = "rfkill_gpio",
.acpi_match_table = ACPI_PTR(rfkill_acpi_match),
.of_match_table = of_match_ptr(rfkill_of_match),
},
};
+32
View File
@@ -182,6 +182,38 @@ static inline tree build_const_char_string(int len, const char *str)
return cstr;
}
static inline void __add_type_attr(tree type, const char *attr, tree args)
{
tree oldattr;
if (type == NULL_TREE)
return;
oldattr = lookup_attribute(attr, TYPE_ATTRIBUTES(type));
if (oldattr != NULL_TREE) {
gcc_assert(TREE_VALUE(oldattr) == args || TREE_VALUE(TREE_VALUE(oldattr)) == TREE_VALUE(args));
return;
}
TYPE_ATTRIBUTES(type) = copy_list(TYPE_ATTRIBUTES(type));
TYPE_ATTRIBUTES(type) = tree_cons(get_identifier(attr), args, TYPE_ATTRIBUTES(type));
}
static inline void add_type_attr(tree type, const char *attr, tree args)
{
tree main_variant = TYPE_MAIN_VARIANT(type);
__add_type_attr(TYPE_CANONICAL(type), attr, args);
__add_type_attr(TYPE_CANONICAL(main_variant), attr, args);
__add_type_attr(main_variant, attr, args);
for (type = TYPE_NEXT_VARIANT(main_variant); type; type = TYPE_NEXT_VARIANT(type)) {
if (!lookup_attribute(attr, TYPE_ATTRIBUTES(type)))
TYPE_ATTRIBUTES(type) = TYPE_ATTRIBUTES(main_variant);
__add_type_attr(TYPE_CANONICAL(type), attr, args);
}
}
#define PASS_INFO(NAME, REF, ID, POS) \
struct register_pass_info NAME##_pass_info = { \
.pass = make_##NAME##_pass(), \
+12 -28
View File
@@ -95,6 +95,9 @@ static tree handle_randomize_layout_attr(tree *node, tree name, tree args, int f
if (TYPE_P(*node)) {
type = *node;
} else if (TREE_CODE(*node) == FIELD_DECL) {
*no_add_attrs = false;
return NULL_TREE;
} else {
gcc_assert(TREE_CODE(*node) == TYPE_DECL);
type = TREE_TYPE(*node);
@@ -377,35 +380,18 @@ static int relayout_struct(tree type)
shuffle(type, (tree *)newtree, shuffle_length);
/*
* set up a bogus anonymous struct field designed to error out on unnamed struct initializers
* as gcc provides no other way to detect such code
*/
list = make_node(FIELD_DECL);
TREE_CHAIN(list) = newtree[0];
TREE_TYPE(list) = void_type_node;
DECL_SIZE(list) = bitsize_zero_node;
DECL_NONADDRESSABLE_P(list) = 1;
DECL_FIELD_BIT_OFFSET(list) = bitsize_zero_node;
DECL_SIZE_UNIT(list) = size_zero_node;
DECL_FIELD_OFFSET(list) = size_zero_node;
DECL_CONTEXT(list) = type;
// to satisfy the constify plugin
TREE_READONLY(list) = 1;
for (i = 0; i < num_fields - 1; i++)
TREE_CHAIN(newtree[i]) = newtree[i+1];
TREE_CHAIN(newtree[num_fields - 1]) = NULL_TREE;
main_variant = TYPE_MAIN_VARIANT(type);
for (variant = main_variant; variant; variant = TYPE_NEXT_VARIANT(variant)) {
TYPE_FIELDS(variant) = list;
TYPE_ATTRIBUTES(variant) = copy_list(TYPE_ATTRIBUTES(variant));
TYPE_ATTRIBUTES(variant) = tree_cons(get_identifier("randomize_performed"), NULL_TREE, TYPE_ATTRIBUTES(variant));
TYPE_ATTRIBUTES(variant) = tree_cons(get_identifier("designated_init"), NULL_TREE, TYPE_ATTRIBUTES(variant));
add_type_attr(type, "randomize_performed", NULL_TREE);
add_type_attr(type, "designated_init", NULL_TREE);
if (has_flexarray)
TYPE_ATTRIBUTES(type) = tree_cons(get_identifier("has_flexarray"), NULL_TREE, TYPE_ATTRIBUTES(type));
}
add_type_attr(type, "has_flexarray", NULL_TREE);
main_variant = TYPE_MAIN_VARIANT(type);
for (variant = main_variant; variant; variant = TYPE_NEXT_VARIANT(variant))
TYPE_FIELDS(variant) = newtree[0];
/*
* force a re-layout of the main variant
@@ -473,10 +459,8 @@ static void randomize_type(tree type)
if (lookup_attribute("randomize_layout", TYPE_ATTRIBUTES(TYPE_MAIN_VARIANT(type))) || is_pure_ops_struct(type))
relayout_struct(type);
for (variant = TYPE_MAIN_VARIANT(type); variant; variant = TYPE_NEXT_VARIANT(variant)) {
TYPE_ATTRIBUTES(type) = copy_list(TYPE_ATTRIBUTES(type));
TYPE_ATTRIBUTES(type) = tree_cons(get_identifier("randomize_considered"), NULL_TREE, TYPE_ATTRIBUTES(type));
}
add_type_attr(type, "randomize_considered", NULL_TREE);
#ifdef __DEBUG_PLUGIN
fprintf(stderr, "Marking randomize_considered on struct %s\n", ORIG_TYPE_NAME(type));
#ifdef __DEBUG_VERBOSE
+1 -1
View File
@@ -74,7 +74,7 @@ static __poll_t hwdep_poll(struct snd_hwdep *hwdep, struct file *file,
events = 0;
spin_unlock_irq(&motu->lock);
return events | EPOLLOUT;
return events;
}
static int hwdep_get_info(struct snd_motu *motu, void __user *arg)
+1 -1
View File
@@ -221,7 +221,7 @@ static const struct snd_kcontrol_new wm8940_snd_controls[] = {
SOC_SINGLE_TLV("Digital Capture Volume", WM8940_ADCVOL,
0, 255, 0, wm8940_adc_tlv),
SOC_ENUM("Mic Bias Level", wm8940_mic_bias_level_enum),
SOC_SINGLE_TLV("Capture Boost Volue", WM8940_ADCBOOST,
SOC_SINGLE_TLV("Capture Boost Volume", WM8940_ADCBOOST,
8, 1, 0, wm8940_capture_boost_vol_tlv),
SOC_SINGLE_TLV("Speaker Playback Volume", WM8940_SPKVOL,
0, 63, 0, wm8940_spk_vol_tlv),
+6 -2
View File
@@ -431,10 +431,14 @@ static int wm8974_update_clocks(struct snd_soc_dai *dai)
fs256 = 256 * priv->fs;
f = wm8974_get_mclkdiv(priv->mclk, fs256, &mclkdiv);
if (f != priv->mclk) {
/* The PLL performs best around 90MHz */
fpll = wm8974_get_mclkdiv(22500000, fs256, &mclkdiv);
if (fs256 % 8000)
f = 22579200;
else
f = 24576000;
fpll = wm8974_get_mclkdiv(f, fs256, &mclkdiv);
}
wm8974_set_dai_pll(dai, 0, 0, priv->mclk, fpll);
+276 -5
View File
@@ -29,6 +29,7 @@
#include <linux/hid.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/math64.h>
#include <linux/slab.h>
#include <linux/usb.h>
@@ -87,7 +88,8 @@ static int snd_create_std_mono_ctl_offset(struct usb_mixer_interface *mixer,
cval->idx_off = idx_off;
/* get_min_max() is called only for integer volumes later,
* so provide a short-cut for booleans */
* so provide a short-cut for booleans
*/
cval->min = 0;
cval->max = 1;
cval->res = 0;
@@ -136,7 +138,7 @@ static int snd_create_std_mono_table(struct usb_mixer_interface *mixer,
{
int err;
while (t->name != NULL) {
while (t->name) {
err = snd_create_std_mono_ctl(mixer, t->unitid, t->control,
t->cmask, t->val_type, t->name, t->tlv_callback);
if (err < 0)
@@ -218,7 +220,6 @@ static void snd_usb_soundblaster_remote_complete(struct urb *urb)
if (code == rc->mute_code)
snd_usb_mixer_notify_id(mixer, rc->mute_mixer_id);
mixer->rc_code = code;
wmb();
wake_up(&mixer->rc_waitq);
}
@@ -538,6 +539,265 @@ static int snd_emu0204_controls_create(struct usb_mixer_interface *mixer)
&snd_emu0204_control, NULL);
}
#if IS_REACHABLE(CONFIG_INPUT)
/*
* Sony DualSense controller (PS5) jack detection
*
* Since this is an UAC 1 device, it doesn't support jack detection.
* However, the controller hid-playstation driver reports HP & MIC
* insert events through a dedicated input device.
*/
#define SND_DUALSENSE_JACK_OUT_TERM_ID 3
#define SND_DUALSENSE_JACK_IN_TERM_ID 4
struct dualsense_mixer_elem_info {
struct usb_mixer_elem_info info;
struct input_handler ih;
struct input_device_id id_table[2];
bool connected;
};
static void snd_dualsense_ih_event(struct input_handle *handle,
unsigned int type, unsigned int code,
int value)
{
struct dualsense_mixer_elem_info *mei;
struct usb_mixer_elem_list *me;
if (type != EV_SW)
return;
mei = container_of(handle->handler, struct dualsense_mixer_elem_info, ih);
me = &mei->info.head;
if ((me->id == SND_DUALSENSE_JACK_OUT_TERM_ID && code == SW_HEADPHONE_INSERT) ||
(me->id == SND_DUALSENSE_JACK_IN_TERM_ID && code == SW_MICROPHONE_INSERT)) {
mei->connected = !!value;
snd_ctl_notify(me->mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
&me->kctl->id);
}
}
static bool snd_dualsense_ih_match(struct input_handler *handler,
struct input_dev *dev)
{
struct dualsense_mixer_elem_info *mei;
struct usb_device *snd_dev;
char *input_dev_path, *usb_dev_path;
size_t usb_dev_path_len;
bool match = false;
mei = container_of(handler, struct dualsense_mixer_elem_info, ih);
snd_dev = mei->info.head.mixer->chip->dev;
input_dev_path = kobject_get_path(&dev->dev.kobj, GFP_KERNEL);
if (!input_dev_path) {
dev_warn(&snd_dev->dev, "Failed to get input dev path\n");
return false;
}
usb_dev_path = kobject_get_path(&snd_dev->dev.kobj, GFP_KERNEL);
if (!usb_dev_path) {
dev_warn(&snd_dev->dev, "Failed to get USB dev path\n");
goto free_paths;
}
/*
* Ensure the VID:PID matched input device supposedly owned by the
* hid-playstation driver belongs to the actual hardware handled by
* the current USB audio device, which implies input_dev_path being
* a subpath of usb_dev_path.
*
* This verification is necessary when there is more than one identical
* controller attached to the host system.
*/
usb_dev_path_len = strlen(usb_dev_path);
if (usb_dev_path_len >= strlen(input_dev_path))
goto free_paths;
usb_dev_path[usb_dev_path_len] = '/';
match = !memcmp(input_dev_path, usb_dev_path, usb_dev_path_len + 1);
free_paths:
kfree(input_dev_path);
kfree(usb_dev_path);
return match;
}
static int snd_dualsense_ih_connect(struct input_handler *handler,
struct input_dev *dev,
const struct input_device_id *id)
{
struct input_handle *handle;
int err;
handle = kzalloc(sizeof(*handle), GFP_KERNEL);
if (!handle)
return -ENOMEM;
handle->dev = dev;
handle->handler = handler;
handle->name = handler->name;
err = input_register_handle(handle);
if (err)
goto err_free;
err = input_open_device(handle);
if (err)
goto err_unregister;
return 0;
err_unregister:
input_unregister_handle(handle);
err_free:
kfree(handle);
return err;
}
static void snd_dualsense_ih_disconnect(struct input_handle *handle)
{
input_close_device(handle);
input_unregister_handle(handle);
kfree(handle);
}
static void snd_dualsense_ih_start(struct input_handle *handle)
{
struct dualsense_mixer_elem_info *mei;
struct usb_mixer_elem_list *me;
int status = -1;
mei = container_of(handle->handler, struct dualsense_mixer_elem_info, ih);
me = &mei->info.head;
if (me->id == SND_DUALSENSE_JACK_OUT_TERM_ID &&
test_bit(SW_HEADPHONE_INSERT, handle->dev->swbit))
status = test_bit(SW_HEADPHONE_INSERT, handle->dev->sw);
else if (me->id == SND_DUALSENSE_JACK_IN_TERM_ID &&
test_bit(SW_MICROPHONE_INSERT, handle->dev->swbit))
status = test_bit(SW_MICROPHONE_INSERT, handle->dev->sw);
if (status >= 0) {
mei->connected = !!status;
snd_ctl_notify(me->mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
&me->kctl->id);
}
}
static int snd_dualsense_jack_get(struct snd_kcontrol *kctl,
struct snd_ctl_elem_value *ucontrol)
{
struct dualsense_mixer_elem_info *mei = snd_kcontrol_chip(kctl);
ucontrol->value.integer.value[0] = mei->connected;
return 0;
}
static const struct snd_kcontrol_new snd_dualsense_jack_control = {
.iface = SNDRV_CTL_ELEM_IFACE_CARD,
.access = SNDRV_CTL_ELEM_ACCESS_READ,
.info = snd_ctl_boolean_mono_info,
.get = snd_dualsense_jack_get,
};
static int snd_dualsense_resume_jack(struct usb_mixer_elem_list *list)
{
snd_ctl_notify(list->mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
&list->kctl->id);
return 0;
}
static void snd_dualsense_mixer_elem_free(struct snd_kcontrol *kctl)
{
struct dualsense_mixer_elem_info *mei = snd_kcontrol_chip(kctl);
if (mei->ih.event)
input_unregister_handler(&mei->ih);
snd_usb_mixer_elem_free(kctl);
}
static int snd_dualsense_jack_create(struct usb_mixer_interface *mixer,
const char *name, bool is_output)
{
struct dualsense_mixer_elem_info *mei;
struct input_device_id *idev_id;
struct snd_kcontrol *kctl;
int err;
mei = kzalloc(sizeof(*mei), GFP_KERNEL);
if (!mei)
return -ENOMEM;
snd_usb_mixer_elem_init_std(&mei->info.head, mixer,
is_output ? SND_DUALSENSE_JACK_OUT_TERM_ID :
SND_DUALSENSE_JACK_IN_TERM_ID);
mei->info.head.resume = snd_dualsense_resume_jack;
mei->info.val_type = USB_MIXER_BOOLEAN;
mei->info.channels = 1;
mei->info.min = 0;
mei->info.max = 1;
kctl = snd_ctl_new1(&snd_dualsense_jack_control, mei);
if (!kctl) {
kfree(mei);
return -ENOMEM;
}
strscpy(kctl->id.name, name, sizeof(kctl->id.name));
kctl->private_free = snd_dualsense_mixer_elem_free;
err = snd_usb_mixer_add_control(&mei->info.head, kctl);
if (err)
return err;
idev_id = &mei->id_table[0];
idev_id->flags = INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT |
INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_SWBIT;
idev_id->vendor = USB_ID_VENDOR(mixer->chip->usb_id);
idev_id->product = USB_ID_PRODUCT(mixer->chip->usb_id);
idev_id->evbit[BIT_WORD(EV_SW)] = BIT_MASK(EV_SW);
if (is_output)
idev_id->swbit[BIT_WORD(SW_HEADPHONE_INSERT)] = BIT_MASK(SW_HEADPHONE_INSERT);
else
idev_id->swbit[BIT_WORD(SW_MICROPHONE_INSERT)] = BIT_MASK(SW_MICROPHONE_INSERT);
mei->ih.event = snd_dualsense_ih_event;
mei->ih.match = snd_dualsense_ih_match;
mei->ih.connect = snd_dualsense_ih_connect;
mei->ih.disconnect = snd_dualsense_ih_disconnect;
mei->ih.start = snd_dualsense_ih_start;
mei->ih.name = name;
mei->ih.id_table = mei->id_table;
err = input_register_handler(&mei->ih);
if (err) {
dev_warn(&mixer->chip->dev->dev,
"Could not register input handler: %d\n", err);
mei->ih.event = NULL;
}
return 0;
}
static int snd_dualsense_controls_create(struct usb_mixer_interface *mixer)
{
int err;
err = snd_dualsense_jack_create(mixer, "Headphone Jack", true);
if (err < 0)
return err;
return snd_dualsense_jack_create(mixer, "Headset Mic Jack", false);
}
#endif /* IS_REACHABLE(CONFIG_INPUT) */
/* ASUS Xonar U1 / U3 controls */
static int snd_xonar_u1_switch_get(struct snd_kcontrol *kcontrol,
@@ -1603,7 +1863,8 @@ static int snd_microii_spdif_default_put(struct snd_kcontrol *kcontrol,
unsigned int pval, pval_old;
int err;
pval = pval_old = kcontrol->private_value;
pval = kcontrol->private_value;
pval_old = pval;
pval &= 0xfffff0f0;
pval |= (ucontrol->value.iec958.status[1] & 0x0f) << 8;
pval |= (ucontrol->value.iec958.status[0] & 0x0f);
@@ -2394,6 +2655,13 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
err = snd_emu0204_controls_create(mixer);
break;
#if IS_REACHABLE(CONFIG_INPUT)
case USB_ID(0x054c, 0x0ce6): /* Sony DualSense controller (PS5) */
case USB_ID(0x054c, 0x0df2): /* Sony DualSense Edge controller (PS5) */
err = snd_dualsense_controls_create(mixer);
break;
#endif /* IS_REACHABLE(CONFIG_INPUT) */
case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */
case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C400 */
err = snd_c400_create_mixer(mixer);
@@ -2510,7 +2778,8 @@ static void snd_dragonfly_quirk_db_scale(struct usb_mixer_interface *mixer,
struct snd_kcontrol *kctl)
{
/* Approximation using 10 ranges based on output measurement on hw v1.2.
* This seems close to the cubic mapping e.g. alsamixer uses. */
* This seems close to the cubic mapping e.g. alsamixer uses.
*/
static const DECLARE_TLV_DB_RANGE(scale,
0, 1, TLV_DB_MINMAX_ITEM(-5300, -4970),
2, 5, TLV_DB_MINMAX_ITEM(-4710, -4160),
@@ -2595,9 +2864,11 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
snd_dragonfly_quirk_db_scale(mixer, cval, kctl);
break;
/* lowest playback value is muted on some devices */
case USB_ID(0x0572, 0x1b09): /* Conexant Systems (Rockwell), Inc. */
case USB_ID(0x0d8c, 0x000c): /* C-Media */
case USB_ID(0x0d8c, 0x0014): /* C-Media */
case USB_ID(0x19f7, 0x0003): /* RODE NT-USB */
case USB_ID(0x2d99, 0x0026): /* HECATE G2 GAMING HEADSET */
if (strstr(kctl->id.name, "Playback"))
cval->min_mute = 1;
break;