This is the 5.4.277 stable release
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmZR8vIACgkQONu9yGCS aT4p4BAAh4+a0Jkrf2h0QKSQq+OP4yATIzoGWzNDXrrJC5t9g7clDgGxZCj0vz31 klLc8Jbw0vgjPmzI1w/jfdgw/0o4CMc7K1kvYHa8V0sNxeH6aE0VfETMAhgEDHoX vX6pMoYkLsc5Yd5uKnaL2MXfV0agEuvupJq/C4yY2JOHrPsRnFPpqgqDNIlAZ6a7 7k7QY/CYK7lqVnbFWxdH2wlJKRupAMmx0rdeCIMAN6GTl/ON+pWbPG2PKta25j4F 25M4S25OINX9rPg5b27OMSzwoqgCBDDNjVTUp4w7Kqbpt11D/xylv+DKZxRvwS4y UdMGFoo+sO/8IzROal40rCLaAIXnh1lYpjx/QMw3yNCjWXFgjD2yAzAZroLbWUXg v6px5lOE5U5b0OfjuuK9fTO8WzUESegLyNyE8aEz0ZFeOkXLWGmcLwOMyerl1bdA cLkfTC9rhTj9Q8O7+aBq9jJF5i3POWtV3weJEqJl4+RPSH61J4Ch1hROz+C59pqn mkbcjf4nggVBeK9tSca9LNu54AUIx12q4bmaTb/tauhL673favONReIR1JH+a30P luTuOiYnAGiG9M0/Qoq8BrZ8uF/BqdhLZjM584A3O1e/qAtirhEHvjonozANok7C XmXqq0Gm8u3Q31UnNoFoW8tLzkv5Za6Nto9tc+btc7vhjXYyPKs= =ao+L -----END PGP SIGNATURE----- Merge 5.4.277 into android11-5.4-lts Changes in 5.4.277 pinctrl: core: handle radix_tree_insert() errors in pinctrl_register_one_pin() ext4: fix bug_on in __es_tree_search Revert "selftests: mm: fix map_hugetlb failure on 64K page size systems" Revert "net: bcmgenet: use RGMII loopback for MAC reset" net: bcmgenet: keep MAC in reset until PHY is up net: bcmgenet: synchronize EXT_RGMII_OOB_CTRL access net: bcmgenet: synchronize use of bcmgenet_set_rx_mode() net: bcmgenet: synchronize UMAC_CMD access smb: client: fix potential OOBs in smb2_parse_contexts() firmware: arm_scmi: Harden accesses to the reset domains arm64: dts: qcom: Fix 'interrupt-map' parent address cells btrfs: add missing mutex_unlock in btrfs_relocate_sys_chunks() drm/amdgpu: Fix possible NULL dereference in amdgpu_ras_query_error_status_helper() usb: typec: ucsi: displayport: Fix potential deadlock serial: kgdboc: Fix NMI-safety problems from keyboard reset code docs: kernel_include.py: Cope with docutils 0.21 Linux 5.4.277 Change-Id: I7c64905bd76358d7f6f86f33522fb03811684946 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
commit
4b533a5511
@ -94,7 +94,6 @@ class KernelInclude(Include):
|
||||
# HINT: this is the only line I had to change / commented out:
|
||||
#path = utils.relative_path(None, path)
|
||||
|
||||
path = nodes.reprunicode(path)
|
||||
encoding = self.options.get(
|
||||
'encoding', self.state.document.settings.input_encoding)
|
||||
e_handler=self.state.document.settings.input_encoding_error_handler
|
||||
|
2
Makefile
2
Makefile
@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
VERSION = 5
|
||||
PATCHLEVEL = 4
|
||||
SUBLEVEL = 276
|
||||
SUBLEVEL = 277
|
||||
EXTRAVERSION =
|
||||
NAME = Kleptomaniac Octopus
|
||||
|
||||
|
@ -872,10 +872,10 @@
|
||||
interrupts = <GIC_SPI 405 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-names = "msi";
|
||||
interrupt-map-mask = <0 0 0 0x7>;
|
||||
interrupt-map = <0 0 0 1 &intc 0 135 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<0 0 0 2 &intc 0 136 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<0 0 0 3 &intc 0 138 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<0 0 0 4 &intc 0 139 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-map = <0 0 0 1 &intc 0 0 135 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<0 0 0 2 &intc 0 0 136 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<0 0 0 3 &intc 0 0 138 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<0 0 0 4 &intc 0 0 139 IRQ_TYPE_LEVEL_HIGH>;
|
||||
|
||||
clocks = <&gcc GCC_PCIE_0_PIPE_CLK>,
|
||||
<&gcc GCC_PCIE_0_MSTR_AXI_CLK>,
|
||||
|
@ -135,8 +135,12 @@ static int scmi_domain_reset(const struct scmi_handle *handle, u32 domain,
|
||||
struct scmi_xfer *t;
|
||||
struct scmi_msg_reset_domain_reset *dom;
|
||||
struct scmi_reset_info *pi = handle->reset_priv;
|
||||
struct reset_dom_info *rdom = pi->dom_info + domain;
|
||||
struct reset_dom_info *rdom;
|
||||
|
||||
if (domain >= pi->num_domains)
|
||||
return -EINVAL;
|
||||
|
||||
rdom = pi->dom_info + domain;
|
||||
if (rdom->async_reset)
|
||||
flags |= ASYNCHRONOUS_RESET;
|
||||
|
||||
|
@ -594,6 +594,9 @@ int amdgpu_ras_error_query(struct amdgpu_device *adev,
|
||||
if (!obj)
|
||||
return -EINVAL;
|
||||
|
||||
if (!info || info->head.block == AMDGPU_RAS_BLOCK_COUNT)
|
||||
return -EINVAL;
|
||||
|
||||
switch (info->head.block) {
|
||||
case AMDGPU_RAS_BLOCK__UMC:
|
||||
if (adev->umc.funcs->query_ras_error_count)
|
||||
|
@ -1990,12 +1990,18 @@ static void umac_enable_set(struct bcmgenet_priv *priv, u32 mask, bool enable)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
spin_lock_bh(&priv->reg_lock);
|
||||
reg = bcmgenet_umac_readl(priv, UMAC_CMD);
|
||||
if (reg & CMD_SW_RESET) {
|
||||
spin_unlock_bh(&priv->reg_lock);
|
||||
return;
|
||||
}
|
||||
if (enable)
|
||||
reg |= mask;
|
||||
else
|
||||
reg &= ~mask;
|
||||
bcmgenet_umac_writel(priv, reg, UMAC_CMD);
|
||||
spin_unlock_bh(&priv->reg_lock);
|
||||
|
||||
/* UniMAC stops on a packet boundary, wait for a full-size packet
|
||||
* to be processed
|
||||
@ -2010,11 +2016,11 @@ static void reset_umac(struct bcmgenet_priv *priv)
|
||||
bcmgenet_rbuf_ctrl_set(priv, 0);
|
||||
udelay(10);
|
||||
|
||||
/* disable MAC while updating its registers */
|
||||
bcmgenet_umac_writel(priv, 0, UMAC_CMD);
|
||||
|
||||
/* issue soft reset with (rg)mii loopback to ensure a stable rxclk */
|
||||
bcmgenet_umac_writel(priv, CMD_SW_RESET | CMD_LCL_LOOP_EN, UMAC_CMD);
|
||||
/* issue soft reset and disable MAC while updating its registers */
|
||||
spin_lock_bh(&priv->reg_lock);
|
||||
bcmgenet_umac_writel(priv, CMD_SW_RESET, UMAC_CMD);
|
||||
udelay(2);
|
||||
spin_unlock_bh(&priv->reg_lock);
|
||||
}
|
||||
|
||||
static void bcmgenet_intr_disable(struct bcmgenet_priv *priv)
|
||||
@ -2882,7 +2888,9 @@ static void bcmgenet_netif_start(struct net_device *dev)
|
||||
struct bcmgenet_priv *priv = netdev_priv(dev);
|
||||
|
||||
/* Start the network engine */
|
||||
netif_addr_lock_bh(dev);
|
||||
bcmgenet_set_rx_mode(dev);
|
||||
netif_addr_unlock_bh(dev);
|
||||
bcmgenet_enable_rx_napi(priv);
|
||||
|
||||
umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, true);
|
||||
@ -3146,16 +3154,19 @@ static void bcmgenet_set_rx_mode(struct net_device *dev)
|
||||
* 3. The number of filters needed exceeds the number filters
|
||||
* supported by the hardware.
|
||||
*/
|
||||
spin_lock(&priv->reg_lock);
|
||||
reg = bcmgenet_umac_readl(priv, UMAC_CMD);
|
||||
if ((dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) ||
|
||||
(nfilter > MAX_MDF_FILTER)) {
|
||||
reg |= CMD_PROMISC;
|
||||
bcmgenet_umac_writel(priv, reg, UMAC_CMD);
|
||||
spin_unlock(&priv->reg_lock);
|
||||
bcmgenet_umac_writel(priv, 0, UMAC_MDF_CTRL);
|
||||
return;
|
||||
} else {
|
||||
reg &= ~CMD_PROMISC;
|
||||
bcmgenet_umac_writel(priv, reg, UMAC_CMD);
|
||||
spin_unlock(&priv->reg_lock);
|
||||
}
|
||||
|
||||
/* update MDF filter */
|
||||
@ -3513,6 +3524,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
|
||||
goto err;
|
||||
}
|
||||
|
||||
spin_lock_init(&priv->reg_lock);
|
||||
spin_lock_init(&priv->lock);
|
||||
|
||||
SET_NETDEV_DEV(dev, &pdev->dev);
|
||||
|
@ -608,6 +608,8 @@ struct bcmgenet_rx_ring {
|
||||
/* device context */
|
||||
struct bcmgenet_priv {
|
||||
void __iomem *base;
|
||||
/* reg_lock: lock to serialize access to shared registers */
|
||||
spinlock_t reg_lock;
|
||||
enum bcmgenet_version version;
|
||||
struct net_device *dev;
|
||||
|
||||
|
@ -132,10 +132,16 @@ int bcmgenet_wol_power_down_cfg(struct bcmgenet_priv *priv,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* disable RX */
|
||||
/* Can't suspend with WoL if MAC is still in reset */
|
||||
spin_lock_bh(&priv->reg_lock);
|
||||
reg = bcmgenet_umac_readl(priv, UMAC_CMD);
|
||||
if (reg & CMD_SW_RESET)
|
||||
reg &= ~CMD_SW_RESET;
|
||||
|
||||
/* disable RX */
|
||||
reg &= ~CMD_RX_EN;
|
||||
bcmgenet_umac_writel(priv, reg, UMAC_CMD);
|
||||
spin_unlock_bh(&priv->reg_lock);
|
||||
mdelay(10);
|
||||
|
||||
reg = bcmgenet_umac_readl(priv, UMAC_MPD_CTRL);
|
||||
@ -159,6 +165,7 @@ int bcmgenet_wol_power_down_cfg(struct bcmgenet_priv *priv,
|
||||
retries);
|
||||
|
||||
/* Enable CRC forward */
|
||||
spin_lock_bh(&priv->reg_lock);
|
||||
reg = bcmgenet_umac_readl(priv, UMAC_CMD);
|
||||
priv->crc_fwd_en = 1;
|
||||
reg |= CMD_CRC_FWD;
|
||||
@ -166,6 +173,7 @@ int bcmgenet_wol_power_down_cfg(struct bcmgenet_priv *priv,
|
||||
/* Receiver must be enabled for WOL MP detection */
|
||||
reg |= CMD_RX_EN;
|
||||
bcmgenet_umac_writel(priv, reg, UMAC_CMD);
|
||||
spin_unlock_bh(&priv->reg_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -187,8 +195,10 @@ void bcmgenet_wol_power_up_cfg(struct bcmgenet_priv *priv,
|
||||
bcmgenet_umac_writel(priv, reg, UMAC_MPD_CTRL);
|
||||
|
||||
/* Disable CRC Forward */
|
||||
spin_lock_bh(&priv->reg_lock);
|
||||
reg = bcmgenet_umac_readl(priv, UMAC_CMD);
|
||||
reg &= ~CMD_CRC_FWD;
|
||||
bcmgenet_umac_writel(priv, reg, UMAC_CMD);
|
||||
spin_unlock_bh(&priv->reg_lock);
|
||||
priv->crc_fwd_en = 0;
|
||||
}
|
||||
|
@ -91,12 +91,20 @@ void bcmgenet_mii_setup(struct net_device *dev)
|
||||
reg |= RGMII_LINK;
|
||||
bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
|
||||
|
||||
spin_lock_bh(&priv->reg_lock);
|
||||
reg = bcmgenet_umac_readl(priv, UMAC_CMD);
|
||||
reg &= ~((CMD_SPEED_MASK << CMD_SPEED_SHIFT) |
|
||||
CMD_HD_EN |
|
||||
CMD_RX_PAUSE_IGNORE | CMD_TX_PAUSE_IGNORE);
|
||||
reg |= cmd_bits;
|
||||
if (reg & CMD_SW_RESET) {
|
||||
reg &= ~CMD_SW_RESET;
|
||||
bcmgenet_umac_writel(priv, reg, UMAC_CMD);
|
||||
udelay(2);
|
||||
reg |= CMD_TX_EN | CMD_RX_EN;
|
||||
}
|
||||
bcmgenet_umac_writel(priv, reg, UMAC_CMD);
|
||||
spin_unlock_bh(&priv->reg_lock);
|
||||
|
||||
priv->eee.eee_active = phy_init_eee(phydev, 0) >= 0;
|
||||
bcmgenet_eee_enable_set(dev,
|
||||
@ -187,38 +195,8 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
|
||||
const char *phy_name = NULL;
|
||||
u32 id_mode_dis = 0;
|
||||
u32 port_ctrl;
|
||||
int bmcr = -1;
|
||||
int ret;
|
||||
u32 reg;
|
||||
|
||||
/* MAC clocking workaround during reset of umac state machines */
|
||||
reg = bcmgenet_umac_readl(priv, UMAC_CMD);
|
||||
if (reg & CMD_SW_RESET) {
|
||||
/* An MII PHY must be isolated to prevent TXC contention */
|
||||
if (priv->phy_interface == PHY_INTERFACE_MODE_MII) {
|
||||
ret = phy_read(phydev, MII_BMCR);
|
||||
if (ret >= 0) {
|
||||
bmcr = ret;
|
||||
ret = phy_write(phydev, MII_BMCR,
|
||||
bmcr | BMCR_ISOLATE);
|
||||
}
|
||||
if (ret) {
|
||||
netdev_err(dev, "failed to isolate PHY\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
/* Switch MAC clocking to RGMII generated clock */
|
||||
bcmgenet_sys_writel(priv, PORT_MODE_EXT_GPHY, SYS_PORT_CTRL);
|
||||
/* Ensure 5 clks with Rx disabled
|
||||
* followed by 5 clks with Reset asserted
|
||||
*/
|
||||
udelay(4);
|
||||
reg &= ~(CMD_SW_RESET | CMD_LCL_LOOP_EN);
|
||||
bcmgenet_umac_writel(priv, reg, UMAC_CMD);
|
||||
/* Ensure 5 more clocks before Rx is enabled */
|
||||
udelay(2);
|
||||
}
|
||||
|
||||
priv->ext_phy = !priv->internal_phy &&
|
||||
(priv->phy_interface != PHY_INTERFACE_MODE_MOCA);
|
||||
|
||||
@ -250,9 +228,6 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
|
||||
phy_set_max_speed(phydev, SPEED_100);
|
||||
bcmgenet_sys_writel(priv,
|
||||
PORT_MODE_EXT_EPHY, SYS_PORT_CTRL);
|
||||
/* Restore the MII PHY after isolation */
|
||||
if (bmcr >= 0)
|
||||
phy_write(phydev, MII_BMCR, bmcr);
|
||||
break;
|
||||
|
||||
case PHY_INTERFACE_MODE_REVMII:
|
||||
@ -296,6 +271,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
|
||||
* block for the interface to work
|
||||
*/
|
||||
if (priv->ext_phy) {
|
||||
mutex_lock(&phydev->lock);
|
||||
reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL);
|
||||
reg |= id_mode_dis;
|
||||
if (GENET_IS_V1(priv) || GENET_IS_V2(priv) || GENET_IS_V3(priv))
|
||||
@ -303,6 +279,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
|
||||
else
|
||||
reg |= RGMII_MODE_EN;
|
||||
bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
|
||||
mutex_unlock(&phydev->lock);
|
||||
}
|
||||
|
||||
if (init)
|
||||
|
@ -204,6 +204,7 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
|
||||
const struct pinctrl_pin_desc *pin)
|
||||
{
|
||||
struct pin_desc *pindesc;
|
||||
int error;
|
||||
|
||||
pindesc = pin_desc_get(pctldev, pin->number);
|
||||
if (pindesc) {
|
||||
@ -225,18 +226,25 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
|
||||
} else {
|
||||
pindesc->name = kasprintf(GFP_KERNEL, "PIN%u", pin->number);
|
||||
if (!pindesc->name) {
|
||||
kfree(pindesc);
|
||||
return -ENOMEM;
|
||||
error = -ENOMEM;
|
||||
goto failed;
|
||||
}
|
||||
pindesc->dynamic_name = true;
|
||||
}
|
||||
|
||||
pindesc->drv_data = pin->drv_data;
|
||||
|
||||
radix_tree_insert(&pctldev->pin_desc_tree, pin->number, pindesc);
|
||||
error = radix_tree_insert(&pctldev->pin_desc_tree, pin->number, pindesc);
|
||||
if (error)
|
||||
goto failed;
|
||||
|
||||
pr_debug("registered pin %d (%s) on %s\n",
|
||||
pin->number, pindesc->name, pctldev->desc->name);
|
||||
return 0;
|
||||
|
||||
failed:
|
||||
kfree(pindesc);
|
||||
return error;
|
||||
}
|
||||
|
||||
static int pinctrl_register_pins(struct pinctrl_dev *pctldev,
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <linux/console.h>
|
||||
#include <linux/vt_kern.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/irq_work.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
@ -42,6 +43,25 @@ static int kgdb_tty_line;
|
||||
|
||||
static struct platform_device *kgdboc_pdev;
|
||||
|
||||
/*
|
||||
* When we leave the debug trap handler we need to reset the keyboard status
|
||||
* (since the original keyboard state gets partially clobbered by kdb use of
|
||||
* the keyboard).
|
||||
*
|
||||
* The path to deliver the reset is somewhat circuitous.
|
||||
*
|
||||
* To deliver the reset we register an input handler, reset the keyboard and
|
||||
* then deregister the input handler. However, to get this done right, we do
|
||||
* have to carefully manage the calling context because we can only register
|
||||
* input handlers from task context.
|
||||
*
|
||||
* In particular we need to trigger the action from the debug trap handler with
|
||||
* all its NMI and/or NMI-like oddities. To solve this the kgdboc trap exit code
|
||||
* (the "post_exception" callback) uses irq_work_queue(), which is NMI-safe, to
|
||||
* schedule a callback from a hardirq context. From there we have to defer the
|
||||
* work again, this time using schedule_work(), to get a callback using the
|
||||
* system workqueue, which runs in task context.
|
||||
*/
|
||||
#ifdef CONFIG_KDB_KEYBOARD
|
||||
static int kgdboc_reset_connect(struct input_handler *handler,
|
||||
struct input_dev *dev,
|
||||
@ -93,10 +113,17 @@ static void kgdboc_restore_input_helper(struct work_struct *dummy)
|
||||
|
||||
static DECLARE_WORK(kgdboc_restore_input_work, kgdboc_restore_input_helper);
|
||||
|
||||
static void kgdboc_queue_restore_input_helper(struct irq_work *unused)
|
||||
{
|
||||
schedule_work(&kgdboc_restore_input_work);
|
||||
}
|
||||
|
||||
static DEFINE_IRQ_WORK(kgdboc_restore_input_irq_work, kgdboc_queue_restore_input_helper);
|
||||
|
||||
static void kgdboc_restore_input(void)
|
||||
{
|
||||
if (likely(system_state == SYSTEM_RUNNING))
|
||||
schedule_work(&kgdboc_restore_input_work);
|
||||
irq_work_queue(&kgdboc_restore_input_irq_work);
|
||||
}
|
||||
|
||||
static int kgdboc_register_kbd(char **cptr)
|
||||
@ -127,6 +154,7 @@ static void kgdboc_unregister_kbd(void)
|
||||
i--;
|
||||
}
|
||||
}
|
||||
irq_work_sync(&kgdboc_restore_input_irq_work);
|
||||
flush_work(&kgdboc_restore_input_work);
|
||||
}
|
||||
#else /* ! CONFIG_KDB_KEYBOARD */
|
||||
|
@ -251,8 +251,6 @@ static void ucsi_displayport_work(struct work_struct *work)
|
||||
struct ucsi_dp *dp = container_of(work, struct ucsi_dp, work);
|
||||
int ret;
|
||||
|
||||
mutex_lock(&dp->con->lock);
|
||||
|
||||
ret = typec_altmode_vdm(dp->alt, dp->header,
|
||||
dp->vdo_data, dp->vdo_size);
|
||||
if (ret)
|
||||
@ -261,8 +259,6 @@ static void ucsi_displayport_work(struct work_struct *work)
|
||||
dp->vdo_data = NULL;
|
||||
dp->vdo_size = 0;
|
||||
dp->header = 0;
|
||||
|
||||
mutex_unlock(&dp->con->lock);
|
||||
}
|
||||
|
||||
void ucsi_displayport_remove_partner(struct typec_altmode *alt)
|
||||
|
@ -3277,6 +3277,7 @@ again:
|
||||
* alignment and size).
|
||||
*/
|
||||
ret = -EUCLEAN;
|
||||
mutex_unlock(&fs_info->delete_unused_bgs_mutex);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -787,9 +787,11 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon,
|
||||
/* BB TBD check to see if oplock level check can be removed below */
|
||||
if (o_rsp->OplockLevel == SMB2_OPLOCK_LEVEL_LEASE) {
|
||||
kref_get(&tcon->crfid.refcount);
|
||||
smb2_parse_contexts(server, o_rsp,
|
||||
rc = smb2_parse_contexts(server, rsp_iov,
|
||||
&oparms.fid->epoch,
|
||||
oparms.fid->lease_key, &oplock, NULL);
|
||||
if (rc)
|
||||
goto oshr_exit;
|
||||
} else
|
||||
goto oshr_exit;
|
||||
|
||||
|
@ -1929,48 +1929,73 @@ parse_query_id_ctxt(struct create_context *cc, struct smb2_file_all_info *buf)
|
||||
buf->IndexNumber = pdisk_id->DiskFileId;
|
||||
}
|
||||
|
||||
void
|
||||
smb2_parse_contexts(struct TCP_Server_Info *server,
|
||||
struct smb2_create_rsp *rsp,
|
||||
unsigned int *epoch, char *lease_key, __u8 *oplock,
|
||||
struct smb2_file_all_info *buf)
|
||||
int smb2_parse_contexts(struct TCP_Server_Info *server,
|
||||
struct kvec *rsp_iov,
|
||||
unsigned int *epoch,
|
||||
char *lease_key, __u8 *oplock,
|
||||
struct smb2_file_all_info *buf)
|
||||
{
|
||||
char *data_offset;
|
||||
struct smb2_create_rsp *rsp = rsp_iov->iov_base;
|
||||
struct create_context *cc;
|
||||
unsigned int next;
|
||||
unsigned int remaining;
|
||||
size_t rem, off, len;
|
||||
size_t doff, dlen;
|
||||
size_t noff, nlen;
|
||||
char *name;
|
||||
|
||||
*oplock = 0;
|
||||
data_offset = (char *)rsp + le32_to_cpu(rsp->CreateContextsOffset);
|
||||
remaining = le32_to_cpu(rsp->CreateContextsLength);
|
||||
cc = (struct create_context *)data_offset;
|
||||
|
||||
off = le32_to_cpu(rsp->CreateContextsOffset);
|
||||
rem = le32_to_cpu(rsp->CreateContextsLength);
|
||||
if (check_add_overflow(off, rem, &len) || len > rsp_iov->iov_len)
|
||||
return -EINVAL;
|
||||
cc = (struct create_context *)((u8 *)rsp + off);
|
||||
|
||||
/* Initialize inode number to 0 in case no valid data in qfid context */
|
||||
if (buf)
|
||||
buf->IndexNumber = 0;
|
||||
|
||||
while (remaining >= sizeof(struct create_context)) {
|
||||
name = le16_to_cpu(cc->NameOffset) + (char *)cc;
|
||||
if (le16_to_cpu(cc->NameLength) == 4 &&
|
||||
strncmp(name, SMB2_CREATE_REQUEST_LEASE, 4) == 0)
|
||||
*oplock = server->ops->parse_lease_buf(cc, epoch,
|
||||
lease_key);
|
||||
else if (buf && (le16_to_cpu(cc->NameLength) == 4) &&
|
||||
strncmp(name, SMB2_CREATE_QUERY_ON_DISK_ID, 4) == 0)
|
||||
parse_query_id_ctxt(cc, buf);
|
||||
while (rem >= sizeof(*cc)) {
|
||||
doff = le16_to_cpu(cc->DataOffset);
|
||||
dlen = le32_to_cpu(cc->DataLength);
|
||||
if (check_add_overflow(doff, dlen, &len) || len > rem)
|
||||
return -EINVAL;
|
||||
|
||||
next = le32_to_cpu(cc->Next);
|
||||
if (!next)
|
||||
noff = le16_to_cpu(cc->NameOffset);
|
||||
nlen = le16_to_cpu(cc->NameLength);
|
||||
if (noff + nlen >= doff)
|
||||
return -EINVAL;
|
||||
|
||||
name = (char *)cc + noff;
|
||||
switch (nlen) {
|
||||
case 4:
|
||||
if (!strncmp(name, SMB2_CREATE_REQUEST_LEASE, 4)) {
|
||||
*oplock = server->ops->parse_lease_buf(cc, epoch,
|
||||
lease_key);
|
||||
} else if (buf &&
|
||||
!strncmp(name, SMB2_CREATE_QUERY_ON_DISK_ID, 4)) {
|
||||
parse_query_id_ctxt(cc, buf);
|
||||
}
|
||||
break;
|
||||
remaining -= next;
|
||||
cc = (struct create_context *)((char *)cc + next);
|
||||
default:
|
||||
cifs_dbg(FYI, "%s: unhandled context (nlen=%zu dlen=%zu)\n",
|
||||
__func__, nlen, dlen);
|
||||
if (IS_ENABLED(CONFIG_CIFS_DEBUG2))
|
||||
cifs_dump_mem("context data: ", cc, dlen);
|
||||
break;
|
||||
}
|
||||
|
||||
off = le32_to_cpu(cc->Next);
|
||||
if (!off)
|
||||
break;
|
||||
if (check_sub_overflow(rem, off, &rem))
|
||||
return -EINVAL;
|
||||
cc = (struct create_context *)((u8 *)cc + off);
|
||||
}
|
||||
|
||||
if (rsp->OplockLevel != SMB2_OPLOCK_LEVEL_LEASE)
|
||||
*oplock = rsp->OplockLevel;
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -2680,8 +2705,8 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
|
||||
}
|
||||
|
||||
|
||||
smb2_parse_contexts(server, rsp, &oparms->fid->epoch,
|
||||
oparms->fid->lease_key, oplock, buf);
|
||||
rc = smb2_parse_contexts(server, &rsp_iov, &oparms->fid->epoch,
|
||||
oparms->fid->lease_key, oplock, buf);
|
||||
creat_exit:
|
||||
SMB2_open_free(&rqst);
|
||||
free_rsp_buf(resp_buftype, rsp);
|
||||
|
@ -238,10 +238,12 @@ extern int smb3_validate_negotiate(const unsigned int, struct cifs_tcon *);
|
||||
|
||||
extern enum securityEnum smb2_select_sectype(struct TCP_Server_Info *,
|
||||
enum securityEnum);
|
||||
extern void smb2_parse_contexts(struct TCP_Server_Info *server,
|
||||
struct smb2_create_rsp *rsp,
|
||||
unsigned int *epoch, char *lease_key,
|
||||
__u8 *oplock, struct smb2_file_all_info *buf);
|
||||
int smb2_parse_contexts(struct TCP_Server_Info *server,
|
||||
struct kvec *rsp_iov,
|
||||
unsigned int *epoch,
|
||||
char *lease_key, __u8 *oplock,
|
||||
struct smb2_file_all_info *buf);
|
||||
|
||||
extern int smb3_encryption_required(const struct cifs_tcon *tcon);
|
||||
extern int smb2_validate_iov(unsigned int offset, unsigned int buffer_length,
|
||||
struct kvec *iov, unsigned int min_buf_size);
|
||||
|
@ -409,7 +409,7 @@ static int ext4_valid_extent_entries(struct inode *inode,
|
||||
{
|
||||
unsigned short entries;
|
||||
ext4_lblk_t lblock = 0;
|
||||
ext4_lblk_t prev = 0;
|
||||
ext4_lblk_t cur = 0;
|
||||
|
||||
if (eh->eh_entries == 0)
|
||||
return 1;
|
||||
@ -435,12 +435,12 @@ static int ext4_valid_extent_entries(struct inode *inode,
|
||||
|
||||
/* Check for overlapping extents */
|
||||
lblock = le32_to_cpu(ext->ee_block);
|
||||
if ((lblock <= prev) && prev) {
|
||||
if (lblock < cur) {
|
||||
pblock = ext4_ext_pblock(ext);
|
||||
es->s_last_error_block = cpu_to_le64(pblock);
|
||||
return 0;
|
||||
}
|
||||
prev = lblock + ext4_ext_get_actual_len(ext) - 1;
|
||||
cur = lblock + ext4_ext_get_actual_len(ext);
|
||||
ext++;
|
||||
entries--;
|
||||
}
|
||||
@ -460,13 +460,13 @@ static int ext4_valid_extent_entries(struct inode *inode,
|
||||
|
||||
/* Check for overlapping index extents */
|
||||
lblock = le32_to_cpu(ext_idx->ei_block);
|
||||
if ((lblock <= prev) && prev) {
|
||||
if (lblock < cur) {
|
||||
*pblk = ext4_idx_pblock(ext_idx);
|
||||
return 0;
|
||||
}
|
||||
ext_idx++;
|
||||
entries--;
|
||||
prev = lblock;
|
||||
cur = lblock + 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include "vm_util.h"
|
||||
|
||||
#define LENGTH (256UL*1024*1024)
|
||||
#define PROTECTION (PROT_READ | PROT_WRITE)
|
||||
@ -71,16 +70,10 @@ int main(int argc, char **argv)
|
||||
{
|
||||
void *addr;
|
||||
int ret;
|
||||
size_t hugepage_size;
|
||||
size_t length = LENGTH;
|
||||
int flags = FLAGS;
|
||||
int shift = 0;
|
||||
|
||||
hugepage_size = default_huge_page_size();
|
||||
/* munmap with fail if the length is not page aligned */
|
||||
if (hugepage_size > length)
|
||||
length = hugepage_size;
|
||||
|
||||
if (argc > 1)
|
||||
length = atol(argv[1]) << 20;
|
||||
if (argc > 2) {
|
||||
|
Loading…
Reference in New Issue
Block a user