Merge 5.10.63 into android12-5.10-lts

Changes in 5.10.63
	ext4: fix race writing to an inline_data file while its xattrs are changing
	fscrypt: add fscrypt_symlink_getattr() for computing st_size
	ext4: report correct st_size for encrypted symlinks
	f2fs: report correct st_size for encrypted symlinks
	ubifs: report correct st_size for encrypted symlinks
	Revert "ucounts: Increase ucounts reference counter before the security hook"
	Revert "cred: add missing return error code when set_cred_ucounts() failed"
	Revert "Add a reference to ucounts for each cred"
	static_call: Fix unused variable warn w/o MODULE
	xtensa: fix kconfig unmet dependency warning for HAVE_FUTEX_CMPXCHG
	ARM: OMAP1: ams-delta: remove unused function ams_delta_camera_power
	gpu: ipu-v3: Fix i.MX IPU-v3 offset calculations for (semi)planar U/V formats
	reset: reset-zynqmp: Fixed the argument data type
	qed: Fix the VF msix vectors flow
	net: macb: Add a NULL check on desc_ptp
	qede: Fix memset corruption
	perf/x86/intel/pt: Fix mask of num_address_ranges
	ceph: fix possible null-pointer dereference in ceph_mdsmap_decode()
	perf/x86/amd/ibs: Work around erratum #1197
	perf/x86/amd/power: Assign pmu.module
	cryptoloop: add a deprecation warning
	ALSA: hda/realtek: Quirk for HP Spectre x360 14 amp setup
	ALSA: hda/realtek: Workaround for conflicting SSID on ASUS ROG Strix G17
	ALSA: pcm: fix divide error in snd_pcm_lib_ioctl
	serial: 8250: 8250_omap: Fix possible array out of bounds access
	spi: Switch to signed types for *_native_cs SPI controller fields
	new helper: inode_wrong_type()
	fuse: fix illegal access to inode with reused nodeid
	media: stkwebcam: fix memory leak in stk_camera_probe
	Linux 5.10.63

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I5d461fa0b4dd5ba2457663bd20da1001936feaca
This commit is contained in:
Greg Kroah-Hartman
2021-09-08 09:08:09 +02:00
37 changed files with 198 additions and 71 deletions

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
VERSION = 5 VERSION = 5
PATCHLEVEL = 10 PATCHLEVEL = 10
SUBLEVEL = 62 SUBLEVEL = 63
EXTRAVERSION = EXTRAVERSION =
NAME = Dare mighty things NAME = Dare mighty things

View File

@@ -458,20 +458,6 @@ static struct gpiod_lookup_table leds_gpio_table = {
#ifdef CONFIG_LEDS_TRIGGERS #ifdef CONFIG_LEDS_TRIGGERS
DEFINE_LED_TRIGGER(ams_delta_camera_led_trigger); DEFINE_LED_TRIGGER(ams_delta_camera_led_trigger);
static int ams_delta_camera_power(struct device *dev, int power)
{
/*
* turn on camera LED
*/
if (power)
led_trigger_event(ams_delta_camera_led_trigger, LED_FULL);
else
led_trigger_event(ams_delta_camera_led_trigger, LED_OFF);
return 0;
}
#else
#define ams_delta_camera_power NULL
#endif #endif
static struct platform_device ams_delta_audio_device = { static struct platform_device ams_delta_audio_device = {

View File

@@ -90,6 +90,7 @@ struct perf_ibs {
unsigned long offset_mask[1]; unsigned long offset_mask[1];
int offset_max; int offset_max;
unsigned int fetch_count_reset_broken : 1; unsigned int fetch_count_reset_broken : 1;
unsigned int fetch_ignore_if_zero_rip : 1;
struct cpu_perf_ibs __percpu *pcpu; struct cpu_perf_ibs __percpu *pcpu;
struct attribute **format_attrs; struct attribute **format_attrs;
@@ -672,6 +673,10 @@ fail:
if (check_rip && (ibs_data.regs[2] & IBS_RIP_INVALID)) { if (check_rip && (ibs_data.regs[2] & IBS_RIP_INVALID)) {
regs.flags &= ~PERF_EFLAGS_EXACT; regs.flags &= ~PERF_EFLAGS_EXACT;
} else { } else {
/* Workaround for erratum #1197 */
if (perf_ibs->fetch_ignore_if_zero_rip && !(ibs_data.regs[1]))
goto out;
set_linear_ip(&regs, ibs_data.regs[1]); set_linear_ip(&regs, ibs_data.regs[1]);
regs.flags |= PERF_EFLAGS_EXACT; regs.flags |= PERF_EFLAGS_EXACT;
} }
@@ -769,6 +774,9 @@ static __init void perf_event_ibs_init(void)
if (boot_cpu_data.x86 >= 0x16 && boot_cpu_data.x86 <= 0x18) if (boot_cpu_data.x86 >= 0x16 && boot_cpu_data.x86 <= 0x18)
perf_ibs_fetch.fetch_count_reset_broken = 1; perf_ibs_fetch.fetch_count_reset_broken = 1;
if (boot_cpu_data.x86 == 0x19 && boot_cpu_data.x86_model < 0x10)
perf_ibs_fetch.fetch_ignore_if_zero_rip = 1;
perf_ibs_pmu_init(&perf_ibs_fetch, "ibs_fetch"); perf_ibs_pmu_init(&perf_ibs_fetch, "ibs_fetch");
if (ibs_caps & IBS_CAPS_OPCNT) { if (ibs_caps & IBS_CAPS_OPCNT) {

View File

@@ -213,6 +213,7 @@ static struct pmu pmu_class = {
.stop = pmu_event_stop, .stop = pmu_event_stop,
.read = pmu_event_read, .read = pmu_event_read,
.capabilities = PERF_PMU_CAP_NO_EXCLUDE, .capabilities = PERF_PMU_CAP_NO_EXCLUDE,
.module = THIS_MODULE,
}; };
static int power_cpu_exit(unsigned int cpu) static int power_cpu_exit(unsigned int cpu)

View File

@@ -62,7 +62,7 @@ static struct pt_cap_desc {
PT_CAP(single_range_output, 0, CPUID_ECX, BIT(2)), PT_CAP(single_range_output, 0, CPUID_ECX, BIT(2)),
PT_CAP(output_subsys, 0, CPUID_ECX, BIT(3)), PT_CAP(output_subsys, 0, CPUID_ECX, BIT(3)),
PT_CAP(payloads_lip, 0, CPUID_ECX, BIT(31)), PT_CAP(payloads_lip, 0, CPUID_ECX, BIT(31)),
PT_CAP(num_address_ranges, 1, CPUID_EAX, 0x3), PT_CAP(num_address_ranges, 1, CPUID_EAX, 0x7),
PT_CAP(mtc_periods, 1, CPUID_EAX, 0xffff0000), PT_CAP(mtc_periods, 1, CPUID_EAX, 0xffff0000),
PT_CAP(cycle_thresholds, 1, CPUID_EBX, 0xffff), PT_CAP(cycle_thresholds, 1, CPUID_EBX, 0xffff),
PT_CAP(psb_periods, 1, CPUID_EBX, 0xffff0000), PT_CAP(psb_periods, 1, CPUID_EBX, 0xffff0000),

View File

@@ -30,7 +30,7 @@ config XTENSA
select HAVE_DMA_CONTIGUOUS select HAVE_DMA_CONTIGUOUS
select HAVE_EXIT_THREAD select HAVE_EXIT_THREAD
select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_TRACER
select HAVE_FUTEX_CMPXCHG if !MMU select HAVE_FUTEX_CMPXCHG if !MMU && FUTEX
select HAVE_HW_BREAKPOINT if PERF_EVENTS select HAVE_HW_BREAKPOINT if PERF_EVENTS
select HAVE_IRQ_TIME_ACCOUNTING select HAVE_IRQ_TIME_ACCOUNTING
select HAVE_OPROFILE select HAVE_OPROFILE

View File

@@ -230,7 +230,7 @@ config BLK_DEV_LOOP_MIN_COUNT
dynamically allocated with the /dev/loop-control interface. dynamically allocated with the /dev/loop-control interface.
config BLK_DEV_CRYPTOLOOP config BLK_DEV_CRYPTOLOOP
tristate "Cryptoloop Support" tristate "Cryptoloop Support (DEPRECATED)"
select CRYPTO select CRYPTO
select CRYPTO_CBC select CRYPTO_CBC
depends on BLK_DEV_LOOP depends on BLK_DEV_LOOP
@@ -242,7 +242,7 @@ config BLK_DEV_CRYPTOLOOP
WARNING: This device is not safe for journaled file systems like WARNING: This device is not safe for journaled file systems like
ext3 or Reiserfs. Please use the Device Mapper crypto module ext3 or Reiserfs. Please use the Device Mapper crypto module
instead, which can be configured to be on-disk compatible with the instead, which can be configured to be on-disk compatible with the
cryptoloop device. cryptoloop device. cryptoloop support will be removed in Linux 5.16.
source "drivers/block/drbd/Kconfig" source "drivers/block/drbd/Kconfig"

View File

@@ -189,6 +189,8 @@ init_cryptoloop(void)
if (rc) if (rc)
printk(KERN_ERR "cryptoloop: loop_register_transfer failed\n"); printk(KERN_ERR "cryptoloop: loop_register_transfer failed\n");
else
pr_warn("the cryptoloop driver has been deprecated and will be removed in in Linux 5.16\n");
return rc; return rc;
} }

View File

@@ -585,21 +585,21 @@ static const struct ipu_rgb def_bgra_16 = {
.bits_per_pixel = 16, .bits_per_pixel = 16,
}; };
#define Y_OFFSET(pix, x, y) ((x) + pix->width * (y)) #define Y_OFFSET(pix, x, y) ((x) + pix->bytesperline * (y))
#define U_OFFSET(pix, x, y) ((pix->width * pix->height) + \ #define U_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
(pix->width * ((y) / 2) / 2) + (x) / 2) (pix->bytesperline * ((y) / 2) / 2) + (x) / 2)
#define V_OFFSET(pix, x, y) ((pix->width * pix->height) + \ #define V_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
(pix->width * pix->height / 4) + \ (pix->bytesperline * pix->height / 4) + \
(pix->width * ((y) / 2) / 2) + (x) / 2) (pix->bytesperline * ((y) / 2) / 2) + (x) / 2)
#define U2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ #define U2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
(pix->width * (y) / 2) + (x) / 2) (pix->bytesperline * (y) / 2) + (x) / 2)
#define V2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ #define V2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
(pix->width * pix->height / 2) + \ (pix->bytesperline * pix->height / 2) + \
(pix->width * (y) / 2) + (x) / 2) (pix->bytesperline * (y) / 2) + (x) / 2)
#define UV_OFFSET(pix, x, y) ((pix->width * pix->height) + \ #define UV_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
(pix->width * ((y) / 2)) + (x)) (pix->bytesperline * ((y) / 2)) + (x))
#define UV2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ #define UV2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
(pix->width * y) + (x)) (pix->bytesperline * y) + (x))
#define NUM_ALPHA_CHANNELS 7 #define NUM_ALPHA_CHANNELS 7

View File

@@ -1346,7 +1346,7 @@ static int stk_camera_probe(struct usb_interface *interface,
if (!dev->isoc_ep) { if (!dev->isoc_ep) {
pr_err("Could not find isoc-in endpoint\n"); pr_err("Could not find isoc-in endpoint\n");
err = -ENODEV; err = -ENODEV;
goto error; goto error_put;
} }
dev->vsettings.palette = V4L2_PIX_FMT_RGB565; dev->vsettings.palette = V4L2_PIX_FMT_RGB565;
dev->vsettings.mode = MODE_VGA; dev->vsettings.mode = MODE_VGA;
@@ -1359,10 +1359,12 @@ static int stk_camera_probe(struct usb_interface *interface,
err = stk_register_video_device(dev); err = stk_register_video_device(dev);
if (err) if (err)
goto error; goto error_put;
return 0; return 0;
error_put:
usb_put_intf(interface);
error: error:
v4l2_ctrl_handler_free(hdl); v4l2_ctrl_handler_free(hdl);
v4l2_device_unregister(&dev->v4l2_dev); v4l2_device_unregister(&dev->v4l2_dev);

View File

@@ -275,6 +275,12 @@ void gem_ptp_rxstamp(struct macb *bp, struct sk_buff *skb,
if (GEM_BFEXT(DMA_RXVALID, desc->addr)) { if (GEM_BFEXT(DMA_RXVALID, desc->addr)) {
desc_ptp = macb_ptp_desc(bp, desc); desc_ptp = macb_ptp_desc(bp, desc);
/* Unlikely but check */
if (!desc_ptp) {
dev_warn_ratelimited(&bp->pdev->dev,
"Timestamp not supported in BD\n");
return;
}
gem_hw_timestamp(bp, desc_ptp->ts_1, desc_ptp->ts_2, &ts); gem_hw_timestamp(bp, desc_ptp->ts_1, desc_ptp->ts_2, &ts);
memset(shhwtstamps, 0, sizeof(struct skb_shared_hwtstamps)); memset(shhwtstamps, 0, sizeof(struct skb_shared_hwtstamps));
shhwtstamps->hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec); shhwtstamps->hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec);
@@ -307,8 +313,11 @@ int gem_ptp_txstamp(struct macb_queue *queue, struct sk_buff *skb,
if (CIRC_SPACE(head, tail, PTP_TS_BUFFER_SIZE) == 0) if (CIRC_SPACE(head, tail, PTP_TS_BUFFER_SIZE) == 0)
return -ENOMEM; return -ENOMEM;
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
desc_ptp = macb_ptp_desc(queue->bp, desc); desc_ptp = macb_ptp_desc(queue->bp, desc);
/* Unlikely but check */
if (!desc_ptp)
return -EINVAL;
skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
tx_timestamp = &queue->tx_timestamps[head]; tx_timestamp = &queue->tx_timestamps[head];
tx_timestamp->skb = skb; tx_timestamp->skb = skb;
/* ensure ts_1/ts_2 is loaded after ctrl (TX_USED check) */ /* ensure ts_1/ts_2 is loaded after ctrl (TX_USED check) */

View File

@@ -616,7 +616,12 @@ static int qed_enable_msix(struct qed_dev *cdev,
rc = cnt; rc = cnt;
} }
if (rc > 0) { /* For VFs, we should return with an error in case we didn't get the
* exact number of msix vectors as we requested.
* Not doing that will lead to a crash when starting queues for
* this VF.
*/
if ((IS_PF(cdev) && rc > 0) || (IS_VF(cdev) && rc == cnt)) {
/* MSI-x configuration was achieved */ /* MSI-x configuration was achieved */
int_params->out.int_mode = QED_INT_MODE_MSIX; int_params->out.int_mode = QED_INT_MODE_MSIX;
int_params->out.num_vectors = rc; int_params->out.num_vectors = rc;

View File

@@ -1869,6 +1869,7 @@ static void qede_sync_free_irqs(struct qede_dev *edev)
} }
edev->int_info.used_cnt = 0; edev->int_info.used_cnt = 0;
edev->int_info.msix_cnt = 0;
} }
static int qede_req_msix_irqs(struct qede_dev *edev) static int qede_req_msix_irqs(struct qede_dev *edev)
@@ -2409,7 +2410,6 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode,
goto out; goto out;
err4: err4:
qede_sync_free_irqs(edev); qede_sync_free_irqs(edev);
memset(&edev->int_info.msix_cnt, 0, sizeof(struct qed_int_info));
err3: err3:
qede_napi_disable_remove(edev); qede_napi_disable_remove(edev);
err2: err2:

View File

@@ -53,7 +53,8 @@ static int zynqmp_reset_status(struct reset_controller_dev *rcdev,
unsigned long id) unsigned long id)
{ {
struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev); struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev);
int val, err; int err;
u32 val;
err = zynqmp_pm_reset_get_status(priv->data->reset_id + id, &val); err = zynqmp_pm_reset_get_status(priv->data->reset_id + id, &val);
if (err) if (err)

View File

@@ -1211,6 +1211,7 @@ static int omap8250_no_handle_irq(struct uart_port *port)
static const struct soc_device_attribute k3_soc_devices[] = { static const struct soc_device_attribute k3_soc_devices[] = {
{ .family = "AM65X", }, { .family = "AM65X", },
{ .family = "J721E", .revision = "SR1.0" }, { .family = "J721E", .revision = "SR1.0" },
{ /* sentinel */ }
}; };
static struct omap8250_dma_params am654_dma = { static struct omap8250_dma_params am654_dma = {

View File

@@ -398,7 +398,7 @@ static int v9fs_test_inode(struct inode *inode, void *data)
umode = p9mode2unixmode(v9ses, st, &rdev); umode = p9mode2unixmode(v9ses, st, &rdev);
/* don't match inode of different type */ /* don't match inode of different type */
if ((inode->i_mode & S_IFMT) != (umode & S_IFMT)) if (inode_wrong_type(inode, umode))
return 0; return 0;
/* compare qid details */ /* compare qid details */
@@ -1360,7 +1360,7 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode)
* Don't update inode if the file type is different * Don't update inode if the file type is different
*/ */
umode = p9mode2unixmode(v9ses, st, &rdev); umode = p9mode2unixmode(v9ses, st, &rdev);
if ((inode->i_mode & S_IFMT) != (umode & S_IFMT)) if (inode_wrong_type(inode, umode))
goto out; goto out;
/* /*

View File

@@ -59,7 +59,7 @@ static int v9fs_test_inode_dotl(struct inode *inode, void *data)
struct p9_stat_dotl *st = (struct p9_stat_dotl *)data; struct p9_stat_dotl *st = (struct p9_stat_dotl *)data;
/* don't match inode of different type */ /* don't match inode of different type */
if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT)) if (inode_wrong_type(inode, st->st_mode))
return 0; return 0;
if (inode->i_generation != st->st_gen) if (inode->i_generation != st->st_gen)
@@ -933,7 +933,7 @@ int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode)
/* /*
* Don't update inode if the file type is different * Don't update inode if the file type is different
*/ */
if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT)) if (inode_wrong_type(inode, st->st_mode))
goto out; goto out;
/* /*

View File

@@ -393,9 +393,11 @@ void ceph_mdsmap_destroy(struct ceph_mdsmap *m)
{ {
int i; int i;
if (m->m_info) {
for (i = 0; i < m->possible_max_rank; i++) for (i = 0; i < m->possible_max_rank; i++)
kfree(m->m_info[i].export_targets); kfree(m->m_info[i].export_targets);
kfree(m->m_info); kfree(m->m_info);
}
kfree(m->m_data_pg_pools); kfree(m->m_data_pg_pools);
kfree(m); kfree(m);
} }

View File

@@ -425,8 +425,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
} }
/* if filetype is different, return error */ /* if filetype is different, return error */
if (unlikely(((*pinode)->i_mode & S_IFMT) != if (unlikely(inode_wrong_type(*pinode, fattr.cf_mode))) {
(fattr.cf_mode & S_IFMT))) {
CIFS_I(*pinode)->time = 0; /* force reval */ CIFS_I(*pinode)->time = 0; /* force reval */
rc = -ESTALE; rc = -ESTALE;
goto cgiiu_exit; goto cgiiu_exit;
@@ -1243,7 +1242,7 @@ cifs_find_inode(struct inode *inode, void *opaque)
return 0; return 0;
/* don't match inode of different type */ /* don't match inode of different type */
if ((inode->i_mode & S_IFMT) != (fattr->cf_mode & S_IFMT)) if (inode_wrong_type(inode, fattr->cf_mode))
return 0; return 0;
/* if it's not a directory or has no dentries, then flag it */ /* if it's not a directory or has no dentries, then flag it */

View File

@@ -384,3 +384,47 @@ err_kfree:
return ERR_PTR(err); return ERR_PTR(err);
} }
EXPORT_SYMBOL_GPL(fscrypt_get_symlink); EXPORT_SYMBOL_GPL(fscrypt_get_symlink);
/**
* fscrypt_symlink_getattr() - set the correct st_size for encrypted symlinks
* @path: the path for the encrypted symlink being queried
* @stat: the struct being filled with the symlink's attributes
*
* Override st_size of encrypted symlinks to be the length of the decrypted
* symlink target (or the no-key encoded symlink target, if the key is
* unavailable) rather than the length of the encrypted symlink target. This is
* necessary for st_size to match the symlink target that userspace actually
* sees. POSIX requires this, and some userspace programs depend on it.
*
* This requires reading the symlink target from disk if needed, setting up the
* inode's encryption key if possible, and then decrypting or encoding the
* symlink target. This makes lstat() more heavyweight than is normally the
* case. However, decrypted symlink targets will be cached in ->i_link, so
* usually the symlink won't have to be read and decrypted again later if/when
* it is actually followed, readlink() is called, or lstat() is called again.
*
* Return: 0 on success, -errno on failure
*/
int fscrypt_symlink_getattr(const struct path *path, struct kstat *stat)
{
struct dentry *dentry = path->dentry;
struct inode *inode = d_inode(dentry);
const char *link;
DEFINE_DELAYED_CALL(done);
/*
* To get the symlink target that userspace will see (whether it's the
* decrypted target or the no-key encoded target), we can just get it in
* the same way the VFS does during path resolution and readlink().
*/
link = READ_ONCE(inode->i_link);
if (!link) {
link = inode->i_op->get_link(dentry, inode, &done);
if (IS_ERR(link))
return PTR_ERR(link);
}
stat->size = strlen(link);
do_delayed_call(&done);
return 0;
}
EXPORT_SYMBOL_GPL(fscrypt_symlink_getattr);

View File

@@ -764,6 +764,12 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len,
ext4_write_lock_xattr(inode, &no_expand); ext4_write_lock_xattr(inode, &no_expand);
BUG_ON(!ext4_has_inline_data(inode)); BUG_ON(!ext4_has_inline_data(inode));
/*
* ei->i_inline_off may have changed since ext4_write_begin()
* called ext4_try_to_write_inline_data()
*/
(void) ext4_find_inline_data_nolock(inode);
kaddr = kmap_atomic(page); kaddr = kmap_atomic(page);
ext4_write_inline_data(inode, &iloc, kaddr, pos, len); ext4_write_inline_data(inode, &iloc, kaddr, pos, len);
kunmap_atomic(kaddr); kunmap_atomic(kaddr);

View File

@@ -52,10 +52,19 @@ static const char *ext4_encrypted_get_link(struct dentry *dentry,
return paddr; return paddr;
} }
static int ext4_encrypted_symlink_getattr(const struct path *path,
struct kstat *stat, u32 request_mask,
unsigned int query_flags)
{
ext4_getattr(path, stat, request_mask, query_flags);
return fscrypt_symlink_getattr(path, stat);
}
const struct inode_operations ext4_encrypted_symlink_inode_operations = { const struct inode_operations ext4_encrypted_symlink_inode_operations = {
.get_link = ext4_encrypted_get_link, .get_link = ext4_encrypted_get_link,
.setattr = ext4_setattr, .setattr = ext4_setattr,
.getattr = ext4_getattr, .getattr = ext4_encrypted_symlink_getattr,
.listxattr = ext4_listxattr, .listxattr = ext4_listxattr,
}; };

View File

@@ -1311,9 +1311,18 @@ static const char *f2fs_encrypted_get_link(struct dentry *dentry,
return target; return target;
} }
static int f2fs_encrypted_symlink_getattr(const struct path *path,
struct kstat *stat, u32 request_mask,
unsigned int query_flags)
{
f2fs_getattr(path, stat, request_mask, query_flags);
return fscrypt_symlink_getattr(path, stat);
}
const struct inode_operations f2fs_encrypted_symlink_inode_operations = { const struct inode_operations f2fs_encrypted_symlink_inode_operations = {
.get_link = f2fs_encrypted_get_link, .get_link = f2fs_encrypted_get_link,
.getattr = f2fs_getattr, .getattr = f2fs_encrypted_symlink_getattr,
.setattr = f2fs_setattr, .setattr = f2fs_setattr,
.listxattr = f2fs_listxattr, .listxattr = f2fs_listxattr,
}; };

View File

@@ -252,7 +252,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
if (ret == -ENOMEM) if (ret == -ENOMEM)
goto out; goto out;
if (ret || fuse_invalid_attr(&outarg.attr) || if (ret || fuse_invalid_attr(&outarg.attr) ||
(outarg.attr.mode ^ inode->i_mode) & S_IFMT) fuse_stale_inode(inode, outarg.generation, &outarg.attr))
goto invalid; goto invalid;
forget_all_cached_acls(inode); forget_all_cached_acls(inode);
@@ -1104,7 +1104,7 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat,
err = fuse_simple_request(fm, &args); err = fuse_simple_request(fm, &args);
if (!err) { if (!err) {
if (fuse_invalid_attr(&outarg.attr) || if (fuse_invalid_attr(&outarg.attr) ||
(inode->i_mode ^ outarg.attr.mode) & S_IFMT) { inode_wrong_type(inode, outarg.attr.mode)) {
fuse_make_bad(inode); fuse_make_bad(inode);
err = -EIO; err = -EIO;
} else { } else {
@@ -1741,7 +1741,7 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr,
} }
if (fuse_invalid_attr(&outarg.attr) || if (fuse_invalid_attr(&outarg.attr) ||
(inode->i_mode ^ outarg.attr.mode) & S_IFMT) { inode_wrong_type(inode, outarg.attr.mode)) {
fuse_make_bad(inode); fuse_make_bad(inode);
err = -EIO; err = -EIO;
goto error; goto error;

View File

@@ -884,6 +884,13 @@ static inline u64 fuse_get_attr_version(struct fuse_conn *fc)
return atomic64_read(&fc->attr_version); return atomic64_read(&fc->attr_version);
} }
static inline bool fuse_stale_inode(const struct inode *inode, int generation,
struct fuse_attr *attr)
{
return inode->i_generation != generation ||
inode_wrong_type(inode, attr->mode);
}
static inline void fuse_make_bad(struct inode *inode) static inline void fuse_make_bad(struct inode *inode)
{ {
remove_inode_hash(inode); remove_inode_hash(inode);

View File

@@ -340,8 +340,8 @@ retry:
inode->i_generation = generation; inode->i_generation = generation;
fuse_init_inode(inode, attr); fuse_init_inode(inode, attr);
unlock_new_inode(inode); unlock_new_inode(inode);
} else if ((inode->i_mode ^ attr->mode) & S_IFMT) { } else if (fuse_stale_inode(inode, generation, attr)) {
/* Inode has changed type, any I/O on the old should fail */ /* nodeid was reused, any I/O on the old inode should fail */
fuse_make_bad(inode); fuse_make_bad(inode);
iput(inode); iput(inode);
goto retry; goto retry;

View File

@@ -200,9 +200,12 @@ retry:
if (!d_in_lookup(dentry)) { if (!d_in_lookup(dentry)) {
struct fuse_inode *fi; struct fuse_inode *fi;
inode = d_inode(dentry); inode = d_inode(dentry);
if (inode && get_node_id(inode) != o->nodeid)
inode = NULL;
if (!inode || if (!inode ||
get_node_id(inode) != o->nodeid || fuse_stale_inode(inode, o->generation, &o->attr)) {
((o->attr.mode ^ inode->i_mode) & S_IFMT)) { if (inode)
fuse_make_bad(inode);
d_invalidate(dentry); d_invalidate(dentry);
dput(dentry); dput(dentry);
goto retry; goto retry;

View File

@@ -322,7 +322,7 @@ nfs_find_actor(struct inode *inode, void *opaque)
if (NFS_FILEID(inode) != fattr->fileid) if (NFS_FILEID(inode) != fattr->fileid)
return 0; return 0;
if ((S_IFMT & inode->i_mode) != (S_IFMT & fattr->mode)) if (inode_wrong_type(inode, fattr->mode))
return 0; return 0;
if (nfs_compare_fh(NFS_FH(inode), fh)) if (nfs_compare_fh(NFS_FH(inode), fh))
return 0; return 0;
@@ -1446,7 +1446,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat
return 0; return 0;
return -ESTALE; return -ESTALE;
} }
if ((fattr->valid & NFS_ATTR_FATTR_TYPE) && (inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT)) if ((fattr->valid & NFS_ATTR_FATTR_TYPE) && inode_wrong_type(inode, fattr->mode))
return -ESTALE; return -ESTALE;
@@ -1861,7 +1861,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
/* /*
* Make sure the inode's type hasn't changed. * Make sure the inode's type hasn't changed.
*/ */
if ((fattr->valid & NFS_ATTR_FATTR_TYPE) && (inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT)) { if ((fattr->valid & NFS_ATTR_FATTR_TYPE) && inode_wrong_type(inode, fattr->mode)) {
/* /*
* Big trouble! The inode has become a different object. * Big trouble! The inode has become a different object.
*/ */

View File

@@ -376,7 +376,7 @@ nfsd_proc_create(struct svc_rqst *rqstp)
/* Make sure the type and device matches */ /* Make sure the type and device matches */
resp->status = nfserr_exist; resp->status = nfserr_exist;
if (inode && type != (inode->i_mode & S_IFMT)) if (inode && inode_wrong_type(inode, type))
goto out_unlock; goto out_unlock;
} }

View File

@@ -367,7 +367,7 @@ int ovl_check_origin_fh(struct ovl_fs *ofs, struct ovl_fh *fh, bool connected,
return PTR_ERR(origin); return PTR_ERR(origin);
if (upperdentry && !ovl_is_whiteout(upperdentry) && if (upperdentry && !ovl_is_whiteout(upperdentry) &&
((d_inode(origin)->i_mode ^ d_inode(upperdentry)->i_mode) & S_IFMT)) inode_wrong_type(d_inode(upperdentry), d_inode(origin)->i_mode))
goto invalid; goto invalid;
if (!*stackp) if (!*stackp)
@@ -725,7 +725,7 @@ struct dentry *ovl_lookup_index(struct ovl_fs *ofs, struct dentry *upper,
index = ERR_PTR(-ESTALE); index = ERR_PTR(-ESTALE);
goto out; goto out;
} else if (ovl_dentry_weird(index) || ovl_is_whiteout(index) || } else if (ovl_dentry_weird(index) || ovl_is_whiteout(index) ||
((inode->i_mode ^ d_inode(origin)->i_mode) & S_IFMT)) { inode_wrong_type(inode, d_inode(origin)->i_mode)) {
/* /*
* Index should always be of the same file type as origin * Index should always be of the same file type as origin
* except for the case of a whiteout index. A whiteout * except for the case of a whiteout index. A whiteout

View File

@@ -1629,6 +1629,16 @@ static const char *ubifs_get_link(struct dentry *dentry,
return fscrypt_get_symlink(inode, ui->data, ui->data_len, done); return fscrypt_get_symlink(inode, ui->data, ui->data_len, done);
} }
static int ubifs_symlink_getattr(const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int query_flags)
{
ubifs_getattr(path, stat, request_mask, query_flags);
if (IS_ENCRYPTED(d_inode(path->dentry)))
return fscrypt_symlink_getattr(path, stat);
return 0;
}
const struct address_space_operations ubifs_file_address_operations = { const struct address_space_operations ubifs_file_address_operations = {
.readpage = ubifs_readpage, .readpage = ubifs_readpage,
.writepage = ubifs_writepage, .writepage = ubifs_writepage,
@@ -1654,7 +1664,7 @@ const struct inode_operations ubifs_file_inode_operations = {
const struct inode_operations ubifs_symlink_inode_operations = { const struct inode_operations ubifs_symlink_inode_operations = {
.get_link = ubifs_get_link, .get_link = ubifs_get_link,
.setattr = ubifs_setattr, .setattr = ubifs_setattr,
.getattr = ubifs_getattr, .getattr = ubifs_symlink_getattr,
#ifdef CONFIG_UBIFS_FS_XATTR #ifdef CONFIG_UBIFS_FS_XATTR
.listxattr = ubifs_listxattr, .listxattr = ubifs_listxattr,
#endif #endif

View File

@@ -2823,6 +2823,11 @@ static inline bool execute_ok(struct inode *inode)
return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode);
} }
static inline bool inode_wrong_type(const struct inode *inode, umode_t mode)
{
return (inode->i_mode ^ mode) & S_IFMT;
}
static inline void file_start_write(struct file *file) static inline void file_start_write(struct file *file)
{ {
if (!S_ISREG(file_inode(file)->i_mode)) if (!S_ISREG(file_inode(file)->i_mode))

View File

@@ -260,6 +260,7 @@ int __fscrypt_encrypt_symlink(struct inode *inode, const char *target,
const char *fscrypt_get_symlink(struct inode *inode, const void *caddr, const char *fscrypt_get_symlink(struct inode *inode, const void *caddr,
unsigned int max_size, unsigned int max_size,
struct delayed_call *done); struct delayed_call *done);
int fscrypt_symlink_getattr(const struct path *path, struct kstat *stat);
static inline void fscrypt_set_ops(struct super_block *sb, static inline void fscrypt_set_ops(struct super_block *sb,
const struct fscrypt_operations *s_cop) const struct fscrypt_operations *s_cop)
{ {
@@ -590,6 +591,12 @@ static inline const char *fscrypt_get_symlink(struct inode *inode,
return ERR_PTR(-EOPNOTSUPP); return ERR_PTR(-EOPNOTSUPP);
} }
static inline int fscrypt_symlink_getattr(const struct path *path,
struct kstat *stat)
{
return -EOPNOTSUPP;
}
static inline void fscrypt_set_ops(struct super_block *sb, static inline void fscrypt_set_ops(struct super_block *sb,
const struct fscrypt_operations *s_cop) const struct fscrypt_operations *s_cop)
{ {

View File

@@ -649,8 +649,8 @@ struct spi_controller {
int *cs_gpios; int *cs_gpios;
struct gpio_desc **cs_gpiods; struct gpio_desc **cs_gpiods;
bool use_gpio_descriptors; bool use_gpio_descriptors;
u8 unused_native_cs; s8 unused_native_cs;
u8 max_native_cs; s8 max_native_cs;
/* statistics */ /* statistics */
struct spi_statistics statistics; struct spi_statistics statistics;

View File

@@ -165,13 +165,13 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func)
stop = __stop_static_call_sites; stop = __stop_static_call_sites;
#ifdef CONFIG_MODULES
if (mod) { if (mod) {
#ifdef CONFIG_MODULES
stop = mod->static_call_sites + stop = mod->static_call_sites +
mod->num_static_call_sites; mod->num_static_call_sites;
init = mod->state == MODULE_STATE_COMING; init = mod->state == MODULE_STATE_COMING;
}
#endif #endif
}
for (site = site_mod->sites; for (site = site_mod->sites;
site < stop && static_call_key(site) == key; site++) { site < stop && static_call_key(site) == key; site++) {

View File

@@ -1746,7 +1746,7 @@ static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream,
channels = params_channels(params); channels = params_channels(params);
frame_size = snd_pcm_format_size(format, channels); frame_size = snd_pcm_format_size(format, channels);
if (frame_size > 0) if (frame_size > 0)
params->fifo_size /= (unsigned)frame_size; params->fifo_size /= frame_size;
} }
return 0; return 0;
} }

View File

@@ -8364,6 +8364,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP), SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
@@ -9440,6 +9441,16 @@ static int patch_alc269(struct hda_codec *codec)
snd_hda_pick_fixup(codec, alc269_fixup_models, snd_hda_pick_fixup(codec, alc269_fixup_models,
alc269_fixup_tbl, alc269_fixups); alc269_fixup_tbl, alc269_fixups);
/* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
* the quirk breaks the latter (bko#214101).
* Clear the wrong entry.
*/
if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
codec->core.vendor_id == 0x10ec0294) {
codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
}
snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,