Merge 4.19.309 into android-4.19-stable

Changes in 4.19.309
	netlink: Fix kernel-infoleak-after-free in __skb_datagram_iter
	tun: Fix xdp_rxq_info's queue_index when detaching
	lan78xx: enable auto speed configuration for LAN7850 if no EEPROM is detected
	net: usb: dm9601: fix wrong return value in dm9601_mdio_read
	Bluetooth: Avoid potential use-after-free in hci_error_reset
	Bluetooth: hci_event: Fix handling of HCI_EV_IO_CAPA_REQUEST
	Bluetooth: Enforce validation on max value of connection interval
	efi/capsule-loader: fix incorrect allocation size
	power: supply: bq27xxx-i2c: Do not free non existing IRQ
	ALSA: Drop leftover snd-rtctimer stuff from Makefile
	gtp: fix use-after-free and null-ptr-deref in gtp_newlink()
	wifi: nl80211: reject iftype change with mesh ID change
	btrfs: dev-replace: properly validate device names
	mmc: core: Fix eMMC initialization with 1-bit bus connection
	cachefiles: fix memory leak in cachefiles_add_cache()
	gpio: 74x164: Enable output pins after registers are reset
	Linux 4.19.309

Change-Id: I687e2cd91043b27619f8ad34d193d008dd0d845f
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2024-04-15 15:27:48 +00:00
committed by Treehugger Robot
17 changed files with 64 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
VERSION = 4 VERSION = 4
PATCHLEVEL = 19 PATCHLEVEL = 19
SUBLEVEL = 308 SUBLEVEL = 309
EXTRAVERSION = EXTRAVERSION =
NAME = "People's Front" NAME = "People's Front"

View File

@@ -293,7 +293,7 @@ static int efi_capsule_open(struct inode *inode, struct file *file)
return -ENOMEM; return -ENOMEM;
} }
cap_info->phys = kzalloc(sizeof(void *), GFP_KERNEL); cap_info->phys = kzalloc(sizeof(phys_addr_t), GFP_KERNEL);
if (!cap_info->phys) { if (!cap_info->phys) {
kfree(cap_info->pages); kfree(cap_info->pages);
kfree(cap_info); kfree(cap_info);

View File

@@ -132,8 +132,6 @@ static int gen_74x164_probe(struct spi_device *spi)
if (IS_ERR(chip->gpiod_oe)) if (IS_ERR(chip->gpiod_oe))
return PTR_ERR(chip->gpiod_oe); return PTR_ERR(chip->gpiod_oe);
gpiod_set_value_cansleep(chip->gpiod_oe, 1);
spi_set_drvdata(spi, chip); spi_set_drvdata(spi, chip);
chip->gpio_chip.label = spi->modalias; chip->gpio_chip.label = spi->modalias;
@@ -158,6 +156,8 @@ static int gen_74x164_probe(struct spi_device *spi)
goto exit_destroy; goto exit_destroy;
} }
gpiod_set_value_cansleep(chip->gpiod_oe, 1);
ret = gpiochip_add_data(&chip->gpio_chip, chip); ret = gpiochip_add_data(&chip->gpio_chip, chip);
if (!ret) if (!ret)
return 0; return 0;

View File

@@ -994,10 +994,12 @@ static int mmc_select_bus_width(struct mmc_card *card)
static unsigned ext_csd_bits[] = { static unsigned ext_csd_bits[] = {
EXT_CSD_BUS_WIDTH_8, EXT_CSD_BUS_WIDTH_8,
EXT_CSD_BUS_WIDTH_4, EXT_CSD_BUS_WIDTH_4,
EXT_CSD_BUS_WIDTH_1,
}; };
static unsigned bus_widths[] = { static unsigned bus_widths[] = {
MMC_BUS_WIDTH_8, MMC_BUS_WIDTH_8,
MMC_BUS_WIDTH_4, MMC_BUS_WIDTH_4,
MMC_BUS_WIDTH_1,
}; };
struct mmc_host *host = card->host; struct mmc_host *host = card->host;
unsigned idx, bus_width = 0; unsigned idx, bus_width = 0;

View File

@@ -1381,26 +1381,26 @@ static int __init gtp_init(void)
get_random_bytes(&gtp_h_initval, sizeof(gtp_h_initval)); get_random_bytes(&gtp_h_initval, sizeof(gtp_h_initval));
err = rtnl_link_register(&gtp_link_ops); err = register_pernet_subsys(&gtp_net_ops);
if (err < 0) if (err < 0)
goto error_out; goto error_out;
err = register_pernet_subsys(&gtp_net_ops); err = rtnl_link_register(&gtp_link_ops);
if (err < 0) if (err < 0)
goto unreg_rtnl_link; goto unreg_pernet_subsys;
err = genl_register_family(&gtp_genl_family); err = genl_register_family(&gtp_genl_family);
if (err < 0) if (err < 0)
goto unreg_pernet_subsys; goto unreg_rtnl_link;
pr_info("GTP module loaded (pdp ctx size %zd bytes)\n", pr_info("GTP module loaded (pdp ctx size %zd bytes)\n",
sizeof(struct pdp_ctx)); sizeof(struct pdp_ctx));
return 0; return 0;
unreg_pernet_subsys:
unregister_pernet_subsys(&gtp_net_ops);
unreg_rtnl_link: unreg_rtnl_link:
rtnl_link_unregister(&gtp_link_ops); rtnl_link_unregister(&gtp_link_ops);
unreg_pernet_subsys:
unregister_pernet_subsys(&gtp_net_ops);
error_out: error_out:
pr_err("error loading GTP module loaded\n"); pr_err("error loading GTP module loaded\n");
return err; return err;

View File

@@ -729,6 +729,7 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
tun->tfiles[tun->numqueues - 1]); tun->tfiles[tun->numqueues - 1]);
ntfile = rtnl_dereference(tun->tfiles[index]); ntfile = rtnl_dereference(tun->tfiles[index]);
ntfile->queue_index = index; ntfile->queue_index = index;
ntfile->xdp_rxq.queue_index = index;
rcu_assign_pointer(tun->tfiles[tun->numqueues - 1], rcu_assign_pointer(tun->tfiles[tun->numqueues - 1],
NULL); NULL);

View File

@@ -231,7 +231,7 @@ static int dm9601_mdio_read(struct net_device *netdev, int phy_id, int loc)
err = dm_read_shared_word(dev, 1, loc, &res); err = dm_read_shared_word(dev, 1, loc, &res);
if (err < 0) { if (err < 0) {
netdev_err(dev->net, "MDIO read error: %d\n", err); netdev_err(dev->net, "MDIO read error: %d\n", err);
return err; return 0;
} }
netdev_dbg(dev->net, netdev_dbg(dev->net,

View File

@@ -2581,7 +2581,8 @@ static int lan78xx_reset(struct lan78xx_net *dev)
if (dev->chipid == ID_REV_CHIP_ID_7801_) if (dev->chipid == ID_REV_CHIP_ID_7801_)
buf &= ~MAC_CR_GMII_EN_; buf &= ~MAC_CR_GMII_EN_;
if (dev->chipid == ID_REV_CHIP_ID_7800_) { if (dev->chipid == ID_REV_CHIP_ID_7800_ ||
dev->chipid == ID_REV_CHIP_ID_7850_) {
ret = lan78xx_read_raw_eeprom(dev, 0, 1, &sig); ret = lan78xx_read_raw_eeprom(dev, 0, 1, &sig);
if (!ret && sig != EEPROM_INDICATOR) { if (!ret && sig != EEPROM_INDICATOR) {
/* Implies there is no external eeprom. Set mac speed */ /* Implies there is no external eeprom. Set mac speed */

View File

@@ -217,7 +217,9 @@ static int bq27xxx_battery_i2c_remove(struct i2c_client *client)
{ {
struct bq27xxx_device_info *di = i2c_get_clientdata(client); struct bq27xxx_device_info *di = i2c_get_clientdata(client);
free_irq(client->irq, di); if (client->irq)
free_irq(client->irq, di);
bq27xxx_battery_teardown(di); bq27xxx_battery_teardown(di);
mutex_lock(&battery_mutex); mutex_lock(&battery_mutex);

View File

@@ -535,6 +535,23 @@ int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
return ret; return ret;
} }
static int btrfs_check_replace_dev_names(struct btrfs_ioctl_dev_replace_args *args)
{
if (args->start.srcdevid == 0) {
if (memchr(args->start.srcdev_name, 0,
sizeof(args->start.srcdev_name)) == NULL)
return -ENAMETOOLONG;
} else {
args->start.srcdev_name[0] = 0;
}
if (memchr(args->start.tgtdev_name, 0,
sizeof(args->start.tgtdev_name)) == NULL)
return -ENAMETOOLONG;
return 0;
}
int btrfs_dev_replace_by_ioctl(struct btrfs_fs_info *fs_info, int btrfs_dev_replace_by_ioctl(struct btrfs_fs_info *fs_info,
struct btrfs_ioctl_dev_replace_args *args) struct btrfs_ioctl_dev_replace_args *args)
{ {
@@ -547,10 +564,9 @@ int btrfs_dev_replace_by_ioctl(struct btrfs_fs_info *fs_info,
default: default:
return -EINVAL; return -EINVAL;
} }
ret = btrfs_check_replace_dev_names(args);
if ((args->start.srcdevid == 0 && args->start.srcdev_name[0] == '\0') || if (ret < 0)
args->start.tgtdev_name[0] == '\0') return ret;
return -EINVAL;
ret = btrfs_dev_replace_start(fs_info, args->start.tgtdev_name, ret = btrfs_dev_replace_start(fs_info, args->start.tgtdev_name,
args->start.srcdevid, args->start.srcdevid,

View File

@@ -249,6 +249,8 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache)
kmem_cache_free(cachefiles_object_jar, fsdef); kmem_cache_free(cachefiles_object_jar, fsdef);
error_root_object: error_root_object:
cachefiles_end_secure(cache, saved_cred); cachefiles_end_secure(cache, saved_cred);
put_cred(cache->cache_cred);
cache->cache_cred = NULL;
pr_err("Failed to register: %d\n", ret); pr_err("Failed to register: %d\n", ret);
return ret; return ret;
} }
@@ -269,6 +271,7 @@ void cachefiles_daemon_unbind(struct cachefiles_cache *cache)
dput(cache->graveyard); dput(cache->graveyard);
mntput(cache->mnt); mntput(cache->mnt);
put_cred(cache->cache_cred);
kfree(cache->rootdirname); kfree(cache->rootdirname);
kfree(cache->secctx); kfree(cache->secctx);

View File

@@ -2217,6 +2217,7 @@ static void hci_error_reset(struct work_struct *work)
{ {
struct hci_dev *hdev = container_of(work, struct hci_dev, error_reset); struct hci_dev *hdev = container_of(work, struct hci_dev, error_reset);
hci_dev_hold(hdev);
BT_DBG("%s", hdev->name); BT_DBG("%s", hdev->name);
if (hdev->hw_error) if (hdev->hw_error)
@@ -2224,10 +2225,10 @@ static void hci_error_reset(struct work_struct *work)
else else
bt_dev_err(hdev, "hardware error 0x%2.2x", hdev->hw_error_code); bt_dev_err(hdev, "hardware error 0x%2.2x", hdev->hw_error_code);
if (hci_dev_do_close(hdev)) if (!hci_dev_do_close(hdev))
return; hci_dev_do_open(hdev);
hci_dev_do_open(hdev); hci_dev_put(hdev);
} }
void hci_uuids_clear(struct hci_dev *hdev) void hci_uuids_clear(struct hci_dev *hdev)

View File

@@ -4337,9 +4337,12 @@ static void hci_io_capa_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
hci_dev_lock(hdev); hci_dev_lock(hdev);
conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr);
if (!conn || !hci_conn_ssp_enabled(conn)) if (!conn || !hci_dev_test_flag(hdev, HCI_SSP_ENABLED))
goto unlock; goto unlock;
/* Assume remote supports SSP since it has triggered this event */
set_bit(HCI_CONN_SSP_ENABLED, &conn->flags);
hci_conn_hold(conn); hci_conn_hold(conn);
if (!hci_dev_test_flag(hdev, HCI_MGMT)) if (!hci_dev_test_flag(hdev, HCI_MGMT))
@@ -5638,6 +5641,10 @@ static void hci_le_remote_conn_param_req_evt(struct hci_dev *hdev,
return send_conn_param_neg_reply(hdev, handle, return send_conn_param_neg_reply(hdev, handle,
HCI_ERROR_UNKNOWN_CONN_ID); HCI_ERROR_UNKNOWN_CONN_ID);
if (max > hcon->le_conn_max_interval)
return send_conn_param_neg_reply(hdev, handle,
HCI_ERROR_INVALID_LL_PARAMS);
if (hci_check_conn_params(min, max, latency, timeout)) if (hci_check_conn_params(min, max, latency, timeout))
return send_conn_param_neg_reply(hdev, handle, return send_conn_param_neg_reply(hdev, handle,
HCI_ERROR_INVALID_LL_PARAMS); HCI_ERROR_INVALID_LL_PARAMS);

View File

@@ -5313,7 +5313,13 @@ static inline int l2cap_conn_param_update_req(struct l2cap_conn *conn,
memset(&rsp, 0, sizeof(rsp)); memset(&rsp, 0, sizeof(rsp));
err = hci_check_conn_params(min, max, latency, to_multiplier); if (max > hcon->le_conn_max_interval) {
BT_DBG("requested connection interval exceeds current bounds.");
err = -EINVAL;
} else {
err = hci_check_conn_params(min, max, latency, to_multiplier);
}
if (err) if (err)
rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_REJECTED); rsp.result = cpu_to_le16(L2CAP_CONN_PARAM_REJECTED);
else else

View File

@@ -160,7 +160,7 @@ static inline u32 netlink_group_mask(u32 group)
static struct sk_buff *netlink_to_full_skb(const struct sk_buff *skb, static struct sk_buff *netlink_to_full_skb(const struct sk_buff *skb,
gfp_t gfp_mask) gfp_t gfp_mask)
{ {
unsigned int len = skb_end_offset(skb); unsigned int len = skb->len;
struct sk_buff *new; struct sk_buff *new;
new = alloc_skb(len, gfp_mask); new = alloc_skb(len, gfp_mask);

View File

@@ -3251,6 +3251,8 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
if (ntype != NL80211_IFTYPE_MESH_POINT) if (ntype != NL80211_IFTYPE_MESH_POINT)
return -EINVAL; return -EINVAL;
if (otype != NL80211_IFTYPE_MESH_POINT)
return -EINVAL;
if (netif_running(dev)) if (netif_running(dev))
return -EBUSY; return -EBUSY;

View File

@@ -32,7 +32,6 @@ snd-pcm-dmaengine-objs := pcm_dmaengine.o
snd-rawmidi-objs := rawmidi.o snd-rawmidi-objs := rawmidi.o
snd-timer-objs := timer.o snd-timer-objs := timer.o
snd-hrtimer-objs := hrtimer.o snd-hrtimer-objs := hrtimer.o
snd-rtctimer-objs := rtctimer.o
snd-hwdep-objs := hwdep.o snd-hwdep-objs := hwdep.o
snd-seq-device-objs := seq_device.o snd-seq-device-objs := seq_device.o