Merge b3847b6622 ("iommu/arm-smmu-v3: Clean up more on probe failure") into android14-6.1-lts

Steps on the way to 6.1.129

Change-Id: Ibfe96f79401fb2bf536c39c9a473a784e0543ea2
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2025-03-07 08:55:35 +00:00
45 changed files with 431 additions and 152 deletions

View File

@@ -544,6 +544,18 @@ pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
static int __init hugetlbpage_init(void) static int __init hugetlbpage_init(void)
{ {
/*
* HugeTLB pages are supported on maximum four page table
* levels (PUD, CONT PMD, PMD, CONT PTE) for a given base
* page size, corresponding to hugetlb_add_hstate() calls
* here.
*
* HUGE_MAX_HSTATE should at least match maximum supported
* HugeTLB page sizes on the platform. Any new addition to
* supported HugeTLB page sizes will also require changing
* HUGE_MAX_HSTATE as well.
*/
BUILD_BUG_ON(HUGE_MAX_HSTATE < 4);
if (pud_sect_supported()) if (pud_sect_supported())
hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT); hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);

View File

@@ -21,7 +21,7 @@ KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
ifndef CONFIG_AS_IS_LLVM ifndef CONFIG_AS_IS_LLVM
KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf)) KBUILD_AFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),$(aflags_dwarf))
endif endif
KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack KBUILD_CFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -O2 -mpacked-stack -std=gnu11
KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY KBUILD_CFLAGS_DECOMPRESSOR += -DDISABLE_BRANCH_PROFILING -D__NO_FORTIFY
KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbackchain
KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables

View File

@@ -21,7 +21,7 @@ UBSAN_SANITIZE := n
KASAN_SANITIZE := n KASAN_SANITIZE := n
KCSAN_SANITIZE := n KCSAN_SANITIZE := n
KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes KBUILD_CFLAGS := -std=gnu11 -fno-strict-aliasing -Wall -Wstrict-prototypes
KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common

View File

@@ -16,6 +16,7 @@
# define PAGES_NR 4 # define PAGES_NR 4
#endif #endif
# define KEXEC_CONTROL_PAGE_SIZE 4096
# define KEXEC_CONTROL_CODE_MAX_SIZE 2048 # define KEXEC_CONTROL_CODE_MAX_SIZE 2048
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
@@ -44,7 +45,6 @@ struct kimage;
/* Maximum address we can use for the control code buffer */ /* Maximum address we can use for the control code buffer */
# define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE # define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
# define KEXEC_CONTROL_PAGE_SIZE 4096
/* The native architecture */ /* The native architecture */
# define KEXEC_ARCH KEXEC_ARCH_386 # define KEXEC_ARCH KEXEC_ARCH_386
@@ -59,9 +59,6 @@ struct kimage;
/* Maximum address we can use for the control pages */ /* Maximum address we can use for the control pages */
# define KEXEC_CONTROL_MEMORY_LIMIT (MAXMEM-1) # define KEXEC_CONTROL_MEMORY_LIMIT (MAXMEM-1)
/* Allocate one page for the pdp and the second for the code */
# define KEXEC_CONTROL_PAGE_SIZE (4096UL + 4096UL)
/* The native architecture */ /* The native architecture */
# define KEXEC_ARCH KEXEC_ARCH_X86_64 # define KEXEC_ARCH KEXEC_ARCH_X86_64
#endif #endif
@@ -146,6 +143,19 @@ struct kimage_arch {
}; };
#else #else
struct kimage_arch { struct kimage_arch {
/*
* This is a kimage control page, as it must not overlap with either
* source or destination address ranges.
*/
pgd_t *pgd;
/*
* The virtual mapping of the control code page itself is used only
* during the transition, while the current kernel's pages are all
* in place. Thus the intermediate page table pages used to map it
* are not control pages, but instead just normal pages obtained
* with get_zeroed_page(). And have to be tracked (below) so that
* they can be freed.
*/
p4d_t *p4d; p4d_t *p4d;
pud_t *pud; pud_t *pud;
pmd_t *pmd; pmd_t *pmd;

View File

@@ -519,6 +519,10 @@ static __init void fix_erratum_688(void)
static __init int init_amd_nbs(void) static __init int init_amd_nbs(void)
{ {
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD &&
boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)
return 0;
amd_cache_northbridges(); amd_cache_northbridges();
amd_cache_gart(); amd_cache_gart();

View File

@@ -149,7 +149,8 @@ static void free_transition_pgtable(struct kimage *image)
image->arch.pte = NULL; image->arch.pte = NULL;
} }
static int init_transition_pgtable(struct kimage *image, pgd_t *pgd) static int init_transition_pgtable(struct kimage *image, pgd_t *pgd,
unsigned long control_page)
{ {
pgprot_t prot = PAGE_KERNEL_EXEC_NOENC; pgprot_t prot = PAGE_KERNEL_EXEC_NOENC;
unsigned long vaddr, paddr; unsigned long vaddr, paddr;
@@ -160,7 +161,7 @@ static int init_transition_pgtable(struct kimage *image, pgd_t *pgd)
pte_t *pte; pte_t *pte;
vaddr = (unsigned long)relocate_kernel; vaddr = (unsigned long)relocate_kernel;
paddr = __pa(page_address(image->control_code_page)+PAGE_SIZE); paddr = control_page;
pgd += pgd_index(vaddr); pgd += pgd_index(vaddr);
if (!pgd_present(*pgd)) { if (!pgd_present(*pgd)) {
p4d = (p4d_t *)get_zeroed_page(GFP_KERNEL); p4d = (p4d_t *)get_zeroed_page(GFP_KERNEL);
@@ -219,7 +220,7 @@ static void *alloc_pgt_page(void *data)
return p; return p;
} }
static int init_pgtable(struct kimage *image, unsigned long start_pgtable) static int init_pgtable(struct kimage *image, unsigned long control_page)
{ {
struct x86_mapping_info info = { struct x86_mapping_info info = {
.alloc_pgt_page = alloc_pgt_page, .alloc_pgt_page = alloc_pgt_page,
@@ -228,12 +229,12 @@ static int init_pgtable(struct kimage *image, unsigned long start_pgtable)
.kernpg_flag = _KERNPG_TABLE_NOENC, .kernpg_flag = _KERNPG_TABLE_NOENC,
}; };
unsigned long mstart, mend; unsigned long mstart, mend;
pgd_t *level4p;
int result; int result;
int i; int i;
level4p = (pgd_t *)__va(start_pgtable); image->arch.pgd = alloc_pgt_page(image);
clear_page(level4p); if (!image->arch.pgd)
return -ENOMEM;
if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) { if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) {
info.page_flag |= _PAGE_ENC; info.page_flag |= _PAGE_ENC;
@@ -247,8 +248,8 @@ static int init_pgtable(struct kimage *image, unsigned long start_pgtable)
mstart = pfn_mapped[i].start << PAGE_SHIFT; mstart = pfn_mapped[i].start << PAGE_SHIFT;
mend = pfn_mapped[i].end << PAGE_SHIFT; mend = pfn_mapped[i].end << PAGE_SHIFT;
result = kernel_ident_mapping_init(&info, result = kernel_ident_mapping_init(&info, image->arch.pgd,
level4p, mstart, mend); mstart, mend);
if (result) if (result)
return result; return result;
} }
@@ -263,8 +264,8 @@ static int init_pgtable(struct kimage *image, unsigned long start_pgtable)
mstart = image->segment[i].mem; mstart = image->segment[i].mem;
mend = mstart + image->segment[i].memsz; mend = mstart + image->segment[i].memsz;
result = kernel_ident_mapping_init(&info, result = kernel_ident_mapping_init(&info, image->arch.pgd,
level4p, mstart, mend); mstart, mend);
if (result) if (result)
return result; return result;
@@ -274,15 +275,19 @@ static int init_pgtable(struct kimage *image, unsigned long start_pgtable)
* Prepare EFI systab and ACPI tables for kexec kernel since they are * Prepare EFI systab and ACPI tables for kexec kernel since they are
* not covered by pfn_mapped. * not covered by pfn_mapped.
*/ */
result = map_efi_systab(&info, level4p); result = map_efi_systab(&info, image->arch.pgd);
if (result) if (result)
return result; return result;
result = map_acpi_tables(&info, level4p); result = map_acpi_tables(&info, image->arch.pgd);
if (result) if (result)
return result; return result;
return init_transition_pgtable(image, level4p); /*
* This must be last because the intermediate page table pages it
* allocates will not be control pages and may overlap the image.
*/
return init_transition_pgtable(image, image->arch.pgd, control_page);
} }
static void load_segments(void) static void load_segments(void)
@@ -299,14 +304,14 @@ static void load_segments(void)
int machine_kexec_prepare(struct kimage *image) int machine_kexec_prepare(struct kimage *image)
{ {
unsigned long start_pgtable; unsigned long control_page;
int result; int result;
/* Calculate the offsets */ /* Calculate the offsets */
start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT; control_page = page_to_pfn(image->control_code_page) << PAGE_SHIFT;
/* Setup the identity mapped 64bit page table */ /* Setup the identity mapped 64bit page table */
result = init_pgtable(image, start_pgtable); result = init_pgtable(image, control_page);
if (result) if (result)
return result; return result;
@@ -353,13 +358,12 @@ void machine_kexec(struct kimage *image)
#endif #endif
} }
control_page = page_address(image->control_code_page) + PAGE_SIZE; control_page = page_address(image->control_code_page);
__memcpy(control_page, relocate_kernel, KEXEC_CONTROL_CODE_MAX_SIZE); __memcpy(control_page, relocate_kernel, KEXEC_CONTROL_CODE_MAX_SIZE);
page_list[PA_CONTROL_PAGE] = virt_to_phys(control_page); page_list[PA_CONTROL_PAGE] = virt_to_phys(control_page);
page_list[VA_CONTROL_PAGE] = (unsigned long)control_page; page_list[VA_CONTROL_PAGE] = (unsigned long)control_page;
page_list[PA_TABLE_PAGE] = page_list[PA_TABLE_PAGE] = (unsigned long)__pa(image->arch.pgd);
(unsigned long)__pa(page_address(image->control_code_page));
if (image->type == KEXEC_TYPE_DEFAULT) if (image->type == KEXEC_TYPE_DEFAULT)
page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page) page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page)
@@ -578,8 +582,7 @@ static void kexec_mark_crashkres(bool protect)
/* Don't touch the control code page used in crash_kexec().*/ /* Don't touch the control code page used in crash_kexec().*/
control = PFN_PHYS(page_to_pfn(kexec_crash_image->control_code_page)); control = PFN_PHYS(page_to_pfn(kexec_crash_image->control_code_page));
/* Control code page is located in the 2nd page. */ kexec_mark_range(crashk_res.start, control - 1, protect);
kexec_mark_range(crashk_res.start, control + PAGE_SIZE - 1, protect);
control += KEXEC_CONTROL_PAGE_SIZE; control += KEXEC_CONTROL_PAGE_SIZE;
kexec_mark_range(control, crashk_res.end, protect); kexec_mark_range(control, crashk_res.end, protect);
} }

View File

@@ -155,8 +155,6 @@ static unsigned long ghes_estatus_pool_size_request;
static struct ghes_estatus_cache *ghes_estatus_caches[GHES_ESTATUS_CACHES_SIZE]; static struct ghes_estatus_cache *ghes_estatus_caches[GHES_ESTATUS_CACHES_SIZE];
static atomic_t ghes_estatus_cache_alloced; static atomic_t ghes_estatus_cache_alloced;
static int ghes_panic_timeout __read_mostly = 30;
static void __iomem *ghes_map(u64 pfn, enum fixed_addresses fixmap_idx) static void __iomem *ghes_map(u64 pfn, enum fixed_addresses fixmap_idx)
{ {
phys_addr_t paddr; phys_addr_t paddr;
@@ -858,14 +856,16 @@ static void __ghes_panic(struct ghes *ghes,
struct acpi_hest_generic_status *estatus, struct acpi_hest_generic_status *estatus,
u64 buf_paddr, enum fixed_addresses fixmap_idx) u64 buf_paddr, enum fixed_addresses fixmap_idx)
{ {
const char *msg = GHES_PFX "Fatal hardware error";
__ghes_print_estatus(KERN_EMERG, ghes->generic, estatus); __ghes_print_estatus(KERN_EMERG, ghes->generic, estatus);
ghes_clear_estatus(ghes, estatus, buf_paddr, fixmap_idx); ghes_clear_estatus(ghes, estatus, buf_paddr, fixmap_idx);
/* reboot to log the error! */
if (!panic_timeout) if (!panic_timeout)
panic_timeout = ghes_panic_timeout; pr_emerg("%s but panic disabled\n", msg);
panic("Fatal hardware error!");
panic(msg);
} }
static int ghes_proc(struct ghes *ghes) static int ghes_proc(struct ghes *ghes)

View File

@@ -1555,16 +1555,16 @@ clean_exit:
return ret; return ret;
} }
static unsigned int kbps_from_pbn(unsigned int pbn) static uint32_t kbps_from_pbn(unsigned int pbn)
{ {
unsigned int kbps = pbn; uint64_t kbps = (uint64_t)pbn;
kbps *= (1000000 / PEAK_FACTOR_X1000); kbps *= (1000000 / PEAK_FACTOR_X1000);
kbps *= 8; kbps *= 8;
kbps *= 54; kbps *= 54;
kbps /= 64; kbps /= 64;
return kbps; return (uint32_t)kbps;
} }
static bool is_dsc_common_config_possible(struct dc_stream_state *stream, static bool is_dsc_common_config_possible(struct dc_stream_state *stream,

View File

@@ -296,7 +296,7 @@
#define MAX_LANE_COUNT 4 #define MAX_LANE_COUNT 4
#define MAX_LINK_RATE HBR #define MAX_LINK_RATE HBR
#define AUTO_TRAIN_RETRY 3 #define AUTO_TRAIN_RETRY 3
#define MAX_HDCP_DOWN_STREAM_COUNT 10 #define MAX_HDCP_DOWN_STREAM_COUNT 127
#define MAX_CR_LEVEL 0x03 #define MAX_CR_LEVEL 0x03
#define MAX_EQ_LEVEL 0x03 #define MAX_EQ_LEVEL 0x03
#define AUX_WAIT_TIMEOUT_MS 15 #define AUX_WAIT_TIMEOUT_MS 15
@@ -2011,7 +2011,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)
{ {
struct device *dev = &it6505->client->dev; struct device *dev = &it6505->client->dev;
u8 av[5][4], bv[5][4]; u8 av[5][4], bv[5][4];
int i, err; int i, err, retry;
i = it6505_setup_sha1_input(it6505, it6505->sha1_input); i = it6505_setup_sha1_input(it6505, it6505->sha1_input);
if (i <= 0) { if (i <= 0) {
@@ -2020,22 +2020,28 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)
} }
it6505_sha1_digest(it6505, it6505->sha1_input, i, (u8 *)av); it6505_sha1_digest(it6505, it6505->sha1_input, i, (u8 *)av);
/*1B-05 V' must retry 3 times */
for (retry = 0; retry < 3; retry++) {
err = it6505_get_dpcd(it6505, DP_AUX_HDCP_V_PRIME(0), (u8 *)bv,
sizeof(bv));
err = it6505_get_dpcd(it6505, DP_AUX_HDCP_V_PRIME(0), (u8 *)bv, if (err < 0) {
sizeof(bv)); dev_err(dev, "Read V' value Fail %d", retry);
continue;
}
if (err < 0) { for (i = 0; i < 5; i++) {
dev_err(dev, "Read V' value Fail"); if (bv[i][3] != av[i][0] || bv[i][2] != av[i][1] ||
return false; av[i][1] != av[i][2] || bv[i][0] != av[i][3])
break;
DRM_DEV_DEBUG_DRIVER(dev, "V' all match!! %d, %d", retry, i);
return true;
}
} }
for (i = 0; i < 5; i++) DRM_DEV_DEBUG_DRIVER(dev, "V' NOT match!! %d", retry);
if (bv[i][3] != av[i][0] || bv[i][2] != av[i][1] || return false;
bv[i][1] != av[i][2] || bv[i][0] != av[i][3])
return false;
DRM_DEV_DEBUG_DRIVER(dev, "V' all match!!");
return true;
} }
static void it6505_hdcp_wait_ksv_list(struct work_struct *work) static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
@@ -2069,15 +2075,12 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
ksv_list_check = it6505_hdcp_part2_ksvlist_check(it6505); ksv_list_check = it6505_hdcp_part2_ksvlist_check(it6505);
DRM_DEV_DEBUG_DRIVER(dev, "ksv list ready, ksv list check %s", DRM_DEV_DEBUG_DRIVER(dev, "ksv list ready, ksv list check %s",
ksv_list_check ? "pass" : "fail"); ksv_list_check ? "pass" : "fail");
if (ksv_list_check) {
it6505_set_bits(it6505, REG_HDCP_TRIGGER, if (ksv_list_check)
HDCP_TRIGGER_KSV_DONE, HDCP_TRIGGER_KSV_DONE);
return; return;
}
timeout: timeout:
it6505_set_bits(it6505, REG_HDCP_TRIGGER, it6505_start_hdcp(it6505);
HDCP_TRIGGER_KSV_DONE | HDCP_TRIGGER_KSV_FAIL,
HDCP_TRIGGER_KSV_DONE | HDCP_TRIGGER_KSV_FAIL);
} }
static void it6505_hdcp_work(struct work_struct *work) static void it6505_hdcp_work(struct work_struct *work)
@@ -2292,14 +2295,20 @@ static int it6505_process_hpd_irq(struct it6505 *it6505)
DRM_DEV_DEBUG_DRIVER(dev, "dp_irq_vector = 0x%02x", dp_irq_vector); DRM_DEV_DEBUG_DRIVER(dev, "dp_irq_vector = 0x%02x", dp_irq_vector);
if (dp_irq_vector & DP_CP_IRQ) { if (dp_irq_vector & DP_CP_IRQ) {
it6505_set_bits(it6505, REG_HDCP_TRIGGER, HDCP_TRIGGER_CPIRQ,
HDCP_TRIGGER_CPIRQ);
bstatus = it6505_dpcd_read(it6505, DP_AUX_HDCP_BSTATUS); bstatus = it6505_dpcd_read(it6505, DP_AUX_HDCP_BSTATUS);
if (bstatus < 0) if (bstatus < 0)
return bstatus; return bstatus;
DRM_DEV_DEBUG_DRIVER(dev, "Bstatus = 0x%02x", bstatus); DRM_DEV_DEBUG_DRIVER(dev, "Bstatus = 0x%02x", bstatus);
/*Check BSTATUS when recive CP_IRQ */
if (bstatus & DP_BSTATUS_R0_PRIME_READY &&
it6505->hdcp_status == HDCP_AUTH_GOING)
it6505_set_bits(it6505, REG_HDCP_TRIGGER, HDCP_TRIGGER_CPIRQ,
HDCP_TRIGGER_CPIRQ);
else if (bstatus & (DP_BSTATUS_REAUTH_REQ | DP_BSTATUS_LINK_FAILURE) &&
it6505->hdcp_status == HDCP_AUTH_DONE)
it6505_start_hdcp(it6505);
} }
ret = drm_dp_dpcd_read_link_status(&it6505->aux, link_status); ret = drm_dp_dpcd_read_link_status(&it6505->aux, link_status);
@@ -2419,7 +2428,11 @@ static void it6505_irq_hdcp_ksv_check(struct it6505 *it6505)
{ {
struct device *dev = &it6505->client->dev; struct device *dev = &it6505->client->dev;
DRM_DEV_DEBUG_DRIVER(dev, "HDCP event Interrupt"); DRM_DEV_DEBUG_DRIVER(dev, "HDCP repeater R0 event Interrupt");
/* 1B01 HDCP encription should start when R0 is ready*/
it6505_set_bits(it6505, REG_HDCP_TRIGGER,
HDCP_TRIGGER_KSV_DONE, HDCP_TRIGGER_KSV_DONE);
schedule_work(&it6505->hdcp_wait_ksv_list); schedule_work(&it6505->hdcp_wait_ksv_list);
} }

View File

@@ -190,6 +190,13 @@ struct virtio_gpu_framebuffer {
#define to_virtio_gpu_framebuffer(x) \ #define to_virtio_gpu_framebuffer(x) \
container_of(x, struct virtio_gpu_framebuffer, base) container_of(x, struct virtio_gpu_framebuffer, base)
struct virtio_gpu_plane_state {
struct drm_plane_state base;
struct virtio_gpu_fence *fence;
};
#define to_virtio_gpu_plane_state(x) \
container_of(x, struct virtio_gpu_plane_state, base)
struct virtio_gpu_queue { struct virtio_gpu_queue {
struct virtqueue *vq; struct virtqueue *vq;
spinlock_t qlock; spinlock_t qlock;

View File

@@ -112,11 +112,28 @@ uint32_t virtio_gpu_translate_format(uint32_t drm_fourcc)
return format; return format;
} }
static struct
drm_plane_state *virtio_gpu_plane_duplicate_state(struct drm_plane *plane)
{
struct virtio_gpu_plane_state *new;
if (WARN_ON(!plane->state))
return NULL;
new = kzalloc(sizeof(*new), GFP_KERNEL);
if (!new)
return NULL;
__drm_atomic_helper_plane_duplicate_state(plane, &new->base);
return &new->base;
}
static const struct drm_plane_funcs virtio_gpu_plane_funcs = { static const struct drm_plane_funcs virtio_gpu_plane_funcs = {
.update_plane = drm_atomic_helper_update_plane, .update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane, .disable_plane = drm_atomic_helper_disable_plane,
.reset = drm_atomic_helper_plane_reset, .reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_duplicate_state = virtio_gpu_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
}; };
@@ -174,11 +191,13 @@ static void virtio_gpu_resource_flush(struct drm_plane *plane,
struct drm_device *dev = plane->dev; struct drm_device *dev = plane->dev;
struct virtio_gpu_device *vgdev = dev->dev_private; struct virtio_gpu_device *vgdev = dev->dev_private;
struct virtio_gpu_framebuffer *vgfb; struct virtio_gpu_framebuffer *vgfb;
struct virtio_gpu_plane_state *vgplane_st;
struct virtio_gpu_object *bo; struct virtio_gpu_object *bo;
vgfb = to_virtio_gpu_framebuffer(plane->state->fb); vgfb = to_virtio_gpu_framebuffer(plane->state->fb);
vgplane_st = to_virtio_gpu_plane_state(plane->state);
bo = gem_to_virtio_gpu_obj(vgfb->base.obj[0]); bo = gem_to_virtio_gpu_obj(vgfb->base.obj[0]);
if (vgfb->fence) { if (vgplane_st->fence) {
struct virtio_gpu_object_array *objs; struct virtio_gpu_object_array *objs;
objs = virtio_gpu_array_alloc(1); objs = virtio_gpu_array_alloc(1);
@@ -187,13 +206,11 @@ static void virtio_gpu_resource_flush(struct drm_plane *plane,
virtio_gpu_array_add_obj(objs, vgfb->base.obj[0]); virtio_gpu_array_add_obj(objs, vgfb->base.obj[0]);
virtio_gpu_array_lock_resv(objs); virtio_gpu_array_lock_resv(objs);
virtio_gpu_cmd_resource_flush(vgdev, bo->hw_res_handle, x, y, virtio_gpu_cmd_resource_flush(vgdev, bo->hw_res_handle, x, y,
width, height, objs, vgfb->fence); width, height, objs,
vgplane_st->fence);
virtio_gpu_notify(vgdev); virtio_gpu_notify(vgdev);
dma_fence_wait_timeout(&vgplane_st->fence->f, true,
dma_fence_wait_timeout(&vgfb->fence->f, true,
msecs_to_jiffies(50)); msecs_to_jiffies(50));
dma_fence_put(&vgfb->fence->f);
vgfb->fence = NULL;
} else { } else {
virtio_gpu_cmd_resource_flush(vgdev, bo->hw_res_handle, x, y, virtio_gpu_cmd_resource_flush(vgdev, bo->hw_res_handle, x, y,
width, height, NULL, NULL); width, height, NULL, NULL);
@@ -283,20 +300,23 @@ static int virtio_gpu_plane_prepare_fb(struct drm_plane *plane,
struct drm_device *dev = plane->dev; struct drm_device *dev = plane->dev;
struct virtio_gpu_device *vgdev = dev->dev_private; struct virtio_gpu_device *vgdev = dev->dev_private;
struct virtio_gpu_framebuffer *vgfb; struct virtio_gpu_framebuffer *vgfb;
struct virtio_gpu_plane_state *vgplane_st;
struct virtio_gpu_object *bo; struct virtio_gpu_object *bo;
if (!new_state->fb) if (!new_state->fb)
return 0; return 0;
vgfb = to_virtio_gpu_framebuffer(new_state->fb); vgfb = to_virtio_gpu_framebuffer(new_state->fb);
vgplane_st = to_virtio_gpu_plane_state(new_state);
bo = gem_to_virtio_gpu_obj(vgfb->base.obj[0]); bo = gem_to_virtio_gpu_obj(vgfb->base.obj[0]);
if (!bo || (plane->type == DRM_PLANE_TYPE_PRIMARY && !bo->guest_blob)) if (!bo || (plane->type == DRM_PLANE_TYPE_PRIMARY && !bo->guest_blob))
return 0; return 0;
if (bo->dumb && (plane->state->fb != new_state->fb)) { if (bo->dumb) {
vgfb->fence = virtio_gpu_fence_alloc(vgdev, vgdev->fence_drv.context, vgplane_st->fence = virtio_gpu_fence_alloc(vgdev,
vgdev->fence_drv.context,
0); 0);
if (!vgfb->fence) if (!vgplane_st->fence)
return -ENOMEM; return -ENOMEM;
} }
@@ -306,15 +326,15 @@ static int virtio_gpu_plane_prepare_fb(struct drm_plane *plane,
static void virtio_gpu_plane_cleanup_fb(struct drm_plane *plane, static void virtio_gpu_plane_cleanup_fb(struct drm_plane *plane,
struct drm_plane_state *state) struct drm_plane_state *state)
{ {
struct virtio_gpu_framebuffer *vgfb; struct virtio_gpu_plane_state *vgplane_st;
if (!state->fb) if (!state->fb)
return; return;
vgfb = to_virtio_gpu_framebuffer(state->fb); vgplane_st = to_virtio_gpu_plane_state(state);
if (vgfb->fence) { if (vgplane_st->fence) {
dma_fence_put(&vgfb->fence->f); dma_fence_put(&vgplane_st->fence->f);
vgfb->fence = NULL; vgplane_st->fence = NULL;
} }
} }
@@ -327,6 +347,7 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane,
struct virtio_gpu_device *vgdev = dev->dev_private; struct virtio_gpu_device *vgdev = dev->dev_private;
struct virtio_gpu_output *output = NULL; struct virtio_gpu_output *output = NULL;
struct virtio_gpu_framebuffer *vgfb; struct virtio_gpu_framebuffer *vgfb;
struct virtio_gpu_plane_state *vgplane_st;
struct virtio_gpu_object *bo = NULL; struct virtio_gpu_object *bo = NULL;
uint32_t handle; uint32_t handle;
@@ -339,6 +360,7 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane,
if (plane->state->fb) { if (plane->state->fb) {
vgfb = to_virtio_gpu_framebuffer(plane->state->fb); vgfb = to_virtio_gpu_framebuffer(plane->state->fb);
vgplane_st = to_virtio_gpu_plane_state(plane->state);
bo = gem_to_virtio_gpu_obj(vgfb->base.obj[0]); bo = gem_to_virtio_gpu_obj(vgfb->base.obj[0]);
handle = bo->hw_res_handle; handle = bo->hw_res_handle;
} else { } else {
@@ -358,11 +380,9 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane,
(vgdev, 0, (vgdev, 0,
plane->state->crtc_w, plane->state->crtc_w,
plane->state->crtc_h, plane->state->crtc_h,
0, 0, objs, vgfb->fence); 0, 0, objs, vgplane_st->fence);
virtio_gpu_notify(vgdev); virtio_gpu_notify(vgdev);
dma_fence_wait(&vgfb->fence->f, true); dma_fence_wait(&vgplane_st->fence->f, true);
dma_fence_put(&vgfb->fence->f);
vgfb->fence = NULL;
} }
if (plane->state->fb != old_state->fb) { if (plane->state->fb != old_state->fb) {

View File

@@ -4914,6 +4914,10 @@ static const struct wacom_features wacom_features_0x94 =
HID_DEVICE(BUS_I2C, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ HID_DEVICE(BUS_I2C, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
.driver_data = (kernel_ulong_t)&wacom_features_##prod .driver_data = (kernel_ulong_t)&wacom_features_##prod
#define PCI_DEVICE_WACOM(prod) \
HID_DEVICE(BUS_PCI, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
.driver_data = (kernel_ulong_t)&wacom_features_##prod
#define USB_DEVICE_LENOVO(prod) \ #define USB_DEVICE_LENOVO(prod) \
HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \ HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \
.driver_data = (kernel_ulong_t)&wacom_features_##prod .driver_data = (kernel_ulong_t)&wacom_features_##prod
@@ -5083,6 +5087,7 @@ const struct hid_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(HID_ANY_ID) }, { USB_DEVICE_WACOM(HID_ANY_ID) },
{ I2C_DEVICE_WACOM(HID_ANY_ID) }, { I2C_DEVICE_WACOM(HID_ANY_ID) },
{ PCI_DEVICE_WACOM(HID_ANY_ID) },
{ BT_DEVICE_WACOM(HID_ANY_ID) }, { BT_DEVICE_WACOM(HID_ANY_ID) },
{ } { }
}; };

View File

@@ -355,6 +355,25 @@ static const struct acpi_device_id i2c_acpi_force_400khz_device_ids[] = {
{} {}
}; };
static const struct acpi_device_id i2c_acpi_force_100khz_device_ids[] = {
/*
* When a 400KHz freq is used on this model of ELAN touchpad in Linux,
* excessive smoothing (similar to when the touchpad's firmware detects
* a noisy signal) is sometimes applied. As some devices' (e.g, Lenovo
* V15 G4) ACPI tables specify a 400KHz frequency for this device and
* some I2C busses (e.g, Designware I2C) default to a 400KHz freq,
* force the speed to 100KHz as a workaround.
*
* For future investigation: This problem may be related to the default
* HCNT/LCNT values given by some busses' drivers, because they are not
* specified in the aforementioned devices' ACPI tables, and because
* the device works without issues on Windows at what is expected to be
* a 400KHz frequency. The root cause of the issue is not known.
*/
{ "ELAN06FA", 0 },
{}
};
static acpi_status i2c_acpi_lookup_speed(acpi_handle handle, u32 level, static acpi_status i2c_acpi_lookup_speed(acpi_handle handle, u32 level,
void *data, void **return_value) void *data, void **return_value)
{ {
@@ -373,6 +392,9 @@ static acpi_status i2c_acpi_lookup_speed(acpi_handle handle, u32 level,
if (acpi_match_device_ids(adev, i2c_acpi_force_400khz_device_ids) == 0) if (acpi_match_device_ids(adev, i2c_acpi_force_400khz_device_ids) == 0)
lookup->force_speed = I2C_MAX_FAST_MODE_FREQ; lookup->force_speed = I2C_MAX_FAST_MODE_FREQ;
if (acpi_match_device_ids(adev, i2c_acpi_force_100khz_device_ids) == 0)
lookup->force_speed = I2C_MAX_STANDARD_MODE_FREQ;
return AE_OK; return AE_OK;
} }

View File

@@ -3893,7 +3893,7 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
/* Initialise in-memory data structures */ /* Initialise in-memory data structures */
ret = arm_smmu_init_structures(smmu); ret = arm_smmu_init_structures(smmu);
if (ret) if (ret)
return ret; goto err_free_iopf;
/* Record our private device structure */ /* Record our private device structure */
platform_set_drvdata(pdev, smmu); platform_set_drvdata(pdev, smmu);
@@ -3904,22 +3904,29 @@ static int arm_smmu_device_probe(struct platform_device *pdev)
/* Reset the device */ /* Reset the device */
ret = arm_smmu_device_reset(smmu, bypass); ret = arm_smmu_device_reset(smmu, bypass);
if (ret) if (ret)
return ret; goto err_disable;
/* And we're up. Go go go! */ /* And we're up. Go go go! */
ret = iommu_device_sysfs_add(&smmu->iommu, dev, NULL, ret = iommu_device_sysfs_add(&smmu->iommu, dev, NULL,
"smmu3.%pa", &ioaddr); "smmu3.%pa", &ioaddr);
if (ret) if (ret)
return ret; goto err_disable;
ret = iommu_device_register(&smmu->iommu, &arm_smmu_ops, dev); ret = iommu_device_register(&smmu->iommu, &arm_smmu_ops, dev);
if (ret) { if (ret) {
dev_err(dev, "Failed to register iommu\n"); dev_err(dev, "Failed to register iommu\n");
iommu_device_sysfs_remove(&smmu->iommu); goto err_free_sysfs;
return ret;
} }
return 0; return 0;
err_free_sysfs:
iommu_device_sysfs_remove(&smmu->iommu);
err_disable:
arm_smmu_device_disable(smmu);
err_free_iopf:
iopf_queue_free(smmu->evtq.iopf);
return ret;
} }
static int arm_smmu_device_remove(struct platform_device *pdev) static int arm_smmu_device_remove(struct platform_device *pdev)

View File

@@ -2097,11 +2097,12 @@ static void mxc_jpeg_detach_pm_domains(struct mxc_jpeg_dev *jpeg)
int i; int i;
for (i = 0; i < jpeg->num_domains; i++) { for (i = 0; i < jpeg->num_domains; i++) {
if (jpeg->pd_dev[i] && !pm_runtime_suspended(jpeg->pd_dev[i])) if (!IS_ERR_OR_NULL(jpeg->pd_dev[i]) &&
!pm_runtime_suspended(jpeg->pd_dev[i]))
pm_runtime_force_suspend(jpeg->pd_dev[i]); pm_runtime_force_suspend(jpeg->pd_dev[i]);
if (jpeg->pd_link[i] && !IS_ERR(jpeg->pd_link[i])) if (!IS_ERR_OR_NULL(jpeg->pd_link[i]))
device_link_del(jpeg->pd_link[i]); device_link_del(jpeg->pd_link[i]);
if (jpeg->pd_dev[i] && !IS_ERR(jpeg->pd_dev[i])) if (!IS_ERR_OR_NULL(jpeg->pd_dev[i]))
dev_pm_domain_detach(jpeg->pd_dev[i], true); dev_pm_domain_detach(jpeg->pd_dev[i], true);
jpeg->pd_dev[i] = NULL; jpeg->pd_dev[i] = NULL;
jpeg->pd_link[i] = NULL; jpeg->pd_link[i] = NULL;

View File

@@ -267,6 +267,7 @@ int uvc_status_init(struct uvc_device *dev)
dev->int_urb = usb_alloc_urb(0, GFP_KERNEL); dev->int_urb = usb_alloc_urb(0, GFP_KERNEL);
if (dev->int_urb == NULL) { if (dev->int_urb == NULL) {
kfree(dev->status); kfree(dev->status);
dev->status = NULL;
return -ENOMEM; return -ENOMEM;
} }

View File

@@ -756,8 +756,9 @@ static const struct pci_device_id lpc_ich_ids[] = {
{ PCI_VDEVICE(INTEL, 0x2917), LPC_ICH9ME}, { PCI_VDEVICE(INTEL, 0x2917), LPC_ICH9ME},
{ PCI_VDEVICE(INTEL, 0x2918), LPC_ICH9}, { PCI_VDEVICE(INTEL, 0x2918), LPC_ICH9},
{ PCI_VDEVICE(INTEL, 0x2919), LPC_ICH9M}, { PCI_VDEVICE(INTEL, 0x2919), LPC_ICH9M},
{ PCI_VDEVICE(INTEL, 0x3197), LPC_GLK},
{ PCI_VDEVICE(INTEL, 0x2b9c), LPC_COUGARMOUNTAIN}, { PCI_VDEVICE(INTEL, 0x2b9c), LPC_COUGARMOUNTAIN},
{ PCI_VDEVICE(INTEL, 0x3197), LPC_GLK},
{ PCI_VDEVICE(INTEL, 0x31e8), LPC_GLK},
{ PCI_VDEVICE(INTEL, 0x3a14), LPC_ICH10DO}, { PCI_VDEVICE(INTEL, 0x3a14), LPC_ICH10DO},
{ PCI_VDEVICE(INTEL, 0x3a16), LPC_ICH10R}, { PCI_VDEVICE(INTEL, 0x3a16), LPC_ICH10R},
{ PCI_VDEVICE(INTEL, 0x3a18), LPC_ICH10}, { PCI_VDEVICE(INTEL, 0x3a18), LPC_ICH10},

View File

@@ -458,6 +458,8 @@ static unsigned mmc_sdio_get_max_clock(struct mmc_card *card)
if (mmc_card_sd_combo(card)) if (mmc_card_sd_combo(card))
max_dtr = min(max_dtr, mmc_sd_get_max_clock(card)); max_dtr = min(max_dtr, mmc_sd_get_max_clock(card));
max_dtr = min_not_zero(max_dtr, card->quirk_max_rate);
return max_dtr; return max_dtr;
} }

View File

@@ -132,9 +132,18 @@
/* Timeout value to avoid infinite waiting for pwr_irq */ /* Timeout value to avoid infinite waiting for pwr_irq */
#define MSM_PWR_IRQ_TIMEOUT_MS 5000 #define MSM_PWR_IRQ_TIMEOUT_MS 5000
/* Max load for eMMC Vdd supply */
#define MMC_VMMC_MAX_LOAD_UA 570000
/* Max load for eMMC Vdd-io supply */ /* Max load for eMMC Vdd-io supply */
#define MMC_VQMMC_MAX_LOAD_UA 325000 #define MMC_VQMMC_MAX_LOAD_UA 325000
/* Max load for SD Vdd supply */
#define SD_VMMC_MAX_LOAD_UA 800000
/* Max load for SD Vdd-io supply */
#define SD_VQMMC_MAX_LOAD_UA 22000
#define msm_host_readl(msm_host, host, offset) \ #define msm_host_readl(msm_host, host, offset) \
msm_host->var_ops->msm_readl_relaxed(host, offset) msm_host->var_ops->msm_readl_relaxed(host, offset)
@@ -1399,11 +1408,48 @@ static int sdhci_msm_set_pincfg(struct sdhci_msm_host *msm_host, bool level)
return ret; return ret;
} }
static int sdhci_msm_set_vmmc(struct mmc_host *mmc) static void msm_config_vmmc_regulator(struct mmc_host *mmc, bool hpm)
{
int load;
if (!hpm)
load = 0;
else if (!mmc->card)
load = max(MMC_VMMC_MAX_LOAD_UA, SD_VMMC_MAX_LOAD_UA);
else if (mmc_card_mmc(mmc->card))
load = MMC_VMMC_MAX_LOAD_UA;
else if (mmc_card_sd(mmc->card))
load = SD_VMMC_MAX_LOAD_UA;
else
return;
regulator_set_load(mmc->supply.vmmc, load);
}
static void msm_config_vqmmc_regulator(struct mmc_host *mmc, bool hpm)
{
int load;
if (!hpm)
load = 0;
else if (!mmc->card)
load = max(MMC_VQMMC_MAX_LOAD_UA, SD_VQMMC_MAX_LOAD_UA);
else if (mmc_card_sd(mmc->card))
load = SD_VQMMC_MAX_LOAD_UA;
else
return;
regulator_set_load(mmc->supply.vqmmc, load);
}
static int sdhci_msm_set_vmmc(struct sdhci_msm_host *msm_host,
struct mmc_host *mmc, bool hpm)
{ {
if (IS_ERR(mmc->supply.vmmc)) if (IS_ERR(mmc->supply.vmmc))
return 0; return 0;
msm_config_vmmc_regulator(mmc, hpm);
return mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, mmc->ios.vdd); return mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, mmc->ios.vdd);
} }
@@ -1416,6 +1462,8 @@ static int msm_toggle_vqmmc(struct sdhci_msm_host *msm_host,
if (msm_host->vqmmc_enabled == level) if (msm_host->vqmmc_enabled == level)
return 0; return 0;
msm_config_vqmmc_regulator(mmc, level);
if (level) { if (level) {
/* Set the IO voltage regulator to default voltage level */ /* Set the IO voltage regulator to default voltage level */
if (msm_host->caps_0 & CORE_3_0V_SUPPORT) if (msm_host->caps_0 & CORE_3_0V_SUPPORT)
@@ -1638,7 +1686,8 @@ static void sdhci_msm_handle_pwr_irq(struct sdhci_host *host, int irq)
} }
if (pwr_state) { if (pwr_state) {
ret = sdhci_msm_set_vmmc(mmc); ret = sdhci_msm_set_vmmc(msm_host, mmc,
pwr_state & REQ_BUS_ON);
if (!ret) if (!ret)
ret = sdhci_msm_set_vqmmc(msm_host, mmc, ret = sdhci_msm_set_vqmmc(msm_host, mmc,
pwr_state & REQ_BUS_ON); pwr_state & REQ_BUS_ON);

View File

@@ -186,17 +186,16 @@ static void mlx5_pps_out(struct work_struct *work)
} }
} }
static void mlx5_timestamp_overflow(struct work_struct *work) static long mlx5_timestamp_overflow(struct ptp_clock_info *ptp_info)
{ {
struct delayed_work *dwork = to_delayed_work(work);
struct mlx5_core_dev *mdev; struct mlx5_core_dev *mdev;
struct mlx5_timer *timer; struct mlx5_timer *timer;
struct mlx5_clock *clock; struct mlx5_clock *clock;
unsigned long flags; unsigned long flags;
timer = container_of(dwork, struct mlx5_timer, overflow_work); clock = container_of(ptp_info, struct mlx5_clock, ptp_info);
clock = container_of(timer, struct mlx5_clock, timer);
mdev = container_of(clock, struct mlx5_core_dev, clock); mdev = container_of(clock, struct mlx5_core_dev, clock);
timer = &clock->timer;
if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
goto out; goto out;
@@ -207,7 +206,7 @@ static void mlx5_timestamp_overflow(struct work_struct *work)
write_sequnlock_irqrestore(&clock->lock, flags); write_sequnlock_irqrestore(&clock->lock, flags);
out: out:
schedule_delayed_work(&timer->overflow_work, timer->overflow_period); return timer->overflow_period;
} }
static int mlx5_ptp_settime_real_time(struct mlx5_core_dev *mdev, static int mlx5_ptp_settime_real_time(struct mlx5_core_dev *mdev,
@@ -375,6 +374,7 @@ static int mlx5_ptp_adjfreq(struct ptp_clock_info *ptp, s32 delta)
timer->nominal_c_mult + diff; timer->nominal_c_mult + diff;
mlx5_update_clock_info_page(mdev); mlx5_update_clock_info_page(mdev);
write_sequnlock_irqrestore(&clock->lock, flags); write_sequnlock_irqrestore(&clock->lock, flags);
ptp_schedule_worker(clock->ptp, timer->overflow_period);
return 0; return 0;
} }
@@ -708,6 +708,7 @@ static const struct ptp_clock_info mlx5_ptp_clock_info = {
.settime64 = mlx5_ptp_settime, .settime64 = mlx5_ptp_settime,
.enable = NULL, .enable = NULL,
.verify = NULL, .verify = NULL,
.do_aux_work = mlx5_timestamp_overflow,
}; };
static int mlx5_query_mtpps_pin_mode(struct mlx5_core_dev *mdev, u8 pin, static int mlx5_query_mtpps_pin_mode(struct mlx5_core_dev *mdev, u8 pin,
@@ -908,12 +909,11 @@ static void mlx5_init_overflow_period(struct mlx5_clock *clock)
do_div(ns, NSEC_PER_SEC / HZ); do_div(ns, NSEC_PER_SEC / HZ);
timer->overflow_period = ns; timer->overflow_period = ns;
INIT_DELAYED_WORK(&timer->overflow_work, mlx5_timestamp_overflow); if (!timer->overflow_period) {
if (timer->overflow_period) timer->overflow_period = HZ;
schedule_delayed_work(&timer->overflow_work, 0);
else
mlx5_core_warn(mdev, mlx5_core_warn(mdev,
"invalid overflow period, overflow_work is not scheduled\n"); "invalid overflow period, overflow_work is scheduled once per second\n");
}
if (clock_info) if (clock_info)
clock_info->overflow_period = timer->overflow_period; clock_info->overflow_period = timer->overflow_period;
@@ -999,6 +999,9 @@ void mlx5_init_clock(struct mlx5_core_dev *mdev)
MLX5_NB_INIT(&clock->pps_nb, mlx5_pps_event, PPS_EVENT); MLX5_NB_INIT(&clock->pps_nb, mlx5_pps_event, PPS_EVENT);
mlx5_eq_notifier_register(mdev, &clock->pps_nb); mlx5_eq_notifier_register(mdev, &clock->pps_nb);
if (clock->ptp)
ptp_schedule_worker(clock->ptp, 0);
} }
void mlx5_cleanup_clock(struct mlx5_core_dev *mdev) void mlx5_cleanup_clock(struct mlx5_core_dev *mdev)
@@ -1015,7 +1018,6 @@ void mlx5_cleanup_clock(struct mlx5_core_dev *mdev)
} }
cancel_work_sync(&clock->pps_info.out_work); cancel_work_sync(&clock->pps_info.out_work);
cancel_delayed_work_sync(&clock->timer.overflow_work);
if (mdev->clock_info) { if (mdev->clock_info) {
free_page((unsigned long)mdev->clock_info); free_page((unsigned long)mdev->clock_info);

View File

@@ -574,14 +574,18 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb,
return ret; return ret;
} }
static inline bool tun_not_capable(struct tun_struct *tun) static inline bool tun_capable(struct tun_struct *tun)
{ {
const struct cred *cred = current_cred(); const struct cred *cred = current_cred();
struct net *net = dev_net(tun->dev); struct net *net = dev_net(tun->dev);
return ((uid_valid(tun->owner) && !uid_eq(cred->euid, tun->owner)) || if (ns_capable(net->user_ns, CAP_NET_ADMIN))
(gid_valid(tun->group) && !in_egroup_p(tun->group))) && return 1;
!ns_capable(net->user_ns, CAP_NET_ADMIN); if (uid_valid(tun->owner) && uid_eq(cred->euid, tun->owner))
return 1;
if (gid_valid(tun->group) && in_egroup_p(tun->group))
return 1;
return 0;
} }
static void tun_set_real_num_queues(struct tun_struct *tun) static void tun_set_real_num_queues(struct tun_struct *tun)
@@ -2767,7 +2771,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
!!(tun->flags & IFF_MULTI_QUEUE)) !!(tun->flags & IFF_MULTI_QUEUE))
return -EINVAL; return -EINVAL;
if (tun_not_capable(tun)) if (!tun_capable(tun))
return -EPERM; return -EPERM;
err = security_tun_dev_open(tun->security); err = security_tun_dev_open(tun->security);
if (err < 0) if (err < 0)

View File

@@ -89,13 +89,13 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
/* Set board-type to the first string of the machine compatible prop */ /* Set board-type to the first string of the machine compatible prop */
root = of_find_node_by_path("/"); root = of_find_node_by_path("/");
if (root && err) { if (root && err) {
char *board_type; char *board_type = NULL;
const char *tmp; const char *tmp;
of_property_read_string_index(root, "compatible", 0, &tmp);
/* get rid of '/' in the compatible string to be able to find the FW */ /* get rid of '/' in the compatible string to be able to find the FW */
board_type = devm_kstrdup(dev, tmp, GFP_KERNEL); if (!of_property_read_string_index(root, "compatible", 0, &tmp))
board_type = devm_kstrdup(dev, tmp, GFP_KERNEL);
if (!board_type) { if (!board_type) {
of_node_put(root); of_node_put(root);
return; return;

View File

@@ -23427,6 +23427,9 @@ wlc_phy_iqcal_gainparams_nphy(struct brcms_phy *pi, u16 core_no,
break; break;
} }
if (WARN_ON(k == NPHY_IQCAL_NUMGAINS))
return;
params->txgm = tbl_iqcal_gainparams_nphy[band_idx][k][1]; params->txgm = tbl_iqcal_gainparams_nphy[band_idx][k][1];
params->pga = tbl_iqcal_gainparams_nphy[band_idx][k][2]; params->pga = tbl_iqcal_gainparams_nphy[band_idx][k][2];
params->pad = tbl_iqcal_gainparams_nphy[band_idx][k][3]; params->pad = tbl_iqcal_gainparams_nphy[band_idx][k][3];

View File

@@ -123,7 +123,7 @@ static int iwl_acpi_get_dsm_integer(struct device *dev, int rev, int func,
size_t expected_size) size_t expected_size)
{ {
union acpi_object *obj; union acpi_object *obj;
int ret = 0; int ret;
obj = iwl_acpi_get_dsm_object(dev, rev, func, NULL, guid); obj = iwl_acpi_get_dsm_object(dev, rev, func, NULL, guid);
if (IS_ERR(obj)) { if (IS_ERR(obj)) {
@@ -138,8 +138,10 @@ static int iwl_acpi_get_dsm_integer(struct device *dev, int rev, int func,
} else if (obj->type == ACPI_TYPE_BUFFER) { } else if (obj->type == ACPI_TYPE_BUFFER) {
__le64 le_value = 0; __le64 le_value = 0;
if (WARN_ON_ONCE(expected_size > sizeof(le_value))) if (WARN_ON_ONCE(expected_size > sizeof(le_value))) {
return -EINVAL; ret = -EINVAL;
goto out;
}
/* if the buffer size doesn't match the expected size */ /* if the buffer size doesn't match the expected size */
if (obj->buffer.length != expected_size) if (obj->buffer.length != expected_size)
@@ -160,8 +162,9 @@ static int iwl_acpi_get_dsm_integer(struct device *dev, int rev, int func,
} }
IWL_DEBUG_DEV_RADIO(dev, IWL_DEBUG_DEV_RADIO(dev,
"ACPI: DSM method evaluated: func=%d, ret=%d\n", "ACPI: DSM method evaluated: func=%d, value=%lld\n",
func, ret); func, *value);
ret = 0;
out: out:
ACPI_FREE(obj); ACPI_FREE(obj);
return ret; return ret;

View File

@@ -6,6 +6,7 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/bitfield.h> #include <linux/bitfield.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/suspend.h>
#include <net/rtnetlink.h> #include <net/rtnetlink.h>
#include "iosm_ipc_imem.h" #include "iosm_ipc_imem.h"
@@ -18,6 +19,7 @@ MODULE_LICENSE("GPL v2");
/* WWAN GUID */ /* WWAN GUID */
static guid_t wwan_acpi_guid = GUID_INIT(0xbad01b75, 0x22a8, 0x4f48, 0x87, 0x92, static guid_t wwan_acpi_guid = GUID_INIT(0xbad01b75, 0x22a8, 0x4f48, 0x87, 0x92,
0xbd, 0xde, 0x94, 0x67, 0x74, 0x7d); 0xbd, 0xde, 0x94, 0x67, 0x74, 0x7d);
static bool pci_registered;
static void ipc_pcie_resources_release(struct iosm_pcie *ipc_pcie) static void ipc_pcie_resources_release(struct iosm_pcie *ipc_pcie)
{ {
@@ -448,7 +450,6 @@ static struct pci_driver iosm_ipc_driver = {
}, },
.id_table = iosm_ipc_ids, .id_table = iosm_ipc_ids,
}; };
module_pci_driver(iosm_ipc_driver);
int ipc_pcie_addr_map(struct iosm_pcie *ipc_pcie, unsigned char *data, int ipc_pcie_addr_map(struct iosm_pcie *ipc_pcie, unsigned char *data,
size_t size, dma_addr_t *mapping, int direction) size_t size, dma_addr_t *mapping, int direction)
@@ -530,3 +531,56 @@ void ipc_pcie_kfree_skb(struct iosm_pcie *ipc_pcie, struct sk_buff *skb)
IPC_CB(skb)->mapping = 0; IPC_CB(skb)->mapping = 0;
dev_kfree_skb(skb); dev_kfree_skb(skb);
} }
static int pm_notify(struct notifier_block *nb, unsigned long mode, void *_unused)
{
if (mode == PM_HIBERNATION_PREPARE || mode == PM_RESTORE_PREPARE) {
if (pci_registered) {
pci_unregister_driver(&iosm_ipc_driver);
pci_registered = false;
}
} else if (mode == PM_POST_HIBERNATION || mode == PM_POST_RESTORE) {
if (!pci_registered) {
int ret;
ret = pci_register_driver(&iosm_ipc_driver);
if (ret) {
pr_err(KBUILD_MODNAME ": unable to re-register PCI driver: %d\n",
ret);
} else {
pci_registered = true;
}
}
}
return 0;
}
static struct notifier_block pm_notifier = {
.notifier_call = pm_notify,
};
static int __init iosm_ipc_driver_init(void)
{
int ret;
ret = pci_register_driver(&iosm_ipc_driver);
if (ret)
return ret;
pci_registered = true;
register_pm_notifier(&pm_notifier);
return 0;
}
module_init(iosm_ipc_driver_init);
static void __exit iosm_ipc_driver_exit(void)
{
unregister_pm_notifier(&pm_notifier);
if (pci_registered)
pci_unregister_driver(&iosm_ipc_driver);
}
module_exit(iosm_ipc_driver_exit);

View File

@@ -1282,9 +1282,11 @@ static struct stm32_desc_pin *stm32_pctrl_get_desc_pin_from_gpio(struct stm32_pi
int i; int i;
/* With few exceptions (e.g. bank 'Z'), pin number matches with pin index in array */ /* With few exceptions (e.g. bank 'Z'), pin number matches with pin index in array */
pin_desc = pctl->pins + stm32_pin_nb; if (stm32_pin_nb < pctl->npins) {
if (pin_desc->pin.number == stm32_pin_nb) pin_desc = pctl->pins + stm32_pin_nb;
return pin_desc; if (pin_desc->pin.number == stm32_pin_nb)
return pin_desc;
}
/* Otherwise, loop all array to find the pin with the right number */ /* Otherwise, loop all array to find the pin with the right number */
for (i = 0; i < pctl->npins; i++) { for (i = 0; i < pctl->npins; i++) {

View File

@@ -4,6 +4,7 @@
* *
* Copyright (C) 2010 OMICRON electronics GmbH * Copyright (C) 2010 OMICRON electronics GmbH
*/ */
#include <linux/compat.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/posix-clock.h> #include <linux/posix-clock.h>
#include <linux/poll.h> #include <linux/poll.h>
@@ -124,6 +125,9 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
struct timespec64 ts; struct timespec64 ts;
int enable, err = 0; int enable, err = 0;
if (in_compat_syscall() && cmd != PTP_ENABLE_PPS && cmd != PTP_ENABLE_PPS2)
arg = (unsigned long)compat_ptr(arg);
switch (cmd) { switch (cmd) {
case PTP_CLOCK_GETCAPS: case PTP_CLOCK_GETCAPS:

View File

@@ -2466,6 +2466,13 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
rproc->dev.driver_data = rproc; rproc->dev.driver_data = rproc;
idr_init(&rproc->notifyids); idr_init(&rproc->notifyids);
/* Assign a unique device index and name */
rproc->index = ida_alloc(&rproc_dev_index, GFP_KERNEL);
if (rproc->index < 0) {
dev_err(dev, "ida_alloc failed: %d\n", rproc->index);
goto put_device;
}
rproc->name = kstrdup_const(name, GFP_KERNEL); rproc->name = kstrdup_const(name, GFP_KERNEL);
if (!rproc->name) if (!rproc->name)
goto put_device; goto put_device;
@@ -2476,13 +2483,6 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
if (rproc_alloc_ops(rproc, ops)) if (rproc_alloc_ops(rproc, ops))
goto put_device; goto put_device;
/* Assign a unique device index and name */
rproc->index = ida_alloc(&rproc_dev_index, GFP_KERNEL);
if (rproc->index < 0) {
dev_err(dev, "ida_alloc failed: %d\n", rproc->index);
goto put_device;
}
dev_set_name(&rproc->dev, "remoteproc%d", rproc->index); dev_set_name(&rproc->dev, "remoteproc%d", rproc->index);
atomic_set(&rproc->power, 0); atomic_set(&rproc->power, 0);

View File

@@ -376,7 +376,6 @@ static int max96712_probe(struct i2c_client *client)
return -ENOMEM; return -ENOMEM;
priv->client = client; priv->client = client;
i2c_set_clientdata(client, priv);
priv->regmap = devm_regmap_init_i2c(client, &max96712_i2c_regmap); priv->regmap = devm_regmap_init_i2c(client, &max96712_i2c_regmap);
if (IS_ERR(priv->regmap)) if (IS_ERR(priv->regmap))
@@ -409,7 +408,8 @@ static int max96712_probe(struct i2c_client *client)
static void max96712_remove(struct i2c_client *client) static void max96712_remove(struct i2c_client *client)
{ {
struct max96712_priv *priv = i2c_get_clientdata(client); struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct max96712_priv *priv = container_of(sd, struct max96712_priv, sd);
v4l2_async_unregister_subdev(&priv->sd); v4l2_async_unregister_subdev(&priv->sd);

View File

@@ -1066,7 +1066,6 @@ static void usbg_cmd_work(struct work_struct *work)
out: out:
transport_send_check_condition_and_sense(se_cmd, transport_send_check_condition_and_sense(se_cmd,
TCM_UNSUPPORTED_SCSI_OPCODE, 1); TCM_UNSUPPORTED_SCSI_OPCODE, 1);
transport_generic_free_cmd(&cmd->se_cmd, 0);
} }
static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu, static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu,
@@ -1195,7 +1194,6 @@ static void bot_cmd_work(struct work_struct *work)
out: out:
transport_send_check_condition_and_sense(se_cmd, transport_send_check_condition_and_sense(se_cmd,
TCM_UNSUPPORTED_SCSI_OPCODE, 1); TCM_UNSUPPORTED_SCSI_OPCODE, 1);
transport_generic_free_cmd(&cmd->se_cmd, 0);
} }
static int bot_submit_command(struct f_uas *fu, static int bot_submit_command(struct f_uas *fu,

View File

@@ -234,7 +234,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans,
if (args->drop_cache) if (args->drop_cache)
btrfs_drop_extent_map_range(inode, args->start, args->end - 1, false); btrfs_drop_extent_map_range(inode, args->start, args->end - 1, false);
if (args->start >= inode->disk_i_size && !args->replace_extent) if (data_race(args->start >= inode->disk_i_size) && !args->replace_extent)
modify_tree = 0; modify_tree = 0;
update_refs = (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID); update_refs = (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID);

View File

@@ -4423,8 +4423,18 @@ int btrfs_reloc_cow_block(struct btrfs_trans_handle *trans,
WARN_ON(!first_cow && level == 0); WARN_ON(!first_cow && level == 0);
node = rc->backref_cache.path[level]; node = rc->backref_cache.path[level];
BUG_ON(node->bytenr != buf->start &&
node->new_bytenr != buf->start); /*
* If node->bytenr != buf->start and node->new_bytenr !=
* buf->start then we've got the wrong backref node for what we
* expected to see here and the cache is incorrect.
*/
if (unlikely(node->bytenr != buf->start && node->new_bytenr != buf->start)) {
btrfs_err(fs_info,
"bytenr %llu was found but our backref cache was expecting %llu or %llu",
buf->start, node->bytenr, node->new_bytenr);
return -EUCLEAN;
}
btrfs_backref_drop_node_buffer(node); btrfs_backref_drop_node_buffer(node);
atomic_inc(&cow->refs); atomic_inc(&cow->refs);

View File

@@ -1469,7 +1469,7 @@ static int btrfs_fill_super(struct super_block *sb,
err = open_ctree(sb, fs_devices, (char *)data); err = open_ctree(sb, fs_devices, (char *)data);
if (err) { if (err) {
btrfs_err(fs_info, "open_ctree failed"); btrfs_err(fs_info, "open_ctree failed: %d", err);
return err; return err;
} }

View File

@@ -262,8 +262,10 @@ loop:
cur_trans = fs_info->running_transaction; cur_trans = fs_info->running_transaction;
if (cur_trans) { if (cur_trans) {
if (TRANS_ABORTED(cur_trans)) { if (TRANS_ABORTED(cur_trans)) {
const int abort_error = cur_trans->aborted;
spin_unlock(&fs_info->trans_lock); spin_unlock(&fs_info->trans_lock);
return cur_trans->aborted; return abort_error;
} }
if (btrfs_blocked_trans_types[cur_trans->state] & type) { if (btrfs_blocked_trans_types[cur_trans->state] & type) {
spin_unlock(&fs_info->trans_lock); spin_unlock(&fs_info->trans_lock);

View File

@@ -1364,7 +1364,28 @@ int begin_new_exec(struct linux_binprm * bprm)
set_dumpable(current->mm, SUID_DUMP_USER); set_dumpable(current->mm, SUID_DUMP_USER);
perf_event_exec(); perf_event_exec();
__set_task_comm(me, kbasename(bprm->filename), true);
/*
* If the original filename was empty, alloc_bprm() made up a path
* that will probably not be useful to admins running ps or similar.
* Let's fix it up to be something reasonable.
*/
if (bprm->comm_from_dentry) {
/*
* Hold RCU lock to keep the name from being freed behind our back.
* Use acquire semantics to make sure the terminating NUL from
* __d_alloc() is seen.
*
* Note, we're deliberately sloppy here. We don't need to care about
* detecting a concurrent rename and just want a terminated name.
*/
rcu_read_lock();
__set_task_comm(me, smp_load_acquire(&bprm->file->f_path.dentry->d_name.name),
true);
rcu_read_unlock();
} else {
__set_task_comm(me, kbasename(bprm->filename), true);
}
/* An exec changes our domain. We are no longer part of the thread /* An exec changes our domain. We are no longer part of the thread
group */ group */
@@ -1523,11 +1544,13 @@ static struct linux_binprm *alloc_bprm(int fd, struct filename *filename)
if (fd == AT_FDCWD || filename->name[0] == '/') { if (fd == AT_FDCWD || filename->name[0] == '/') {
bprm->filename = filename->name; bprm->filename = filename->name;
} else { } else {
if (filename->name[0] == '\0') if (filename->name[0] == '\0') {
bprm->fdpath = kasprintf(GFP_KERNEL, "/dev/fd/%d", fd); bprm->fdpath = kasprintf(GFP_KERNEL, "/dev/fd/%d", fd);
else bprm->comm_from_dentry = 1;
} else {
bprm->fdpath = kasprintf(GFP_KERNEL, "/dev/fd/%d/%s", bprm->fdpath = kasprintf(GFP_KERNEL, "/dev/fd/%d/%s",
fd, filename->name); fd, filename->name);
}
if (!bprm->fdpath) if (!bprm->fdpath)
goto out_free; goto out_free;

View File

@@ -42,7 +42,9 @@ struct linux_binprm {
* Set when errors can no longer be returned to the * Set when errors can no longer be returned to the
* original userspace. * original userspace.
*/ */
point_of_no_return:1; point_of_no_return:1,
/* Set when "comm" must come from the dentry. */
comm_from_dentry:1;
struct file *executable; /* Executable to pass to the interpreter */ struct file *executable; /* Executable to pass to the interpreter */
struct file *interpreter; struct file *interpreter;
struct file *file; struct file *file;

View File

@@ -716,7 +716,6 @@ struct mlx5_timer {
struct timecounter tc; struct timecounter tc;
u32 nominal_c_mult; u32 nominal_c_mult;
unsigned long overflow_period; unsigned long overflow_period;
struct delayed_work overflow_work;
}; };
struct mlx5_clock { struct mlx5_clock {

View File

@@ -405,7 +405,7 @@ static struct latched_seq clear_seq = {
/* record buffer */ /* record buffer */
#define LOG_ALIGN __alignof__(unsigned long) #define LOG_ALIGN __alignof__(unsigned long)
#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
#define LOG_BUF_LEN_MAX (u32)(1 << 31) #define LOG_BUF_LEN_MAX ((u32)1 << 31)
static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN);
static char *log_buf = __log_buf; static char *log_buf = __log_buf;
static u32 log_buf_len = __LOG_BUF_LEN; static u32 log_buf_len = __LOG_BUF_LEN;

View File

@@ -724,13 +724,15 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)
#endif #endif
#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING #ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
if (static_key_false((&paravirt_steal_rq_enabled))) { if (static_key_false((&paravirt_steal_rq_enabled))) {
steal = paravirt_steal_clock(cpu_of(rq)); u64 prev_steal;
steal = prev_steal = paravirt_steal_clock(cpu_of(rq));
steal -= rq->prev_steal_time_rq; steal -= rq->prev_steal_time_rq;
if (unlikely(steal > delta)) if (unlikely(steal > delta))
steal = delta; steal = delta;
rq->prev_steal_time_rq += steal; rq->prev_steal_time_rq = prev_steal;
delta -= steal; delta -= steal;
} }
#endif #endif

View File

@@ -1409,7 +1409,7 @@ config LOCKDEP_SMALL
config LOCKDEP_BITS config LOCKDEP_BITS
int "Bitsize for MAX_LOCKDEP_ENTRIES" int "Bitsize for MAX_LOCKDEP_ENTRIES"
depends on LOCKDEP && !LOCKDEP_SMALL depends on LOCKDEP && !LOCKDEP_SMALL
range 10 30 range 10 24
default 15 default 15
help help
Try increasing this value if you hit "BUG: MAX_LOCKDEP_ENTRIES too low!" message. Try increasing this value if you hit "BUG: MAX_LOCKDEP_ENTRIES too low!" message.
@@ -1425,7 +1425,7 @@ config LOCKDEP_CHAINS_BITS
config LOCKDEP_STACK_TRACE_BITS config LOCKDEP_STACK_TRACE_BITS
int "Bitsize for MAX_STACK_TRACE_ENTRIES" int "Bitsize for MAX_STACK_TRACE_ENTRIES"
depends on LOCKDEP && !LOCKDEP_SMALL depends on LOCKDEP && !LOCKDEP_SMALL
range 10 30 range 10 26
default 19 default 19
help help
Try increasing this value if you hit "BUG: MAX_STACK_TRACE_ENTRIES too low!" message. Try increasing this value if you hit "BUG: MAX_STACK_TRACE_ENTRIES too low!" message.
@@ -1433,7 +1433,7 @@ config LOCKDEP_STACK_TRACE_BITS
config LOCKDEP_STACK_TRACE_HASH_BITS config LOCKDEP_STACK_TRACE_HASH_BITS
int "Bitsize for STACK_TRACE_HASH_SIZE" int "Bitsize for STACK_TRACE_HASH_SIZE"
depends on LOCKDEP && !LOCKDEP_SMALL depends on LOCKDEP && !LOCKDEP_SMALL
range 10 30 range 10 26
default 14 default 14
help help
Try increasing this value if you need large MAX_STACK_TRACE_ENTRIES. Try increasing this value if you need large MAX_STACK_TRACE_ENTRIES.
@@ -1441,7 +1441,7 @@ config LOCKDEP_STACK_TRACE_HASH_BITS
config LOCKDEP_CIRCULAR_QUEUE_BITS config LOCKDEP_CIRCULAR_QUEUE_BITS
int "Bitsize for elements in circular_queue struct" int "Bitsize for elements in circular_queue struct"
depends on LOCKDEP depends on LOCKDEP
range 10 30 range 10 26
default 12 default 12
help help
Try increasing this value if you hit "lockdep bfs error:-1" warning due to __cq_enqueue() failure. Try increasing this value if you hit "lockdep bfs error:-1" warning due to __cq_enqueue() failure.

View File

@@ -5524,10 +5524,16 @@ static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev,
{ {
struct mgmt_rp_remove_adv_monitor rp; struct mgmt_rp_remove_adv_monitor rp;
struct mgmt_pending_cmd *cmd = data; struct mgmt_pending_cmd *cmd = data;
struct mgmt_cp_remove_adv_monitor *cp = cmd->param; struct mgmt_cp_remove_adv_monitor *cp;
if (status == -ECANCELED ||
cmd != pending_find(MGMT_OP_REMOVE_ADV_MONITOR, hdev))
return;
hci_dev_lock(hdev); hci_dev_lock(hdev);
cp = cmd->param;
rp.monitor_handle = cp->monitor_handle; rp.monitor_handle = cp->monitor_handle;
if (!status) if (!status)
@@ -5545,6 +5551,10 @@ static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev,
static int mgmt_remove_adv_monitor_sync(struct hci_dev *hdev, void *data) static int mgmt_remove_adv_monitor_sync(struct hci_dev *hdev, void *data)
{ {
struct mgmt_pending_cmd *cmd = data; struct mgmt_pending_cmd *cmd = data;
if (cmd != pending_find(MGMT_OP_REMOVE_ADV_MONITOR, hdev))
return -ECANCELED;
struct mgmt_cp_remove_adv_monitor *cp = cmd->param; struct mgmt_cp_remove_adv_monitor *cp = cmd->param;
u16 handle = __le16_to_cpu(cp->monitor_handle); u16 handle = __le16_to_cpu(cp->monitor_handle);

View File

@@ -2293,8 +2293,8 @@ static bool tipc_crypto_key_rcv(struct tipc_crypto *rx, struct tipc_msg *hdr)
keylen = ntohl(*((__be32 *)(data + TIPC_AEAD_ALG_NAME))); keylen = ntohl(*((__be32 *)(data + TIPC_AEAD_ALG_NAME)));
/* Verify the supplied size values */ /* Verify the supplied size values */
if (unlikely(size != keylen + sizeof(struct tipc_aead_key) || if (unlikely(keylen > TIPC_AEAD_KEY_SIZE_MAX ||
keylen > TIPC_AEAD_KEY_SIZE_MAX)) { size != keylen + sizeof(struct tipc_aead_key))) {
pr_debug("%s: invalid MSG_CRYPTO key size\n", rx->name); pr_debug("%s: invalid MSG_CRYPTO key size\n", rx->name);
goto exit; goto exit;
} }

View File

@@ -143,6 +143,9 @@ static ssize_t handle_policy_update(struct file *file,
char *buf, *p, *end; char *buf, *p, *end;
int err; int err;
if (len >= KMALLOC_MAX_SIZE)
return -EINVAL;
pol = kmalloc(sizeof(struct setid_ruleset), GFP_KERNEL); pol = kmalloc(sizeof(struct setid_ruleset), GFP_KERNEL);
if (!pol) if (!pol)
return -ENOMEM; return -ENOMEM;

View File

@@ -2664,7 +2664,7 @@ ssize_t tomoyo_write_control(struct tomoyo_io_buffer *head,
if (head->w.avail >= head->writebuf_size - 1) { if (head->w.avail >= head->writebuf_size - 1) {
const int len = head->writebuf_size * 2; const int len = head->writebuf_size * 2;
char *cp = kzalloc(len, GFP_NOFS); char *cp = kzalloc(len, GFP_NOFS | __GFP_NOWARN);
if (!cp) { if (!cp) {
error = -ENOMEM; error = -ENOMEM;

View File

@@ -227,7 +227,8 @@ static int rtattr_pack(struct nlmsghdr *nh, size_t req_sz,
attr->rta_len = RTA_LENGTH(size); attr->rta_len = RTA_LENGTH(size);
attr->rta_type = rta_type; attr->rta_type = rta_type;
memcpy(RTA_DATA(attr), payload, size); if (payload)
memcpy(RTA_DATA(attr), payload, size);
return 0; return 0;
} }