Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Merge 'upstream-linux-4.14.y' from https://android.googlesource.com/k…
Browse files Browse the repository at this point in the history
…ernel/common into staging/tests

* android-kernel/upstream-linux-4.14.y: (27 commits)
  Linux 4.14.334
  powerpc/ftrace: Fix stack teardown in ftrace_no_trace
  powerpc/ftrace: Create a dummy stackframe to fix stack unwind
  ring-buffer: Fix memory leak of free page
  team: Fix use-after-free when an option instance allocation fails
  ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS
  HID: hid-asus: add const to read-only outgoing usb buffer
  net: usb: qmi_wwan: claim interface 4 for ZTE MF290
  asm-generic: qspinlock: fix queued_spin_value_unlocked() implementation
  HID: multitouch: Add quirk for HONOR GLO-GXXX touchpad
  HID: hid-asus: reset the backlight brightness level on resume
  platform/x86: intel_telemetry: Fix kernel doc descriptions
  bcache: add code comments for bch_btree_node_get() and __bch_btree_node_alloc()
  blk-throttle: fix lockdep warning of "cgroup_mutex or RCU read lock required!"
  cred: switch to using atomic_long_t
  appletalk: Fix Use-After-Free in atalk_ioctl
  vsock/virtio: Fix unsigned integer wrap around in virtio_transport_has_space()
  sign-file: Fix incorrect return values check
  net: Remove acked SYN flag from packet in the transmit queue correctly
  qed: Fix a potential use-after-free in qed_cxt_tables_alloc
  ...
  • Loading branch information
David112x committed Dec 23, 2023
2 parents 72c0930 + d05fea7 commit 5050c32
Show file tree
Hide file tree
Showing 24 changed files with 151 additions and 74 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
VERSION = 4
PATCHLEVEL = 14
SUBLEVEL = 333
SUBLEVEL = 334
EXTRAVERSION =
NAME = Petit Gorille

Expand Down
9 changes: 7 additions & 2 deletions arch/powerpc/kernel/trace/ftrace_64_mprofile.S
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ _GLOBAL(ftrace_caller)
/* Save the original return address in A's stack frame */
std r0,LRSAVE(r1)

/* Create a minimal stack frame for representing B */
stdu r1, -STACK_FRAME_MIN_SIZE(r1)

/* Create our stack frame + pt_regs */
stdu r1,-SWITCH_FRAME_SIZE(r1)

Expand All @@ -51,7 +54,7 @@ _GLOBAL(ftrace_caller)
SAVE_10GPRS(22, r1)

/* Save previous stack pointer (r1) */
addi r8, r1, SWITCH_FRAME_SIZE
addi r8, r1, SWITCH_FRAME_SIZE+STACK_FRAME_MIN_SIZE
std r8, GPR1(r1)

/* Load special regs for save below */
Expand All @@ -64,6 +67,8 @@ _GLOBAL(ftrace_caller)
mflr r7
/* Save it as pt_regs->nip */
std r7, _NIP(r1)
/* Also save it in B's stackframe header for proper unwind */
std r7, LRSAVE+SWITCH_FRAME_SIZE(r1)
/* Save the read LR in pt_regs->link */
std r0, _LINK(r1)

Expand Down Expand Up @@ -146,7 +151,7 @@ ftrace_call:
ld r2, 24(r1)

/* Pop our stack frame */
addi r1, r1, SWITCH_FRAME_SIZE
addi r1, r1, SWITCH_FRAME_SIZE+STACK_FRAME_MIN_SIZE

#ifdef CONFIG_LIVEPATCH
/*
Expand Down
2 changes: 2 additions & 0 deletions block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,7 @@ static void tg_conf_updated(struct throtl_grp *tg, bool global)
tg_bps_limit(tg, READ), tg_bps_limit(tg, WRITE),
tg_iops_limit(tg, READ), tg_iops_limit(tg, WRITE));

rcu_read_lock();
/*
* Update has_rules[] flags for the updated tg's subtree. A tg is
* considered to have rules if either the tg itself or any of its
Expand Down Expand Up @@ -1418,6 +1419,7 @@ static void tg_conf_updated(struct throtl_grp *tg, bool global)
this_tg->latency_target = max(this_tg->latency_target,
parent_tg->latency_target);
}
rcu_read_unlock();

/*
* We're already holding queue_lock and know @tg is valid. Let's
Expand Down
8 changes: 4 additions & 4 deletions drivers/atm/solos-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,9 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr,
struct sk_buff *skb;
unsigned int len;

spin_lock(&card->cli_queue_lock);
spin_lock_bh(&card->cli_queue_lock);
skb = skb_dequeue(&card->cli_queue[SOLOS_CHAN(atmdev)]);
spin_unlock(&card->cli_queue_lock);
spin_unlock_bh(&card->cli_queue_lock);
if(skb == NULL)
return sprintf(buf, "No data.\n");

Expand Down Expand Up @@ -968,14 +968,14 @@ static void pclose(struct atm_vcc *vcc)
struct pkt_hdr *header;

/* Remove any yet-to-be-transmitted packets from the pending queue */
spin_lock(&card->tx_queue_lock);
spin_lock_bh(&card->tx_queue_lock);
skb_queue_walk_safe(&card->tx_queue[port], skb, tmpskb) {
if (SKB_CB(skb)->vcc == vcc) {
skb_unlink(skb, &card->tx_queue[port]);
solos_pop(vcc, skb);
}
}
spin_unlock(&card->tx_queue_lock);
spin_unlock_bh(&card->tx_queue_lock);

skb = alloc_skb(sizeof(*header), GFP_KERNEL);
if (!skb) {
Expand Down
25 changes: 22 additions & 3 deletions drivers/hid/hid-asus.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static int asus_raw_event(struct hid_device *hdev,
return 0;
}

static int asus_kbd_set_report(struct hid_device *hdev, u8 *buf, size_t buf_size)
static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t buf_size)
{
unsigned char *dmabuf;
int ret;
Expand All @@ -251,7 +251,7 @@ static int asus_kbd_set_report(struct hid_device *hdev, u8 *buf, size_t buf_size

static int asus_kbd_init(struct hid_device *hdev)
{
u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54,
const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54,
0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 };
int ret;

Expand All @@ -265,7 +265,7 @@ static int asus_kbd_init(struct hid_device *hdev)
static int asus_kbd_get_functions(struct hid_device *hdev,
unsigned char *kbd_func)
{
u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x05, 0x20, 0x31, 0x00, 0x08 };
const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x05, 0x20, 0x31, 0x00, 0x08 };
u8 *readbuf;
int ret;

Expand Down Expand Up @@ -592,6 +592,24 @@ static int asus_start_multitouch(struct hid_device *hdev)
return 0;
}

static int __maybe_unused asus_resume(struct hid_device *hdev) {
struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
int ret = 0;

if (drvdata->kbd_backlight) {
const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0xba, 0xc5, 0xc4,
drvdata->kbd_backlight->cdev.brightness };
ret = asus_kbd_set_report(hdev, buf, sizeof(buf));
if (ret < 0) {
hid_err(hdev, "Asus failed to set keyboard backlight: %d\n", ret);
goto asus_resume_err;
}
}

asus_resume_err:
return ret;
}

static int __maybe_unused asus_reset_resume(struct hid_device *hdev)
{
struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
Expand Down Expand Up @@ -768,6 +786,7 @@ static struct hid_driver asus_driver = {
.input_configured = asus_input_configured,
#ifdef CONFIG_PM
.reset_resume = asus_reset_resume,
.resume = asus_resume,
#endif
.raw_event = asus_raw_event
};
Expand Down
5 changes: 5 additions & 0 deletions drivers/hid/hid-multitouch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,11 @@ static const struct hid_device_id mt_devices[] = {
MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT,
USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },

/* HONOR GLO-GXXX panel */
{ .driver_data = MT_CLS_VTL,
HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
0x347d, 0x7853) },

/* Ilitek dual touch panel */
{ .driver_data = MT_CLS_NSMU,
MT_USB_DEVICE(USB_VENDOR_ID_ILITEK,
Expand Down
7 changes: 7 additions & 0 deletions drivers/md/bcache/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,9 @@ static struct btree *mca_alloc(struct cache_set *c, struct btree_op *op,
*
* The btree node will have either a read or a write lock held, depending on
* level and op->lock.
*
* Note: Only error code or btree pointer will be returned, it is unncessary
* for callers to check NULL pointer.
*/
struct btree *bch_btree_node_get(struct cache_set *c, struct btree_op *op,
struct bkey *k, int level, bool write,
Expand Down Expand Up @@ -1070,6 +1073,10 @@ static void btree_node_free(struct btree *b)
mutex_unlock(&b->c->bucket_lock);
}

/*
* Only error code or btree pointer will be returned, it is unncessary for
* callers to check NULL pointer.
*/
struct btree *__bch_btree_node_alloc(struct cache_set *c, struct btree_op *op,
int level, bool wait,
struct btree *parent)
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/qlogic/qed/qed_cxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,7 @@ static void qed_ilt_shadow_free(struct qed_hwfn *p_hwfn)
p_dma->p_virt = NULL;
}
kfree(p_mngr->ilt_shadow);
p_mngr->ilt_shadow = NULL;
}

static int qed_ilt_blk_alloc(struct qed_hwfn *p_hwfn,
Expand Down
17 changes: 9 additions & 8 deletions drivers/net/ethernet/qualcomm/qca_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

#define QCASPI_MAX_REGS 0x20

#define QCASPI_RX_MAX_FRAMES 4

static const u16 qcaspi_spi_regs[] = {
SPI_REG_BFR_SIZE,
SPI_REG_WRBUF_SPC_AVA,
Expand Down Expand Up @@ -266,31 +268,30 @@ qcaspi_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
{
struct qcaspi *qca = netdev_priv(dev);

ring->rx_max_pending = 4;
ring->rx_max_pending = QCASPI_RX_MAX_FRAMES;
ring->tx_max_pending = TX_RING_MAX_LEN;
ring->rx_pending = 4;
ring->rx_pending = QCASPI_RX_MAX_FRAMES;
ring->tx_pending = qca->txr.count;
}

static int
qcaspi_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
{
const struct net_device_ops *ops = dev->netdev_ops;
struct qcaspi *qca = netdev_priv(dev);

if ((ring->rx_pending) ||
if (ring->rx_pending != QCASPI_RX_MAX_FRAMES ||
(ring->rx_mini_pending) ||
(ring->rx_jumbo_pending))
return -EINVAL;

if (netif_running(dev))
ops->ndo_stop(dev);
if (qca->spi_thread)
kthread_park(qca->spi_thread);

qca->txr.count = max_t(u32, ring->tx_pending, TX_RING_MIN_LEN);
qca->txr.count = min_t(u16, qca->txr.count, TX_RING_MAX_LEN);

if (netif_running(dev))
ops->ndo_open(dev);
if (qca->spi_thread)
kthread_unpark(qca->spi_thread);

return 0;
}
Expand Down
20 changes: 19 additions & 1 deletion drivers/net/ethernet/qualcomm/qca_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,18 @@ qcaspi_spi_thread(void *data)
netdev_info(qca->net_dev, "SPI thread created\n");
while (!kthread_should_stop()) {
set_current_state(TASK_INTERRUPTIBLE);
if (kthread_should_park()) {
netif_tx_disable(qca->net_dev);
netif_carrier_off(qca->net_dev);
qcaspi_flush_tx_ring(qca);
kthread_parkme();
if (qca->sync == QCASPI_SYNC_READY) {
netif_carrier_on(qca->net_dev);
netif_wake_queue(qca->net_dev);
}
continue;
}

if ((qca->intr_req == qca->intr_svc) &&
!qca->txr.skb[qca->txr.head])
schedule();
Expand Down Expand Up @@ -580,11 +592,17 @@ qcaspi_spi_thread(void *data)
if (intr_cause & SPI_INT_CPU_ON) {
qcaspi_qca7k_sync(qca, QCASPI_EVENT_CPUON);

/* Frame decoding in progress */
if (qca->frm_handle.state != qca->frm_handle.init)
qca->net_dev->stats.rx_dropped++;

qcafrm_fsm_init_spi(&qca->frm_handle);
qca->stats.device_reset++;

/* not synced. */
if (qca->sync != QCASPI_SYNC_READY)
continue;

qca->stats.device_reset++;
netif_wake_queue(qca->net_dev);
netif_carrier_on(qca->net_dev);
}
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/team/team.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,10 @@ static int __team_options_register(struct team *team,
return 0;

inst_rollback:
for (i--; i >= 0; i--)
for (i--; i >= 0; i--) {
__team_option_inst_del_option(team, dst_opts[i]);
list_del(&dst_opts[i]->list);
}

i = option_count;
alloc_rollback:
Expand Down
1 change: 1 addition & 0 deletions drivers/net/usb/qmi_wwan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,7 @@ static const struct usb_device_id products[] = {
{QMI_FIXED_INTF(0x19d2, 0x0168, 4)},
{QMI_FIXED_INTF(0x19d2, 0x0176, 3)},
{QMI_FIXED_INTF(0x19d2, 0x0178, 3)},
{QMI_FIXED_INTF(0x19d2, 0x0189, 4)}, /* ZTE MF290 */
{QMI_FIXED_INTF(0x19d2, 0x0191, 4)}, /* ZTE EuFi890 */
{QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */
{QMI_FIXED_INTF(0x19d2, 0x0200, 1)},
Expand Down
4 changes: 2 additions & 2 deletions drivers/platform/x86/intel_telemetry_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static const struct telemetry_core_ops telm_defpltops = {
/**
* telemetry_update_events() - Update telemetry Configuration
* @pss_evtconfig: PSS related config. No change if num_evts = 0.
* @pss_evtconfig: IOSS related config. No change if num_evts = 0.
* @ioss_evtconfig: IOSS related config. No change if num_evts = 0.
*
* This API updates the IOSS & PSS Telemetry configuration. Old config
* is overwritten. Call telemetry_reset_events when logging is over
Expand Down Expand Up @@ -185,7 +185,7 @@ EXPORT_SYMBOL_GPL(telemetry_reset_events);
/**
* telemetry_get_eventconfig() - Returns the pss and ioss events enabled
* @pss_evtconfig: Pointer to PSS related configuration.
* @pss_evtconfig: Pointer to IOSS related configuration.
* @ioss_evtconfig: Pointer to IOSS related configuration.
* @pss_len: Number of u32 elements allocated for pss_evtconfig array
* @ioss_len: Number of u32 elements allocated for ioss_evtconfig array
*
Expand Down
4 changes: 4 additions & 0 deletions fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3207,6 +3207,10 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
start = max(start, rounddown(ac->ac_o_ex.fe_logical,
(ext4_lblk_t)EXT4_BLOCKS_PER_GROUP(ac->ac_sb)));

/* avoid unnecessary preallocation that may trigger assertions */
if (start + size > EXT_MAX_BLOCKS)
size = EXT_MAX_BLOCKS - start;

/* don't cover already allocated blocks in selected range */
if (ar->pleft && start <= ar->lleft) {
size -= ar->lleft + 1 - start;
Expand Down
2 changes: 1 addition & 1 deletion include/asm-generic/qspinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static __always_inline int queued_spin_is_locked(struct qspinlock *lock)
*/
static __always_inline int queued_spin_value_unlocked(struct qspinlock lock)
{
return !atomic_read(&lock.val);
return !lock.val.counter;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions include/linux/cred.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ extern void groups_sort(struct group_info *);
* same context as task->real_cred.
*/
struct cred {
atomic_t usage;
atomic_long_t usage;
#ifdef CONFIG_DEBUG_CREDENTIALS
atomic_t subscribers; /* number of processes subscribed */
void *put_addr;
Expand Down Expand Up @@ -226,7 +226,7 @@ static inline bool cap_ambient_invariant_ok(const struct cred *cred)
*/
static inline struct cred *get_new_cred(struct cred *cred)
{
atomic_inc(&cred->usage);
atomic_long_inc(&cred->usage);
return cred;
}

Expand Down Expand Up @@ -270,7 +270,7 @@ static inline void put_cred(const struct cred *_cred)

if (cred) {
validate_creds(cred);
if (atomic_dec_and_test(&(cred)->usage))
if (atomic_long_dec_and_test(&(cred)->usage))
__put_cred(cred);
}
}
Expand Down
Loading

0 comments on commit 5050c32

Please sign in to comment.