Merge 4.19.224 into android-4.19-stable
Changes in 4.19.224 HID: asus: Add depends on USB_HID to HID_ASUS Kconfig option tee: handle lookup of shm with reference count 0 Input: i8042 - add deferred probe support Input: i8042 - enable deferred probe quirk for ASUS UM325UA platform/x86: apple-gmux: use resource_size() with res recordmcount.pl: fix typo in s390 mcount regex selinux: initialize proto variable in selinux_ip_postroute_compat() scsi: lpfc: Terminate string in lpfc_debugfs_nvmeio_trc_write() udp: using datalen to cap ipv6 udp max gso segments selftests: Calculate udpgso segment count without header adjustment sctp: use call_rcu to free endpoint net: usb: pegasus: Do not drop long Ethernet frames NFC: st21nfca: Fix memory leak in device probe and remove net/mlx5e: Fix wrong features assignment in case of error selftests/net: udpgso_bench_tx: fix dst ip argument fsl/fman: Fix missing put_device() call in fman_port_probe i2c: validate user data in compat ioctl nfc: uapi: use kernel size_t to fix user-space builds uapi: fix linux/nfc.h userspace compilation errors xhci: Fresco FL1100 controller should not have BROKEN_MSI quirk set. usb: gadget: f_fs: Clear ffs_eventfd in ffs_data_clear. usb: mtu3: set interval of FS intr and isoc endpoint binder: fix async_free_space accounting for empty parcels scsi: vmw_pvscsi: Set residual data length conditionally Input: appletouch - initialize work before device registration Input: spaceball - fix parsing of movement data packets net: fix use-after-free in tw_timer_handler Linux 4.19.224 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I152e5f7136d00c553192c65298371353418eed41
This commit is contained in:
@@ -1448,6 +1448,8 @@
|
||||
architectures force reset to be always executed
|
||||
i8042.unlock [HW] Unlock (ignore) the keylock
|
||||
i8042.kbdreset [HW] Reset device connected to KBD port
|
||||
i8042.probe_defer
|
||||
[HW] Allow deferred probing upon i8042 probe errors
|
||||
|
||||
i810= [HW,DRM]
|
||||
|
||||
|
||||
2
Makefile
2
Makefile
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
VERSION = 4
|
||||
PATCHLEVEL = 19
|
||||
SUBLEVEL = 223
|
||||
SUBLEVEL = 224
|
||||
EXTRAVERSION =
|
||||
NAME = "People's Front"
|
||||
|
||||
|
||||
@@ -670,7 +670,7 @@ static void binder_free_buf_locked(struct binder_alloc *alloc,
|
||||
BUG_ON(buffer->user_data > alloc->buffer + alloc->buffer_size);
|
||||
|
||||
if (buffer->async_transaction) {
|
||||
alloc->free_async_space += size + sizeof(struct binder_buffer);
|
||||
alloc->free_async_space += buffer_size + sizeof(struct binder_buffer);
|
||||
|
||||
binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC_ASYNC,
|
||||
"%d: binder_free_buf size %zd async free %zd\n",
|
||||
|
||||
@@ -148,6 +148,7 @@ config HID_APPLEIR
|
||||
|
||||
config HID_ASUS
|
||||
tristate "Asus"
|
||||
depends on USB_HID
|
||||
depends on LEDS_CLASS
|
||||
---help---
|
||||
Support for Asus notebook built-in keyboard and touchpad via i2c, and
|
||||
|
||||
@@ -544,6 +544,9 @@ static long compat_i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned lo
|
||||
sizeof(rdwr_arg)))
|
||||
return -EFAULT;
|
||||
|
||||
if (!rdwr_arg.msgs || rdwr_arg.nmsgs == 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (rdwr_arg.nmsgs > I2C_RDWR_IOCTL_MAX_MSGS)
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/serio.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#define DRIVER_DESC "SpaceTec SpaceBall 2003/3003/4000 FLX driver"
|
||||
|
||||
@@ -87,9 +88,15 @@ static void spaceball_process_packet(struct spaceball* spaceball)
|
||||
|
||||
case 'D': /* Ball data */
|
||||
if (spaceball->idx != 15) return;
|
||||
for (i = 0; i < 6; i++)
|
||||
/*
|
||||
* Skip first three bytes; read six axes worth of data.
|
||||
* Axis values are signed 16-bit big-endian.
|
||||
*/
|
||||
data += 3;
|
||||
for (i = 0; i < ARRAY_SIZE(spaceball_axes); i++) {
|
||||
input_report_abs(dev, spaceball_axes[i],
|
||||
(__s16)((data[2 * i + 3] << 8) | data[2 * i + 2]));
|
||||
(__s16)get_unaligned_be16(&data[i * 2]));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'K': /* Button data */
|
||||
|
||||
@@ -930,6 +930,8 @@ static int atp_probe(struct usb_interface *iface,
|
||||
set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
|
||||
set_bit(BTN_LEFT, input_dev->keybit);
|
||||
|
||||
INIT_WORK(&dev->work, atp_reinit);
|
||||
|
||||
error = input_register_device(dev->input);
|
||||
if (error)
|
||||
goto err_free_buffer;
|
||||
@@ -937,8 +939,6 @@ static int atp_probe(struct usb_interface *iface,
|
||||
/* save our data pointer in this interface device */
|
||||
usb_set_intfdata(iface, dev);
|
||||
|
||||
INIT_WORK(&dev->work, atp_reinit);
|
||||
|
||||
return 0;
|
||||
|
||||
err_free_buffer:
|
||||
|
||||
@@ -999,6 +999,24 @@ static const struct dmi_system_id __initconst i8042_dmi_kbdreset_table[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
static const struct dmi_system_id i8042_dmi_probe_defer_table[] __initconst = {
|
||||
{
|
||||
/* ASUS ZenBook UX425UA */
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX425UA"),
|
||||
},
|
||||
},
|
||||
{
|
||||
/* ASUS ZenBook UM325UA */
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "ZenBook UX325UA_UM325UA"),
|
||||
},
|
||||
},
|
||||
{ }
|
||||
};
|
||||
|
||||
#endif /* CONFIG_X86 */
|
||||
|
||||
#ifdef CONFIG_PNP
|
||||
@@ -1318,6 +1336,9 @@ static int __init i8042_platform_init(void)
|
||||
if (dmi_check_system(i8042_dmi_kbdreset_table))
|
||||
i8042_kbdreset = true;
|
||||
|
||||
if (dmi_check_system(i8042_dmi_probe_defer_table))
|
||||
i8042_probe_defer = true;
|
||||
|
||||
/*
|
||||
* A20 was already enabled during early kernel init. But some buggy
|
||||
* BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to
|
||||
|
||||
@@ -48,6 +48,10 @@ static bool i8042_unlock;
|
||||
module_param_named(unlock, i8042_unlock, bool, 0);
|
||||
MODULE_PARM_DESC(unlock, "Ignore keyboard lock.");
|
||||
|
||||
static bool i8042_probe_defer;
|
||||
module_param_named(probe_defer, i8042_probe_defer, bool, 0);
|
||||
MODULE_PARM_DESC(probe_defer, "Allow deferred probing.");
|
||||
|
||||
enum i8042_controller_reset_mode {
|
||||
I8042_RESET_NEVER,
|
||||
I8042_RESET_ALWAYS,
|
||||
@@ -702,7 +706,7 @@ static int i8042_set_mux_mode(bool multiplex, unsigned char *mux_version)
|
||||
* LCS/Telegraphics.
|
||||
*/
|
||||
|
||||
static int __init i8042_check_mux(void)
|
||||
static int i8042_check_mux(void)
|
||||
{
|
||||
unsigned char mux_version;
|
||||
|
||||
@@ -731,10 +735,10 @@ static int __init i8042_check_mux(void)
|
||||
/*
|
||||
* The following is used to test AUX IRQ delivery.
|
||||
*/
|
||||
static struct completion i8042_aux_irq_delivered __initdata;
|
||||
static bool i8042_irq_being_tested __initdata;
|
||||
static struct completion i8042_aux_irq_delivered;
|
||||
static bool i8042_irq_being_tested;
|
||||
|
||||
static irqreturn_t __init i8042_aux_test_irq(int irq, void *dev_id)
|
||||
static irqreturn_t i8042_aux_test_irq(int irq, void *dev_id)
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned char str, data;
|
||||
@@ -761,7 +765,7 @@ static irqreturn_t __init i8042_aux_test_irq(int irq, void *dev_id)
|
||||
* verifies success by readinng CTR. Used when testing for presence of AUX
|
||||
* port.
|
||||
*/
|
||||
static int __init i8042_toggle_aux(bool on)
|
||||
static int i8042_toggle_aux(bool on)
|
||||
{
|
||||
unsigned char param;
|
||||
int i;
|
||||
@@ -789,7 +793,7 @@ static int __init i8042_toggle_aux(bool on)
|
||||
* the presence of an AUX interface.
|
||||
*/
|
||||
|
||||
static int __init i8042_check_aux(void)
|
||||
static int i8042_check_aux(void)
|
||||
{
|
||||
int retval = -1;
|
||||
bool irq_registered = false;
|
||||
@@ -996,7 +1000,7 @@ static int i8042_controller_init(void)
|
||||
|
||||
if (i8042_command(&ctr[n++ % 2], I8042_CMD_CTL_RCTR)) {
|
||||
pr_err("Can't read CTR while initializing i8042\n");
|
||||
return -EIO;
|
||||
return i8042_probe_defer ? -EPROBE_DEFER : -EIO;
|
||||
}
|
||||
|
||||
} while (n < 2 || ctr[0] != ctr[1]);
|
||||
@@ -1311,7 +1315,7 @@ static void i8042_shutdown(struct platform_device *dev)
|
||||
i8042_controller_reset(false);
|
||||
}
|
||||
|
||||
static int __init i8042_create_kbd_port(void)
|
||||
static int i8042_create_kbd_port(void)
|
||||
{
|
||||
struct serio *serio;
|
||||
struct i8042_port *port = &i8042_ports[I8042_KBD_PORT_NO];
|
||||
@@ -1339,7 +1343,7 @@ static int __init i8042_create_kbd_port(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init i8042_create_aux_port(int idx)
|
||||
static int i8042_create_aux_port(int idx)
|
||||
{
|
||||
struct serio *serio;
|
||||
int port_no = idx < 0 ? I8042_AUX_PORT_NO : I8042_MUX_PORT_NO + idx;
|
||||
@@ -1376,13 +1380,13 @@ static int __init i8042_create_aux_port(int idx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __init i8042_free_kbd_port(void)
|
||||
static void i8042_free_kbd_port(void)
|
||||
{
|
||||
kfree(i8042_ports[I8042_KBD_PORT_NO].serio);
|
||||
i8042_ports[I8042_KBD_PORT_NO].serio = NULL;
|
||||
}
|
||||
|
||||
static void __init i8042_free_aux_ports(void)
|
||||
static void i8042_free_aux_ports(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1392,7 +1396,7 @@ static void __init i8042_free_aux_ports(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void __init i8042_register_ports(void)
|
||||
static void i8042_register_ports(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1444,7 +1448,7 @@ static void i8042_free_irqs(void)
|
||||
i8042_aux_irq_registered = i8042_kbd_irq_registered = false;
|
||||
}
|
||||
|
||||
static int __init i8042_setup_aux(void)
|
||||
static int i8042_setup_aux(void)
|
||||
{
|
||||
int (*aux_enable)(void);
|
||||
int error;
|
||||
@@ -1486,7 +1490,7 @@ static int __init i8042_setup_aux(void)
|
||||
return error;
|
||||
}
|
||||
|
||||
static int __init i8042_setup_kbd(void)
|
||||
static int i8042_setup_kbd(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
@@ -1536,7 +1540,7 @@ static int i8042_kbd_bind_notifier(struct notifier_block *nb,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init i8042_probe(struct platform_device *dev)
|
||||
static int i8042_probe(struct platform_device *dev)
|
||||
{
|
||||
int error;
|
||||
|
||||
@@ -1601,6 +1605,7 @@ static struct platform_driver i8042_driver = {
|
||||
.pm = &i8042_pm_ops,
|
||||
#endif
|
||||
},
|
||||
.probe = i8042_probe,
|
||||
.remove = i8042_remove,
|
||||
.shutdown = i8042_shutdown,
|
||||
};
|
||||
@@ -1611,7 +1616,6 @@ static struct notifier_block i8042_kbd_bind_notifier_block = {
|
||||
|
||||
static int __init i8042_init(void)
|
||||
{
|
||||
struct platform_device *pdev;
|
||||
int err;
|
||||
|
||||
dbg_init();
|
||||
@@ -1627,17 +1631,29 @@ static int __init i8042_init(void)
|
||||
/* Set this before creating the dev to allow i8042_command to work right away */
|
||||
i8042_present = true;
|
||||
|
||||
pdev = platform_create_bundle(&i8042_driver, i8042_probe, NULL, 0, NULL, 0);
|
||||
if (IS_ERR(pdev)) {
|
||||
err = PTR_ERR(pdev);
|
||||
err = platform_driver_register(&i8042_driver);
|
||||
if (err)
|
||||
goto err_platform_exit;
|
||||
|
||||
i8042_platform_device = platform_device_alloc("i8042", -1);
|
||||
if (!i8042_platform_device) {
|
||||
err = -ENOMEM;
|
||||
goto err_unregister_driver;
|
||||
}
|
||||
|
||||
err = platform_device_add(i8042_platform_device);
|
||||
if (err)
|
||||
goto err_free_device;
|
||||
|
||||
bus_register_notifier(&serio_bus, &i8042_kbd_bind_notifier_block);
|
||||
panic_blink = i8042_panic_blink;
|
||||
|
||||
return 0;
|
||||
|
||||
err_free_device:
|
||||
platform_device_put(i8042_platform_device);
|
||||
err_unregister_driver:
|
||||
platform_driver_unregister(&i8042_driver);
|
||||
err_platform_exit:
|
||||
i8042_platform_exit();
|
||||
return err;
|
||||
|
||||
@@ -1791,7 +1791,7 @@ static int fman_port_probe(struct platform_device *of_dev)
|
||||
fman = dev_get_drvdata(&fm_pdev->dev);
|
||||
if (!fman) {
|
||||
err = -EINVAL;
|
||||
goto return_err;
|
||||
goto put_device;
|
||||
}
|
||||
|
||||
err = of_property_read_u32(port_node, "cell-index", &val);
|
||||
@@ -1799,7 +1799,7 @@ static int fman_port_probe(struct platform_device *of_dev)
|
||||
dev_err(port->dev, "%s: reading cell-index for %pOF failed\n",
|
||||
__func__, port_node);
|
||||
err = -EINVAL;
|
||||
goto return_err;
|
||||
goto put_device;
|
||||
}
|
||||
port_id = (u8)val;
|
||||
port->dts_params.id = port_id;
|
||||
@@ -1833,7 +1833,7 @@ static int fman_port_probe(struct platform_device *of_dev)
|
||||
} else {
|
||||
dev_err(port->dev, "%s: Illegal port type\n", __func__);
|
||||
err = -EINVAL;
|
||||
goto return_err;
|
||||
goto put_device;
|
||||
}
|
||||
|
||||
port->dts_params.type = port_type;
|
||||
@@ -1847,7 +1847,7 @@ static int fman_port_probe(struct platform_device *of_dev)
|
||||
dev_err(port->dev, "%s: incorrect qman-channel-id\n",
|
||||
__func__);
|
||||
err = -EINVAL;
|
||||
goto return_err;
|
||||
goto put_device;
|
||||
}
|
||||
port->dts_params.qman_channel_id = qman_channel_id;
|
||||
}
|
||||
@@ -1857,7 +1857,7 @@ static int fman_port_probe(struct platform_device *of_dev)
|
||||
dev_err(port->dev, "%s: of_address_to_resource() failed\n",
|
||||
__func__);
|
||||
err = -ENOMEM;
|
||||
goto return_err;
|
||||
goto put_device;
|
||||
}
|
||||
|
||||
port->dts_params.fman = fman;
|
||||
@@ -1882,6 +1882,8 @@ static int fman_port_probe(struct platform_device *of_dev)
|
||||
|
||||
return 0;
|
||||
|
||||
put_device:
|
||||
put_device(&fm_pdev->dev);
|
||||
return_err:
|
||||
of_node_put(port_node);
|
||||
free_port:
|
||||
|
||||
@@ -3666,12 +3666,11 @@ static int set_feature_arfs(struct net_device *netdev, bool enable)
|
||||
|
||||
static int mlx5e_handle_feature(struct net_device *netdev,
|
||||
netdev_features_t *features,
|
||||
netdev_features_t wanted_features,
|
||||
netdev_features_t feature,
|
||||
mlx5e_feature_handler feature_handler)
|
||||
{
|
||||
netdev_features_t changes = wanted_features ^ netdev->features;
|
||||
bool enable = !!(wanted_features & feature);
|
||||
netdev_features_t changes = *features ^ netdev->features;
|
||||
bool enable = !!(*features & feature);
|
||||
int err;
|
||||
|
||||
if (!(changes & feature))
|
||||
@@ -3679,23 +3678,23 @@ static int mlx5e_handle_feature(struct net_device *netdev,
|
||||
|
||||
err = feature_handler(netdev, enable);
|
||||
if (err) {
|
||||
MLX5E_SET_FEATURE(features, feature, !enable);
|
||||
netdev_err(netdev, "%s feature %pNF failed, err %d\n",
|
||||
enable ? "Enable" : "Disable", &feature, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
MLX5E_SET_FEATURE(features, feature, enable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mlx5e_set_features(struct net_device *netdev,
|
||||
netdev_features_t features)
|
||||
{
|
||||
netdev_features_t oper_features = netdev->features;
|
||||
netdev_features_t oper_features = features;
|
||||
int err = 0;
|
||||
|
||||
#define MLX5E_HANDLE_FEATURE(feature, handler) \
|
||||
mlx5e_handle_feature(netdev, &oper_features, features, feature, handler)
|
||||
mlx5e_handle_feature(netdev, &oper_features, feature, handler)
|
||||
|
||||
err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO, set_feature_lro);
|
||||
err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER,
|
||||
|
||||
@@ -498,11 +498,11 @@ static void read_bulk_callback(struct urb *urb)
|
||||
goto goon;
|
||||
|
||||
rx_status = buf[count - 2];
|
||||
if (rx_status & 0x1e) {
|
||||
if (rx_status & 0x1c) {
|
||||
netif_dbg(pegasus, rx_err, net,
|
||||
"RX packet error %x\n", rx_status);
|
||||
net->stats.rx_errors++;
|
||||
if (rx_status & 0x06) /* long or runt */
|
||||
if (rx_status & 0x04) /* runt */
|
||||
net->stats.rx_length_errors++;
|
||||
if (rx_status & 0x08)
|
||||
net->stats.rx_crc_errors++;
|
||||
|
||||
@@ -544,7 +544,8 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
|
||||
phy->gpiod_ena = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
|
||||
if (IS_ERR(phy->gpiod_ena)) {
|
||||
nfc_err(dev, "Unable to get ENABLE GPIO\n");
|
||||
return PTR_ERR(phy->gpiod_ena);
|
||||
r = PTR_ERR(phy->gpiod_ena);
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
phy->se_status.is_ese_present =
|
||||
@@ -555,7 +556,7 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
|
||||
r = st21nfca_hci_platform_init(phy);
|
||||
if (r < 0) {
|
||||
nfc_err(&client->dev, "Unable to reboot st21nfca\n");
|
||||
return r;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
r = devm_request_threaded_irq(&client->dev, client->irq, NULL,
|
||||
@@ -564,15 +565,23 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
|
||||
ST21NFCA_HCI_DRIVER_NAME, phy);
|
||||
if (r < 0) {
|
||||
nfc_err(&client->dev, "Unable to register IRQ handler\n");
|
||||
return r;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
return st21nfca_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME,
|
||||
r = st21nfca_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME,
|
||||
ST21NFCA_FRAME_HEADROOM,
|
||||
ST21NFCA_FRAME_TAILROOM,
|
||||
ST21NFCA_HCI_LLC_MAX_PAYLOAD,
|
||||
&phy->hdev,
|
||||
&phy->se_status);
|
||||
if (r)
|
||||
goto out_free;
|
||||
|
||||
return 0;
|
||||
|
||||
out_free:
|
||||
kfree_skb(phy->pending_skb);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int st21nfca_hci_i2c_remove(struct i2c_client *client)
|
||||
@@ -585,6 +594,8 @@ static int st21nfca_hci_i2c_remove(struct i2c_client *client)
|
||||
|
||||
if (phy->powered)
|
||||
st21nfca_hci_i2c_disable(phy);
|
||||
if (phy->pending_skb)
|
||||
kfree_skb(phy->pending_skb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
}
|
||||
|
||||
gmux_data->iostart = res->start;
|
||||
gmux_data->iolen = res->end - res->start;
|
||||
gmux_data->iolen = resource_size(res);
|
||||
|
||||
if (gmux_data->iolen < GMUX_MIN_IO_LEN) {
|
||||
pr_err("gmux I/O region too small (%lu < %u)\n",
|
||||
|
||||
@@ -2267,8 +2267,8 @@ lpfc_debugfs_nvmeio_trc_write(struct file *file, const char __user *buf,
|
||||
char mybuf[64];
|
||||
char *pbuf;
|
||||
|
||||
if (nbytes > 64)
|
||||
nbytes = 64;
|
||||
if (nbytes > 63)
|
||||
nbytes = 63;
|
||||
|
||||
memset(mybuf, 0, sizeof(mybuf));
|
||||
|
||||
|
||||
@@ -578,8 +578,11 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
|
||||
* Commands like INQUIRY may transfer less data than
|
||||
* requested by the initiator via bufflen. Set residual
|
||||
* count to make upper layer aware of the actual amount
|
||||
* of data returned.
|
||||
* of data returned. There are cases when controller
|
||||
* returns zero dataLen with non zero data - do not set
|
||||
* residual count in that case.
|
||||
*/
|
||||
if (e->dataLen && (e->dataLen < scsi_bufflen(cmd)))
|
||||
scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen);
|
||||
cmd->result = (DID_OK << 16);
|
||||
break;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Linaro Limited
|
||||
* Copyright (c) 2015-2017, 2019-2021 Linaro Limited
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
@@ -11,25 +11,17 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
#include <linux/anon_inodes.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/dma-buf.h>
|
||||
#include <linux/fdtable.h>
|
||||
#include <linux/idr.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/tee_drv.h>
|
||||
#include "tee_private.h"
|
||||
|
||||
static void tee_shm_release(struct tee_shm *shm)
|
||||
static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm)
|
||||
{
|
||||
struct tee_device *teedev = shm->teedev;
|
||||
|
||||
mutex_lock(&teedev->mutex);
|
||||
idr_remove(&teedev->idr, shm->id);
|
||||
if (shm->ctx)
|
||||
list_del(&shm->link);
|
||||
mutex_unlock(&teedev->mutex);
|
||||
|
||||
if (shm->flags & TEE_SHM_POOL) {
|
||||
struct tee_shm_pool_mgr *poolm;
|
||||
|
||||
@@ -61,51 +53,6 @@ static void tee_shm_release(struct tee_shm *shm)
|
||||
tee_device_put(teedev);
|
||||
}
|
||||
|
||||
static struct sg_table *tee_shm_op_map_dma_buf(struct dma_buf_attachment
|
||||
*attach, enum dma_data_direction dir)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void tee_shm_op_unmap_dma_buf(struct dma_buf_attachment *attach,
|
||||
struct sg_table *table,
|
||||
enum dma_data_direction dir)
|
||||
{
|
||||
}
|
||||
|
||||
static void tee_shm_op_release(struct dma_buf *dmabuf)
|
||||
{
|
||||
struct tee_shm *shm = dmabuf->priv;
|
||||
|
||||
tee_shm_release(shm);
|
||||
}
|
||||
|
||||
static void *tee_shm_op_map(struct dma_buf *dmabuf, unsigned long pgnum)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int tee_shm_op_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma)
|
||||
{
|
||||
struct tee_shm *shm = dmabuf->priv;
|
||||
size_t size = vma->vm_end - vma->vm_start;
|
||||
|
||||
/* Refuse sharing shared memory provided by application */
|
||||
if (shm->flags & TEE_SHM_REGISTER)
|
||||
return -EINVAL;
|
||||
|
||||
return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT,
|
||||
size, vma->vm_page_prot);
|
||||
}
|
||||
|
||||
static const struct dma_buf_ops tee_shm_dma_buf_ops = {
|
||||
.map_dma_buf = tee_shm_op_map_dma_buf,
|
||||
.unmap_dma_buf = tee_shm_op_unmap_dma_buf,
|
||||
.release = tee_shm_op_release,
|
||||
.map = tee_shm_op_map,
|
||||
.mmap = tee_shm_op_mmap,
|
||||
};
|
||||
|
||||
static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
|
||||
struct tee_device *teedev,
|
||||
size_t size, u32 flags)
|
||||
@@ -146,6 +93,7 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
|
||||
goto err_dev_put;
|
||||
}
|
||||
|
||||
refcount_set(&shm->refcount, 1);
|
||||
shm->flags = flags | TEE_SHM_POOL;
|
||||
shm->teedev = teedev;
|
||||
shm->ctx = ctx;
|
||||
@@ -168,21 +116,6 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
|
||||
goto err_pool_free;
|
||||
}
|
||||
|
||||
if (flags & TEE_SHM_DMA_BUF) {
|
||||
DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
|
||||
|
||||
exp_info.ops = &tee_shm_dma_buf_ops;
|
||||
exp_info.size = shm->size;
|
||||
exp_info.flags = O_RDWR;
|
||||
exp_info.priv = shm;
|
||||
|
||||
shm->dmabuf = dma_buf_export(&exp_info);
|
||||
if (IS_ERR(shm->dmabuf)) {
|
||||
ret = ERR_CAST(shm->dmabuf);
|
||||
goto err_rem;
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx) {
|
||||
teedev_ctx_get(ctx);
|
||||
mutex_lock(&teedev->mutex);
|
||||
@@ -191,10 +124,6 @@ static struct tee_shm *__tee_shm_alloc(struct tee_context *ctx,
|
||||
}
|
||||
|
||||
return shm;
|
||||
err_rem:
|
||||
mutex_lock(&teedev->mutex);
|
||||
idr_remove(&teedev->idr, shm->id);
|
||||
mutex_unlock(&teedev->mutex);
|
||||
err_pool_free:
|
||||
poolm->ops->free(poolm, shm);
|
||||
err_kfree:
|
||||
@@ -259,6 +188,7 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
|
||||
goto err;
|
||||
}
|
||||
|
||||
refcount_set(&shm->refcount, 1);
|
||||
shm->flags = flags | TEE_SHM_REGISTER;
|
||||
shm->teedev = teedev;
|
||||
shm->ctx = ctx;
|
||||
@@ -300,22 +230,6 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (flags & TEE_SHM_DMA_BUF) {
|
||||
DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
|
||||
|
||||
exp_info.ops = &tee_shm_dma_buf_ops;
|
||||
exp_info.size = shm->size;
|
||||
exp_info.flags = O_RDWR;
|
||||
exp_info.priv = shm;
|
||||
|
||||
shm->dmabuf = dma_buf_export(&exp_info);
|
||||
if (IS_ERR(shm->dmabuf)) {
|
||||
ret = ERR_CAST(shm->dmabuf);
|
||||
teedev->desc->ops->shm_unregister(ctx, shm);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
mutex_lock(&teedev->mutex);
|
||||
list_add_tail(&shm->link, &ctx->list_shm);
|
||||
mutex_unlock(&teedev->mutex);
|
||||
@@ -343,6 +257,35 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tee_shm_register);
|
||||
|
||||
static int tee_shm_fop_release(struct inode *inode, struct file *filp)
|
||||
{
|
||||
tee_shm_put(filp->private_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tee_shm_fop_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
{
|
||||
struct tee_shm *shm = filp->private_data;
|
||||
size_t size = vma->vm_end - vma->vm_start;
|
||||
|
||||
/* Refuse sharing shared memory provided by application */
|
||||
if (shm->flags & TEE_SHM_USER_MAPPED)
|
||||
return -EINVAL;
|
||||
|
||||
/* check for overflowing the buffer's size */
|
||||
if (vma->vm_pgoff + vma_pages(vma) > shm->size >> PAGE_SHIFT)
|
||||
return -EINVAL;
|
||||
|
||||
return remap_pfn_range(vma, vma->vm_start, shm->paddr >> PAGE_SHIFT,
|
||||
size, vma->vm_page_prot);
|
||||
}
|
||||
|
||||
static const struct file_operations tee_shm_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.release = tee_shm_fop_release,
|
||||
.mmap = tee_shm_fop_mmap,
|
||||
};
|
||||
|
||||
/**
|
||||
* tee_shm_get_fd() - Increase reference count and return file descriptor
|
||||
* @shm: Shared memory handle
|
||||
@@ -355,10 +298,11 @@ int tee_shm_get_fd(struct tee_shm *shm)
|
||||
if (!(shm->flags & TEE_SHM_DMA_BUF))
|
||||
return -EINVAL;
|
||||
|
||||
get_dma_buf(shm->dmabuf);
|
||||
fd = dma_buf_fd(shm->dmabuf, O_CLOEXEC);
|
||||
/* matched by tee_shm_put() in tee_shm_op_release() */
|
||||
refcount_inc(&shm->refcount);
|
||||
fd = anon_inode_getfd("tee_shm", &tee_shm_fops, shm, O_RDWR);
|
||||
if (fd < 0)
|
||||
dma_buf_put(shm->dmabuf);
|
||||
tee_shm_put(shm);
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -368,17 +312,7 @@ int tee_shm_get_fd(struct tee_shm *shm)
|
||||
*/
|
||||
void tee_shm_free(struct tee_shm *shm)
|
||||
{
|
||||
/*
|
||||
* dma_buf_put() decreases the dmabuf reference counter and will
|
||||
* call tee_shm_release() when the last reference is gone.
|
||||
*
|
||||
* In the case of driver private memory we call tee_shm_release
|
||||
* directly instead as it doesn't have a reference counter.
|
||||
*/
|
||||
if (shm->flags & TEE_SHM_DMA_BUF)
|
||||
dma_buf_put(shm->dmabuf);
|
||||
else
|
||||
tee_shm_release(shm);
|
||||
tee_shm_put(shm);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tee_shm_free);
|
||||
|
||||
@@ -485,10 +419,15 @@ struct tee_shm *tee_shm_get_from_id(struct tee_context *ctx, int id)
|
||||
teedev = ctx->teedev;
|
||||
mutex_lock(&teedev->mutex);
|
||||
shm = idr_find(&teedev->idr, id);
|
||||
/*
|
||||
* If the tee_shm was found in the IDR it must have a refcount
|
||||
* larger than 0 due to the guarantee in tee_shm_put() below. So
|
||||
* it's safe to use refcount_inc().
|
||||
*/
|
||||
if (!shm || shm->ctx != ctx)
|
||||
shm = ERR_PTR(-EINVAL);
|
||||
else if (shm->flags & TEE_SHM_DMA_BUF)
|
||||
get_dma_buf(shm->dmabuf);
|
||||
else
|
||||
refcount_inc(&shm->refcount);
|
||||
mutex_unlock(&teedev->mutex);
|
||||
return shm;
|
||||
}
|
||||
@@ -500,7 +439,25 @@ EXPORT_SYMBOL_GPL(tee_shm_get_from_id);
|
||||
*/
|
||||
void tee_shm_put(struct tee_shm *shm)
|
||||
{
|
||||
if (shm->flags & TEE_SHM_DMA_BUF)
|
||||
dma_buf_put(shm->dmabuf);
|
||||
struct tee_device *teedev = shm->teedev;
|
||||
bool do_release = false;
|
||||
|
||||
mutex_lock(&teedev->mutex);
|
||||
if (refcount_dec_and_test(&shm->refcount)) {
|
||||
/*
|
||||
* refcount has reached 0, we must now remove it from the
|
||||
* IDR before releasing the mutex. This will guarantee that
|
||||
* the refcount_inc() in tee_shm_get_from_id() never starts
|
||||
* from 0.
|
||||
*/
|
||||
idr_remove(&teedev->idr, shm->id);
|
||||
if (shm->ctx)
|
||||
list_del(&shm->link);
|
||||
do_release = true;
|
||||
}
|
||||
mutex_unlock(&teedev->mutex);
|
||||
|
||||
if (do_release)
|
||||
tee_shm_release(teedev, shm);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tee_shm_put);
|
||||
|
||||
@@ -1698,11 +1698,15 @@ static void ffs_data_clear(struct ffs_data *ffs)
|
||||
|
||||
BUG_ON(ffs->gadget);
|
||||
|
||||
if (ffs->epfiles)
|
||||
if (ffs->epfiles) {
|
||||
ffs_epfiles_destroy(ffs->epfiles, ffs->eps_count);
|
||||
ffs->epfiles = NULL;
|
||||
}
|
||||
|
||||
if (ffs->ffs_eventfd)
|
||||
if (ffs->ffs_eventfd) {
|
||||
eventfd_ctx_put(ffs->ffs_eventfd);
|
||||
ffs->ffs_eventfd = NULL;
|
||||
}
|
||||
|
||||
kfree(ffs->raw_descs_data);
|
||||
kfree(ffs->raw_strings);
|
||||
@@ -1715,7 +1719,6 @@ static void ffs_data_reset(struct ffs_data *ffs)
|
||||
|
||||
ffs_data_clear(ffs);
|
||||
|
||||
ffs->epfiles = NULL;
|
||||
ffs->raw_descs_data = NULL;
|
||||
ffs->raw_descs = NULL;
|
||||
ffs->raw_strings = NULL;
|
||||
|
||||
@@ -90,7 +90,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
|
||||
/* Look for vendor-specific quirks */
|
||||
if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
|
||||
(pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK ||
|
||||
pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100 ||
|
||||
pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1400)) {
|
||||
if (pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK &&
|
||||
pdev->revision == 0x0) {
|
||||
@@ -125,6 +124,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
|
||||
pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1009)
|
||||
xhci->quirks |= XHCI_BROKEN_STREAMS;
|
||||
|
||||
if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
|
||||
pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_FL1100)
|
||||
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
|
||||
|
||||
if (pdev->vendor == PCI_VENDOR_ID_NEC)
|
||||
xhci->quirks |= XHCI_NEC_HOST;
|
||||
|
||||
|
||||
@@ -97,6 +97,13 @@ static int mtu3_ep_enable(struct mtu3_ep *mep)
|
||||
interval = clamp_val(interval, 1, 16) - 1;
|
||||
mult = usb_endpoint_maxp_mult(desc) - 1;
|
||||
}
|
||||
break;
|
||||
case USB_SPEED_FULL:
|
||||
if (usb_endpoint_xfer_isoc(desc))
|
||||
interval = clamp_val(desc->bInterval, 1, 16);
|
||||
else if (usb_endpoint_xfer_int(desc))
|
||||
interval = clamp_val(desc->bInterval, 1, 255);
|
||||
|
||||
break;
|
||||
default:
|
||||
break; /*others are ignored */
|
||||
|
||||
@@ -177,7 +177,7 @@ void tee_device_unregister(struct tee_device *teedev);
|
||||
* @offset: offset of buffer in user space
|
||||
* @pages: locked pages from userspace
|
||||
* @num_pages: number of locked pages
|
||||
* @dmabuf: dmabuf used to for exporting to user space
|
||||
* @refcount: reference counter
|
||||
* @flags: defined by TEE_SHM_* in tee_drv.h
|
||||
* @id: unique id of a shared memory object on this device
|
||||
*
|
||||
@@ -194,7 +194,7 @@ struct tee_shm {
|
||||
unsigned int offset;
|
||||
struct page **pages;
|
||||
size_t num_pages;
|
||||
struct dma_buf *dmabuf;
|
||||
refcount_t refcount;
|
||||
u32 flags;
|
||||
int id;
|
||||
};
|
||||
|
||||
@@ -118,6 +118,7 @@ extern struct percpu_counter sctp_sockets_allocated;
|
||||
int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *);
|
||||
struct sk_buff *sctp_skb_recv_datagram(struct sock *, int, int, int *);
|
||||
|
||||
typedef int (*sctp_callback_t)(struct sctp_endpoint *, struct sctp_transport *, void *);
|
||||
void sctp_transport_walk_start(struct rhashtable_iter *iter);
|
||||
void sctp_transport_walk_stop(struct rhashtable_iter *iter);
|
||||
struct sctp_transport *sctp_transport_get_next(struct net *net,
|
||||
@@ -128,8 +129,7 @@ int sctp_transport_lookup_process(int (*cb)(struct sctp_transport *, void *),
|
||||
struct net *net,
|
||||
const union sctp_addr *laddr,
|
||||
const union sctp_addr *paddr, void *p);
|
||||
int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *),
|
||||
int (*cb_done)(struct sctp_transport *, void *),
|
||||
int sctp_transport_traverse_process(sctp_callback_t cb, sctp_callback_t cb_done,
|
||||
struct net *net, int *pos, void *p);
|
||||
int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), void *p);
|
||||
int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc,
|
||||
|
||||
@@ -1348,6 +1348,7 @@ struct sctp_endpoint {
|
||||
|
||||
u32 secid;
|
||||
u32 peer_secid;
|
||||
struct rcu_head rcu;
|
||||
};
|
||||
|
||||
/* Recover the outter endpoint structure. */
|
||||
@@ -1363,7 +1364,7 @@ static inline struct sctp_endpoint *sctp_ep(struct sctp_ep_common *base)
|
||||
struct sctp_endpoint *sctp_endpoint_new(struct sock *, gfp_t);
|
||||
void sctp_endpoint_free(struct sctp_endpoint *);
|
||||
void sctp_endpoint_put(struct sctp_endpoint *);
|
||||
void sctp_endpoint_hold(struct sctp_endpoint *);
|
||||
int sctp_endpoint_hold(struct sctp_endpoint *ep);
|
||||
void sctp_endpoint_add_asoc(struct sctp_endpoint *, struct sctp_association *);
|
||||
struct sctp_association *sctp_endpoint_lookup_assoc(
|
||||
const struct sctp_endpoint *ep,
|
||||
|
||||
@@ -263,7 +263,7 @@ enum nfc_sdp_attr {
|
||||
#define NFC_SE_ENABLED 0x1
|
||||
|
||||
struct sockaddr_nfc {
|
||||
sa_family_t sa_family;
|
||||
__kernel_sa_family_t sa_family;
|
||||
__u32 dev_idx;
|
||||
__u32 target_idx;
|
||||
__u32 nfc_protocol;
|
||||
@@ -271,14 +271,14 @@ struct sockaddr_nfc {
|
||||
|
||||
#define NFC_LLCP_MAX_SERVICE_NAME 63
|
||||
struct sockaddr_nfc_llcp {
|
||||
sa_family_t sa_family;
|
||||
__kernel_sa_family_t sa_family;
|
||||
__u32 dev_idx;
|
||||
__u32 target_idx;
|
||||
__u32 nfc_protocol;
|
||||
__u8 dsap; /* Destination SAP, if known */
|
||||
__u8 ssap; /* Source SAP to be bound to */
|
||||
char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */;
|
||||
size_t service_name_len;
|
||||
__kernel_size_t service_name_len;
|
||||
};
|
||||
|
||||
/* NFC socket protocols */
|
||||
|
||||
@@ -1955,6 +1955,10 @@ static int __init inet_init(void)
|
||||
|
||||
ip_init();
|
||||
|
||||
/* Initialise per-cpu ipv4 mibs */
|
||||
if (init_ipv4_mibs())
|
||||
panic("%s: Cannot init ipv4 mibs\n", __func__);
|
||||
|
||||
/* Setup TCP slab cache for open requests. */
|
||||
tcp_init();
|
||||
|
||||
@@ -1983,12 +1987,6 @@ static int __init inet_init(void)
|
||||
|
||||
if (init_inet_pernet_ops())
|
||||
pr_crit("%s: Cannot init ipv4 inet pernet ops\n", __func__);
|
||||
/*
|
||||
* Initialise per-cpu ipv4 mibs
|
||||
*/
|
||||
|
||||
if (init_ipv4_mibs())
|
||||
pr_crit("%s: Cannot init ipv4 mibs\n", __func__);
|
||||
|
||||
ipv4_proc_init();
|
||||
|
||||
|
||||
@@ -1069,7 +1069,7 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6,
|
||||
kfree_skb(skb);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS) {
|
||||
if (datalen > cork->gso_size * UDP_MAX_SEGMENTS) {
|
||||
kfree_skb(skb);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -307,9 +307,8 @@ static int sctp_tsp_dump_one(struct sctp_transport *tsp, void *p)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int sctp_sock_dump(struct sctp_transport *tsp, void *p)
|
||||
static int sctp_sock_dump(struct sctp_endpoint *ep, struct sctp_transport *tsp, void *p)
|
||||
{
|
||||
struct sctp_endpoint *ep = tsp->asoc->ep;
|
||||
struct sctp_comm_param *commp = p;
|
||||
struct sock *sk = ep->base.sk;
|
||||
struct sk_buff *skb = commp->skb;
|
||||
@@ -319,6 +318,8 @@ static int sctp_sock_dump(struct sctp_transport *tsp, void *p)
|
||||
int err = 0;
|
||||
|
||||
lock_sock(sk);
|
||||
if (ep != tsp->asoc->ep)
|
||||
goto release;
|
||||
list_for_each_entry(assoc, &ep->asocs, asocs) {
|
||||
if (cb->args[4] < cb->args[1])
|
||||
goto next;
|
||||
@@ -361,9 +362,8 @@ static int sctp_sock_dump(struct sctp_transport *tsp, void *p)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int sctp_sock_filter(struct sctp_transport *tsp, void *p)
|
||||
static int sctp_sock_filter(struct sctp_endpoint *ep, struct sctp_transport *tsp, void *p)
|
||||
{
|
||||
struct sctp_endpoint *ep = tsp->asoc->ep;
|
||||
struct sctp_comm_param *commp = p;
|
||||
struct sock *sk = ep->base.sk;
|
||||
const struct inet_diag_req_v2 *r = commp->r;
|
||||
@@ -521,7 +521,7 @@ static void sctp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
|
||||
if (!(idiag_states & ~(TCPF_LISTEN | TCPF_CLOSE)))
|
||||
goto done;
|
||||
|
||||
sctp_for_each_transport(sctp_sock_filter, sctp_sock_dump,
|
||||
sctp_transport_traverse_process(sctp_sock_filter, sctp_sock_dump,
|
||||
net, &pos, &commp);
|
||||
cb->args[2] = pos;
|
||||
|
||||
|
||||
@@ -242,6 +242,18 @@ void sctp_endpoint_free(struct sctp_endpoint *ep)
|
||||
}
|
||||
|
||||
/* Final destructor for endpoint. */
|
||||
static void sctp_endpoint_destroy_rcu(struct rcu_head *head)
|
||||
{
|
||||
struct sctp_endpoint *ep = container_of(head, struct sctp_endpoint, rcu);
|
||||
struct sock *sk = ep->base.sk;
|
||||
|
||||
sctp_sk(sk)->ep = NULL;
|
||||
sock_put(sk);
|
||||
|
||||
kfree(ep);
|
||||
SCTP_DBG_OBJCNT_DEC(ep);
|
||||
}
|
||||
|
||||
static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
|
||||
{
|
||||
struct sock *sk;
|
||||
@@ -275,18 +287,13 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
|
||||
if (sctp_sk(sk)->bind_hash)
|
||||
sctp_put_port(sk);
|
||||
|
||||
sctp_sk(sk)->ep = NULL;
|
||||
/* Give up our hold on the sock */
|
||||
sock_put(sk);
|
||||
|
||||
kfree(ep);
|
||||
SCTP_DBG_OBJCNT_DEC(ep);
|
||||
call_rcu(&ep->rcu, sctp_endpoint_destroy_rcu);
|
||||
}
|
||||
|
||||
/* Hold a reference to an endpoint. */
|
||||
void sctp_endpoint_hold(struct sctp_endpoint *ep)
|
||||
int sctp_endpoint_hold(struct sctp_endpoint *ep)
|
||||
{
|
||||
refcount_inc(&ep->base.refcnt);
|
||||
return refcount_inc_not_zero(&ep->base.refcnt);
|
||||
}
|
||||
|
||||
/* Release a reference to an endpoint and clean up if there are
|
||||
|
||||
@@ -5056,11 +5056,12 @@ int sctp_transport_lookup_process(int (*cb)(struct sctp_transport *, void *),
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sctp_transport_lookup_process);
|
||||
|
||||
int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *),
|
||||
int (*cb_done)(struct sctp_transport *, void *),
|
||||
struct net *net, int *pos, void *p) {
|
||||
int sctp_transport_traverse_process(sctp_callback_t cb, sctp_callback_t cb_done,
|
||||
struct net *net, int *pos, void *p)
|
||||
{
|
||||
struct rhashtable_iter hti;
|
||||
struct sctp_transport *tsp;
|
||||
struct sctp_endpoint *ep;
|
||||
int ret;
|
||||
|
||||
again:
|
||||
@@ -5069,26 +5070,32 @@ int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *),
|
||||
|
||||
tsp = sctp_transport_get_idx(net, &hti, *pos + 1);
|
||||
for (; !IS_ERR_OR_NULL(tsp); tsp = sctp_transport_get_next(net, &hti)) {
|
||||
ret = cb(tsp, p);
|
||||
ep = tsp->asoc->ep;
|
||||
if (sctp_endpoint_hold(ep)) { /* asoc can be peeled off */
|
||||
ret = cb(ep, tsp, p);
|
||||
if (ret)
|
||||
break;
|
||||
sctp_endpoint_put(ep);
|
||||
}
|
||||
(*pos)++;
|
||||
sctp_transport_put(tsp);
|
||||
}
|
||||
sctp_transport_walk_stop(&hti);
|
||||
|
||||
if (ret) {
|
||||
if (cb_done && !cb_done(tsp, p)) {
|
||||
if (cb_done && !cb_done(ep, tsp, p)) {
|
||||
(*pos)++;
|
||||
sctp_endpoint_put(ep);
|
||||
sctp_transport_put(tsp);
|
||||
goto again;
|
||||
}
|
||||
sctp_endpoint_put(ep);
|
||||
sctp_transport_put(tsp);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sctp_for_each_transport);
|
||||
EXPORT_SYMBOL_GPL(sctp_transport_traverse_process);
|
||||
|
||||
/* 7.2.1 Association Status (SCTP_STATUS)
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ if ($arch eq "x86_64") {
|
||||
|
||||
} elsif ($arch eq "s390" && $bits == 64) {
|
||||
if ($cc =~ /-DCC_USING_HOTPATCH/) {
|
||||
$mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*(bcrl\\s*0,|jgnop\\s*)[0-9a-f]+ <([^\+]*)>\$";
|
||||
$mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*(brcl\\s*0,|jgnop\\s*)[0-9a-f]+ <([^\+]*)>\$";
|
||||
$mcount_adjust = 0;
|
||||
} else {
|
||||
$mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_(PC|PLT)32DBL\\s+_mcount\\+0x2\$";
|
||||
|
||||
@@ -5810,7 +5810,7 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb,
|
||||
struct common_audit_data ad;
|
||||
struct lsm_network_audit net = {0,};
|
||||
char *addrp;
|
||||
u8 proto;
|
||||
u8 proto = 0;
|
||||
|
||||
if (sk == NULL)
|
||||
return NF_ACCEPT;
|
||||
|
||||
@@ -157,13 +157,13 @@ struct testcase testcases_v4[] = {
|
||||
},
|
||||
{
|
||||
/* send max number of min sized segments */
|
||||
.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4,
|
||||
.tlen = UDP_MAX_SEGMENTS,
|
||||
.gso_len = 1,
|
||||
.r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4,
|
||||
.r_num_mss = UDP_MAX_SEGMENTS,
|
||||
},
|
||||
{
|
||||
/* send max number + 1 of min sized segments: fail */
|
||||
.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V4 + 1,
|
||||
.tlen = UDP_MAX_SEGMENTS + 1,
|
||||
.gso_len = 1,
|
||||
.tfail = true,
|
||||
},
|
||||
@@ -260,13 +260,13 @@ struct testcase testcases_v6[] = {
|
||||
},
|
||||
{
|
||||
/* send max number of min sized segments */
|
||||
.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6,
|
||||
.tlen = UDP_MAX_SEGMENTS,
|
||||
.gso_len = 1,
|
||||
.r_num_mss = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6,
|
||||
.r_num_mss = UDP_MAX_SEGMENTS,
|
||||
},
|
||||
{
|
||||
/* send max number + 1 of min sized segments: fail */
|
||||
.tlen = UDP_MAX_SEGMENTS - CONST_HDRLEN_V6 + 1,
|
||||
.tlen = UDP_MAX_SEGMENTS + 1,
|
||||
.gso_len = 1,
|
||||
.tfail = true,
|
||||
},
|
||||
|
||||
@@ -247,6 +247,7 @@ static void usage(const char *filepath)
|
||||
|
||||
static void parse_opts(int argc, char **argv)
|
||||
{
|
||||
const char *bind_addr = NULL;
|
||||
int max_len, hdrlen;
|
||||
int c;
|
||||
|
||||
@@ -271,7 +272,7 @@ static void parse_opts(int argc, char **argv)
|
||||
cfg_cpu = strtol(optarg, NULL, 0);
|
||||
break;
|
||||
case 'D':
|
||||
setup_sockaddr(cfg_family, optarg, &cfg_dst_addr);
|
||||
bind_addr = optarg;
|
||||
break;
|
||||
case 'l':
|
||||
cfg_runtime_ms = strtoul(optarg, NULL, 10) * 1000;
|
||||
@@ -300,6 +301,11 @@ static void parse_opts(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (!bind_addr)
|
||||
bind_addr = cfg_family == PF_INET6 ? "::" : "0.0.0.0";
|
||||
|
||||
setup_sockaddr(cfg_family, bind_addr, &cfg_dst_addr);
|
||||
|
||||
if (optind != argc)
|
||||
usage(argv[0]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user