Merge 4.14.336 into android-4.14-stable
Changes in 4.14.336 nfc: llcp_core: Hold a ref to llcp_local->dev when holding a ref to llcp_local net: sched: em_text: fix possible memory leak in em_text_destroy() net: bcmgenet: Fix FCS generation for fragmented skbuffs i40e: fix use-after-free in i40e_aqc_add_filters() firewire: ohci: suppress unexpected system reboot in AMD Ryzen machines and ASM108x/VT630x PCIe cards mmc: rpmb: fixes pause retune on all RPMB partitions. mmc: core: Cancel delayed work before releasing host Linux 4.14.336 Change-Id: I6c8473724f89a2bd87f6c09daf217ec66cf26b69 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
2
Makefile
2
Makefile
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
VERSION = 4
|
||||
PATCHLEVEL = 14
|
||||
SUBLEVEL = 335
|
||||
SUBLEVEL = 336
|
||||
EXTRAVERSION =
|
||||
NAME = Petit Gorille
|
||||
|
||||
|
||||
@@ -292,6 +292,51 @@ static char ohci_driver_name[] = KBUILD_MODNAME;
|
||||
#define QUIRK_TI_SLLZ059 0x20
|
||||
#define QUIRK_IR_WAKE 0x40
|
||||
|
||||
// On PCI Express Root Complex in any type of AMD Ryzen machine, VIA VT6306/6307/6308 with Asmedia
|
||||
// ASM1083/1085 brings an inconvenience that the read accesses to 'Isochronous Cycle Timer' register
|
||||
// (at offset 0xf0 in PCI I/O space) often causes unexpected system reboot. The mechanism is not
|
||||
// clear, since the read access to the other registers is enough safe; e.g. 'Node ID' register,
|
||||
// while it is probable due to detection of any type of PCIe error.
|
||||
#define QUIRK_REBOOT_BY_CYCLE_TIMER_READ 0x80000000
|
||||
|
||||
#if IS_ENABLED(CONFIG_X86)
|
||||
|
||||
static bool has_reboot_by_cycle_timer_read_quirk(const struct fw_ohci *ohci)
|
||||
{
|
||||
return !!(ohci->quirks & QUIRK_REBOOT_BY_CYCLE_TIMER_READ);
|
||||
}
|
||||
|
||||
#define PCI_DEVICE_ID_ASMEDIA_ASM108X 0x1080
|
||||
|
||||
static bool detect_vt630x_with_asm1083_on_amd_ryzen_machine(const struct pci_dev *pdev)
|
||||
{
|
||||
const struct pci_dev *pcie_to_pci_bridge;
|
||||
|
||||
// Detect any type of AMD Ryzen machine.
|
||||
if (!static_cpu_has(X86_FEATURE_ZEN))
|
||||
return false;
|
||||
|
||||
// Detect VIA VT6306/6307/6308.
|
||||
if (pdev->vendor != PCI_VENDOR_ID_VIA)
|
||||
return false;
|
||||
if (pdev->device != PCI_DEVICE_ID_VIA_VT630X)
|
||||
return false;
|
||||
|
||||
// Detect Asmedia ASM1083/1085.
|
||||
pcie_to_pci_bridge = pdev->bus->self;
|
||||
if (pcie_to_pci_bridge->vendor != PCI_VENDOR_ID_ASMEDIA)
|
||||
return false;
|
||||
if (pcie_to_pci_bridge->device != PCI_DEVICE_ID_ASMEDIA_ASM108X)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
#define has_reboot_by_cycle_timer_read_quirk(ohci) false
|
||||
#define detect_vt630x_with_asm1083_on_amd_ryzen_machine(pdev) false
|
||||
#endif
|
||||
|
||||
/* In case of multiple matches in ohci_quirks[], only the first one is used. */
|
||||
static const struct {
|
||||
unsigned short vendor, device, revision, flags;
|
||||
@@ -1732,6 +1777,9 @@ static u32 get_cycle_time(struct fw_ohci *ohci)
|
||||
s32 diff01, diff12;
|
||||
int i;
|
||||
|
||||
if (has_reboot_by_cycle_timer_read_quirk(ohci))
|
||||
return 0;
|
||||
|
||||
c2 = reg_read(ohci, OHCI1394_IsochronousCycleTimer);
|
||||
|
||||
if (ohci->quirks & QUIRK_CYCLE_TIMER) {
|
||||
@@ -3635,6 +3683,9 @@ static int pci_probe(struct pci_dev *dev,
|
||||
if (param_quirks)
|
||||
ohci->quirks = param_quirks;
|
||||
|
||||
if (detect_vt630x_with_asm1083_on_amd_ryzen_machine(dev))
|
||||
ohci->quirks |= QUIRK_REBOOT_BY_CYCLE_TIMER_READ;
|
||||
|
||||
/*
|
||||
* Because dma_alloc_coherent() allocates at least one page,
|
||||
* we save space by using a common buffer for the AR request/
|
||||
|
||||
@@ -835,9 +835,10 @@ static const struct block_device_operations mmc_bdops = {
|
||||
static int mmc_blk_part_switch_pre(struct mmc_card *card,
|
||||
unsigned int part_type)
|
||||
{
|
||||
const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
|
||||
int ret = 0;
|
||||
|
||||
if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
|
||||
if ((part_type & mask) == mask) {
|
||||
if (card->ext_csd.cmdq_en) {
|
||||
ret = mmc_cmdq_disable(card);
|
||||
if (ret)
|
||||
@@ -852,9 +853,10 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card,
|
||||
static int mmc_blk_part_switch_post(struct mmc_card *card,
|
||||
unsigned int part_type)
|
||||
{
|
||||
const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
|
||||
int ret = 0;
|
||||
|
||||
if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) {
|
||||
if ((part_type & mask) == mask) {
|
||||
mmc_retune_unpause(card->host);
|
||||
if (card->reenable_cmdq && !card->ext_csd.cmdq_en)
|
||||
ret = mmc_cmdq_enable(card);
|
||||
@@ -2932,4 +2934,3 @@ module_exit(mmc_blk_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
|
||||
|
||||
|
||||
@@ -480,6 +480,7 @@ EXPORT_SYMBOL(mmc_remove_host);
|
||||
*/
|
||||
void mmc_free_host(struct mmc_host *host)
|
||||
{
|
||||
cancel_delayed_work_sync(&host->detect);
|
||||
mmc_crypto_free_host(host);
|
||||
mmc_pwrseq_free(host);
|
||||
put_device(&host->class_dev);
|
||||
|
||||
@@ -1625,8 +1625,10 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
/* Note: if we ever change from DMA_TX_APPEND_CRC below we
|
||||
* will need to restore software padding of "runt" packets
|
||||
*/
|
||||
len_stat |= DMA_TX_APPEND_CRC;
|
||||
|
||||
if (!i) {
|
||||
len_stat |= DMA_TX_APPEND_CRC | DMA_SOP;
|
||||
len_stat |= DMA_SOP;
|
||||
if (skb->ip_summed == CHECKSUM_PARTIAL)
|
||||
len_stat |= DMA_TX_DO_CSUM;
|
||||
}
|
||||
|
||||
@@ -117,12 +117,18 @@ static struct workqueue_struct *i40e_wq;
|
||||
static void netdev_hw_addr_refcnt(struct i40e_mac_filter *f,
|
||||
struct net_device *netdev, int delta)
|
||||
{
|
||||
struct netdev_hw_addr_list *ha_list;
|
||||
struct netdev_hw_addr *ha;
|
||||
|
||||
if (!f || !netdev)
|
||||
return;
|
||||
|
||||
netdev_for_each_mc_addr(ha, netdev) {
|
||||
if (is_unicast_ether_addr(f->macaddr) || is_link_local_ether_addr(f->macaddr))
|
||||
ha_list = &netdev->uc;
|
||||
else
|
||||
ha_list = &netdev->mc;
|
||||
|
||||
netdev_hw_addr_list_for_each(ha, ha_list) {
|
||||
if (ether_addr_equal(ha->addr, f->macaddr)) {
|
||||
ha->refcount += delta;
|
||||
if (ha->refcount <= 0)
|
||||
|
||||
@@ -157,6 +157,13 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool device,
|
||||
|
||||
struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local)
|
||||
{
|
||||
/* Since using nfc_llcp_local may result in usage of nfc_dev, whenever
|
||||
* we hold a reference to local, we also need to hold a reference to
|
||||
* the device to avoid UAF.
|
||||
*/
|
||||
if (!nfc_get_device(local->dev->idx))
|
||||
return NULL;
|
||||
|
||||
kref_get(&local->ref);
|
||||
|
||||
return local;
|
||||
@@ -190,10 +197,18 @@ static void local_release(struct kref *ref)
|
||||
|
||||
int nfc_llcp_local_put(struct nfc_llcp_local *local)
|
||||
{
|
||||
struct nfc_dev *dev;
|
||||
int ret;
|
||||
|
||||
if (local == NULL)
|
||||
return 0;
|
||||
|
||||
return kref_put(&local->ref, local_release);
|
||||
dev = local->dev;
|
||||
|
||||
ret = kref_put(&local->ref, local_release);
|
||||
nfc_put_device(dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct nfc_llcp_sock *nfc_llcp_sock_get(struct nfc_llcp_local *local,
|
||||
@@ -959,8 +974,17 @@ static void nfc_llcp_recv_connect(struct nfc_llcp_local *local,
|
||||
}
|
||||
|
||||
new_sock = nfc_llcp_sock(new_sk);
|
||||
new_sock->dev = local->dev;
|
||||
|
||||
new_sock->local = nfc_llcp_local_get(local);
|
||||
if (!new_sock->local) {
|
||||
reason = LLCP_DM_REJ;
|
||||
sock_put(&new_sock->sk);
|
||||
release_sock(&sock->sk);
|
||||
sock_put(&sock->sk);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
new_sock->dev = local->dev;
|
||||
new_sock->rw = sock->rw;
|
||||
new_sock->miux = sock->miux;
|
||||
new_sock->nfc_protocol = sock->nfc_protocol;
|
||||
@@ -1586,7 +1610,16 @@ int nfc_llcp_register_device(struct nfc_dev *ndev)
|
||||
if (local == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
local->dev = ndev;
|
||||
/* As we are going to initialize local's refcount, we need to get the
|
||||
* nfc_dev to avoid UAF, otherwise there is no point in continuing.
|
||||
* See nfc_llcp_local_get().
|
||||
*/
|
||||
local->dev = nfc_get_device(ndev->idx);
|
||||
if (!local->dev) {
|
||||
kfree(local);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
INIT_LIST_HEAD(&local->list);
|
||||
kref_init(&local->ref);
|
||||
mutex_init(&local->sdp_lock);
|
||||
|
||||
@@ -101,8 +101,10 @@ retry:
|
||||
|
||||
static void em_text_destroy(struct tcf_ematch *m)
|
||||
{
|
||||
if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config)
|
||||
if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config) {
|
||||
textsearch_destroy(EM_TEXT_PRIV(m)->config);
|
||||
kfree(EM_TEXT_PRIV(m));
|
||||
}
|
||||
}
|
||||
|
||||
static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)
|
||||
|
||||
Reference in New Issue
Block a user