5.15.3-rc1 review
Subsystems (15)
Greg Kroah-Hartman
maintainerPATCH 232/917 ia64: dont do IA64_CMPXCHG_DEBUG without CONFIG_PRINTK
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit c15b5fc054c3d6c97e953617605235c5cb8ce979 ]
When CONFIG_PRINTK is not set, the CMPXCHG_BUGCHECK() macro calls _printk(), but _printk() is a static inline function, not available as an extern.
Since the purpose of the macro is to print the BUGCHECK info, make this config option depend on PRINTK.
Fixes multiple occurrences of this build error:
../include/linux/printk.h:208:5: error: static declaration of '_printk' follows non-static declaration
208 | int _printk(const char *s, ...)
| ^~~~~~~
In file included from ../arch/ia64/include/asm/cmpxchg.h:5, ../arch/ia64/include/uapi/asm/cmpxchg.h:146:28: note: previous declaration of '_printk' with type 'int(const char *, ...)'
146 | extern int _printk(const char *fmt, ...);
--- arch/ia64/Kconfig.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/ia64/Kconfig.debug +1 -1
@@ -39,7 +39,7 @@ config DISABLE_VHPT config IA64_DEBUG_CMPXCHG bool "Turn on compare-and-exchange bug checking (slow!)" - depends on DEBUG_KERNEL + depends on DEBUG_KERNEL && PRINTK help Selecting this option turns on bug checking for the IA-64 compare-and-exchange instructions. This is slow! Itaniums
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 430/917 net: intel: igc_ptp: fix build for UML
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 523994ba3ad1b7b55abe4a72e156897b5e2db825 ]
On a UML build, the igc_ptp driver uses CONFIG_X86_TSC for timestamp conversion. The function that is used is not available on UML builds, so have the function use the default system_counterval_t timestamp instead for UML builds.
Prevents this build error on UML:
../drivers/net/ethernet/intel/igc/igc_ptp.c: In function ?igc_device_tstamp_to_system?:../drivers/net/ethernet/intel/igc/igc_ptp.c:777:9: error: implicit declaration of function ?convert_art_ns_to_tsc? [-Werror=implicit-function-declaration]
return convert_art_ns_to_tsc(tstamp);../drivers/net/ethernet/intel/igc/igc_ptp.c:777:9: error: incompatible types when returning type ?int? but ?struct system_counterval_t? was expected
return convert_art_ns_to_tsc(tstamp);
--- drivers/net/ethernet/intel/igc/igc_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_ptp.c +1 -1
@@ -773,7 +773,7 @@ static bool igc_is_crosststamp_supported(struct igc_adapter *adapter)static struct system_counterval_t igc_device_tstamp_to_system (u64 tstamp) { -#if IS_ENABLED (CONFIG_X86_TSC ) +#if IS_ENABLED (CONFIG_X86_TSC ) && !defined(CONFIG_UML )return convert_art_ns_to_tsc (tstamp);#else return (struct system_counterval_t ) { };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 261/917 drm/msm: prevent NULL dereference in msm_gpu_crashstate_capture()
In reply to Greg Kroah-HartmanFrom: Tim Gardner <[email protected]>
[ Upstream commit b220c154832c5cd0df34cbcbcc19d7135c16e823 ]
Coverity complains of a possible NULL dereference:
CID 120718 (#1 of 1): Dereference null return value (NULL_RETURNS)
23. dereference: Dereferencing a pointer that might be NULL state->bos when calling msm_gpu_crashstate_get_bo. [show details]
301 msm_gpu_crashstate_get_bo(state, submit->bos[i].obj,
302 submit->bos[i].iova, submit->bos[i].flags);
Fix this by employing the same state->bos NULL check as is used in the next for loop.
--- drivers/gpu/drm/msm/msm_gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_gpu.c +1 -1
@@ -296,7 +296,7 @@ static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, state->bos =kcalloc (nr,sizeof (struct msm_gpu_state_bo ),GFP_KERNEL ); -for (i =0 ; i < submit->nr_bos; i++) { +for (i =0 ; state->bos && i < submit->nr_bos; i++) {if (should_dump (submit, i)) {msm_gpu_crashstate_get_bo (state, submit->bos[i].obj, submit->bos[i].iova, submit->bos[i].flags);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 350/917 drm/amd/display: Pass display_pipe_params_st as const in DML
In reply to Greg Kroah-HartmanFrom: Harry Wentland <[email protected]>
[ Upstream commit 22667e6ec6b2ce9ca706e9061660b059725d009c ]
[Why]
This neither needs to be on the stack nor passed by value to each function call. In fact, when building with clang it seems to break the Linux's default 1024 byte stack frame limit.
[How]
We can simply pass this as a const pointer.
This patch fixes these Coverity IDs
Addresses-Coverity-ID: 1424031: ("Big parameter passed by value")
Addresses-Coverity-ID: 1423970: ("Big parameter passed by value")
Addresses-Coverity-ID: 1423941: ("Big parameter passed by value")
Addresses-Coverity-ID: 1451742: ("Big parameter passed by value")
Addresses-Coverity-ID: 1451887: ("Big parameter passed by value")
Addresses-Coverity-ID: 1454146: ("Big parameter passed by value")
Addresses-Coverity-ID: 1454152: ("Big parameter passed by value")
Addresses-Coverity-ID: 1454413: ("Big parameter passed by value")
Addresses-Coverity-ID: 1466144: ("Big parameter passed by value")
Addresses-Coverity-ID: 1487237: ("Big parameter passed by value")
--- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 2 +- .../dc/dml/dcn20/display_rq_dlg_calc_20.c | 6 +- .../dc/dml/dcn20/display_rq_dlg_calc_20.h | 4 +- .../dc/dml/dcn20/display_rq_dlg_calc_20v2.c | 6 +- .../dc/dml/dcn20/display_rq_dlg_calc_20v2.h | 4 +- .../dc/dml/dcn21/display_rq_dlg_calc_21.c | 62 ++++++++-------- .../dc/dml/dcn21/display_rq_dlg_calc_21.h | 4 +- .../dc/dml/dcn30/display_rq_dlg_calc_30.c | 72 +++++++++---------- .../dc/dml/dcn30/display_rq_dlg_calc_30.h | 4 +- .../dc/dml/dcn31/display_rq_dlg_calc_31.c | 68 +++++++++--------- .../dc/dml/dcn31/display_rq_dlg_calc_31.h | 4 +- .../drm/amd/display/dc/dml/display_mode_lib.h | 4 +- 12 files changed, 120 insertions(+), 120 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +1 -1
@@ -3152,7 +3152,7 @@ void dcn20_calculate_dlg_params( context->bw_ctx.dml.funcs.rq_dlg_get_rq_reg (&context->bw_ctx.dml, &context->res_ctx.pipe_ctx[i].rq_regs, - pipes[pipe_idx].pipe); + &pipes[pipe_idx].pipe); pipe_idx++; } }
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c +3 -3
@@ -768,12 +768,12 @@ static void dml20_rq_dlg_get_rq_params(struct display_mode_lib *mode_lib,void dml20_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param) +const display_pipe_params_st *pipe_param) {display_rq_params_st rq_param = {0 };memset (rq_regs,0 ,sizeof (*rq_regs)); -dml20_rq_dlg_get_rq_params (mode_lib, &rq_param, pipe_param.src); +dml20_rq_dlg_get_rq_params (mode_lib, &rq_param, pipe_param->src);extract_rq_regs (mode_lib, rq_regs, rq_param);print__rq_regs_st (mode_lib, *rq_regs);
@@ -1549,7 +1549,7 @@ static void dml20_rq_dlg_get_dlg_params(struct display_mode_lib *mode_lib, void dml20_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.h +2 -2
@@ -43,7 +43,7 @@ struct display_mode_lib;void dml20_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param); +const display_pipe_params_st *pipe_param);// Function: dml_rq_dlg_get_dlg_reg
@@ -61,7 +61,7 @@ void dml20_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c +3 -3
@@ -768,12 +768,12 @@ static void dml20v2_rq_dlg_get_rq_params(struct display_mode_lib *mode_lib,void dml20v2_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param) +const display_pipe_params_st *pipe_param) {display_rq_params_st rq_param = {0 };memset (rq_regs,0 ,sizeof (*rq_regs)); -dml20v2_rq_dlg_get_rq_params (mode_lib, &rq_param, pipe_param.src); +dml20v2_rq_dlg_get_rq_params (mode_lib, &rq_param, pipe_param->src);extract_rq_regs (mode_lib, rq_regs, rq_param);print__rq_regs_st (mode_lib, *rq_regs);
@@ -1550,7 +1550,7 @@ static void dml20v2_rq_dlg_get_dlg_params(struct display_mode_lib *mode_lib, void dml20v2_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.h +2 -2
@@ -43,7 +43,7 @@ struct display_mode_lib;void dml20v2_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param); +const display_pipe_params_st *pipe_param);// Function: dml_rq_dlg_get_dlg_reg
@@ -61,7 +61,7 @@ void dml20v2_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c +31 -31
133 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.h +2 -2
@@ -44,7 +44,7 @@ struct display_mode_lib;void dml21_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param); +const display_pipe_params_st *pipe_param);// Function: dml_rq_dlg_get_dlg_reg // Calculate and return DLG and TTU register struct given the system setting
@@ -61,7 +61,7 @@ void dml21_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c +36 -36
144 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.h +2 -2
@@ -41,7 +41,7 @@ struct display_mode_lib;// See also: <display_rq_regs_st> void dml30_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param); +const display_pipe_params_st *pipe_param);// Function: dml_rq_dlg_get_dlg_reg // Calculate and return DLG and TTU register struct given the system setting
@@ -57,7 +57,7 @@ void dml30_rq_dlg_get_rq_reg(struct display_mode_lib *mode_lib, void dml30_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c +34 -34
133 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.h +2 -2
@@ -41,7 +41,7 @@ struct display_mode_lib;// See also: <display_rq_regs_st> void dml31_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param); +const display_pipe_params_st *pipe_param);// Function: dml_rq_dlg_get_dlg_reg // Calculate and return DLG and TTU register struct given the system setting
@@ -57,7 +57,7 @@ void dml31_rq_dlg_get_rq_reg(struct display_mode_lib *mode_lib, void dml31_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.h +2 -2
@@ -49,7 +49,7 @@ struct dml_funcs {struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
@@ -60,7 +60,7 @@ struct dml_funcs {void (*rq_dlg_get_rq_reg)(struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param); +const display_pipe_params_st *pipe_param);void (*recalculate)(struct display_mode_lib *mode_lib);void (*validate)(struct display_mode_lib *mode_lib); };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 429/917 net: fealnx: fix build for UML
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit cd2621d07d517473611b170c69beb6524c677740 ]
On i386, when builtin (not a loadable module), the fealnx driver inspects boot_cpu_data to see what CPU family it is running on, and then acts on that data. The "family" struct member (x86) does not exist when running on UML, so prevent that test and do the default action.
Prevents this build error on UML + i386:
../drivers/net/ethernet/fealnx.c: In function ‘netdev_open’:../drivers/net/ethernet/fealnx.c:861:19: error: ‘struct cpuinfo_um’ has no member named ‘x86’
--- drivers/net/ethernet/fealnx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/fealnx.c +1 -1
@@ -857,7 +857,7 @@ static int netdev_open(struct net_device *dev) np->bcrvalue |=0x04 ;/* big-endian */ #endif -#if defined(__i386__) && !defined(MODULE ) +#if defined(__i386__) && !defined(MODULE ) && !defined(CONFIG_UML )if (boot_cpu_data.x86 <=4 ) np->crvalue =0xa00 ;else
Signature · 9 lines
2.33.0 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Greg Kroah-Hartman
maintainerPATCH 431/917 net: tulip: winbond-840: fix build for UML
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit a3d708925fcca1a2f7219bc9ce93e6341f85c1e0 ]
On i386, when builtin (not a loadable module), the winbond-840 driver inspects boot_cpu_data to see what CPU family it is running on, and then acts on that data. The "family" struct member (x86) does not exist when running on UML, so prevent that test and do the default action.
Prevents this build error on UML + i386:
../drivers/net/ethernet/dec/tulip/winbond-840.c: In function ‘init_registers’:../drivers/net/ethernet/dec/tulip/winbond-840.c:882:19: error: ‘struct cpuinfo_um’ has no member named ‘x86’
if (boot_cpu_data.x86 <= 4) {
--- drivers/net/ethernet/dec/tulip/winbond-840.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/dec/tulip/winbond-840.c +1 -1
@@ -877,7 +877,7 @@ static void init_registers(struct net_device *dev)8000 16 longwords 0200 2 longwords 2000 32 longwords C000 32 longwords 0400 4 longwords */ -#if defined (__i386__) && !defined(MODULE ) +#if defined (__i386__) && !defined(MODULE ) && !defined(CONFIG_UML )/* When not a module we can work around broken '486 PCI boards. */ if (boot_cpu_data.x86 <=4 ) { i |=0x4800 ;
Signature · 9 lines
2.33.0 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Greg Kroah-Hartman
maintainerPATCH 445/917 media: ivtv: fix build for UML
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 6cb67bea945bdf0ad40e633cd2d9fbeb0855675b ]
Prevent the use of page table macros and types from 2 conflicting places. This fixes multiple build errors and warnings, e.g.:
../arch/x86/include/asm/pgtable_64_types.h:21:34: error: conflicting types for ‘pte_t’
typedef struct { pteval_t pte; } pte_t;
^~~~~
In file included from ../include/linux/mm_types_task.h:16:0,
from ../include/linux/mm_types.h:5,
from ../include/linux/buildid.h:5,
from ../include/linux/module.h:14,
from ../drivers/media/pci/ivtv/ivtv-driver.h:40,
from ../drivers/media/pci/ivtv/ivtvfb.c:29:../arch/um/include/asm/page.h:57:39: note: previous declaration of ‘pte_t’ was here
typedef struct { unsigned long pte; } pte_t;
../arch/x86/include/asm/pgtable_types.h:284:43: error: expected ‘)’ before ‘prot’
static inline pgprot_t pgprot_nx(pgprot_t prot)
^
../include/linux/pgtable.h:914:26: note: in definition of macro ‘pgprot_nx’
#define pgprot_nx(prot) (prot)
^~~~
In file included from ../arch/x86/include/asm/memtype.h:6:0,
from ../drivers/media/pci/ivtv/ivtvfb.c:40:../arch/x86/include/asm/pgtable_types.h:288:0: warning: "pgprot_nx" redefined
#define pgprot_nx pgprot_nx
../arch/x86/include/asm/page_types.h:11:0: warning: "PAGE_SIZE" redefined
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
In file included from ../include/linux/mm_types_task.h:16:0,
from ../include/linux/mm_types.h:5,
from ../include/linux/buildid.h:5,
from ../include/linux/module.h:14,
from ../drivers/media/pci/ivtv/ivtv-driver.h:40,
from ../drivers/media/pci/ivtv/ivtvfb.c:29:../arch/um/include/asm/page.h:14:0: note: this is the location of the previous definition
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
--- drivers/media/pci/ivtv/ivtvfb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/ivtv/ivtvfb.c +2 -2
@@ -36,7 +36,7 @@#include <linux/fb.h> #include <linux/ivtvfb.h> -#ifdef CONFIG_X86_64 +#if defined(CONFIG_X86_64 ) && !defined(CONFIG_UML )#include <asm/memtype.h> #endif
@@ -1157,7 +1157,7 @@ static int ivtvfb_init_card(struct ivtv *itv) {int rc; -#ifdef CONFIG_X86_64 +#if defined(CONFIG_X86_64 ) && !defined(CONFIG_UML )if (pat_enabled ()) {if (ivtvfb_force_pat) {pr_info ("PAT is enabled. Write-combined framebuffer caching will be disabled.\n" );
Signature · 9 lines
2.33.0 _______________________________________________ linux-um mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-um
Greg Kroah-Hartman
maintainerPATCH 629/917 usb: musb: select GENERIC_PHY instead of depending on it
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit fde1fbedbaed4e76cef4600d775b185f59b9b568 ]
The kconfig symbol GENERIC_PHY says:
All the users of this framework should select this config.
and around 136 out of 138 drivers do so, so change USB_MUSB_MEDIATEK to do so also.
This (also) fixes a long circular dependency problem for an upcoming patch.
--- drivers/usb/musb/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/musb/Kconfig +1 -1
@@ -120,7 +120,7 @@ config USB_MUSB_MEDIATEK tristate "MediaTek platforms" depends on ARCH_MEDIATEK || COMPILE_TEST depends on NOP_USB_XCEIV - depends on GENERIC_PHY + select GENERIC_PHY select USB_ROLE_SWITCH comment "MUSB DMA mode"
Signature · 9 lines
2.33.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Greg Kroah-Hartman
maintainerPATCH 636/917 ARM: dts: stm32: Reduce DHCOR SPI NOR frequency to 50 MHz
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 2012579b31293d0a8cf2024e9dab66810bf1a15e ]
The SPI NOR is a bit further away from the SoC on DHCOR than on DHCOM, which causes additional signal delay. At 108 MHz, this delay triggers a sporadic issue where the first bit of RX data is not received by the QSPI controller.
There are two options of addressing this problem, either by using the DLYB block to compensate the extra delay, or by reducing the QSPI bus clock frequency. The former requires calibration and that is overly complex, so opt for the second option.
--- arch/arm/boot/dts/stm32mp15xx-dhcor-som.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/stm32mp15xx-dhcor-som.dtsi +1 -1
@@ -202,7 +202,7 @@ compatible = "jedec,spi-nor"; reg = <0>; spi-rx-bus-width = <4>; - spi-max-frequency = <108000000>; + spi-max-frequency = <50000000>; #address-cells = <1>; #size-cells = <1>; };
Signature · 9 lines
2.33.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 743/917 m68k: set a default value for MEMORY_RESERVE
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 1aaa557b2db95c9506ed0981bc34505c32d6b62b ]
'make randconfig' can produce a .config file with "CONFIG_MEMORY_RESERVE=" (no value) since it has no default. When a subsequent 'make all' is done, kconfig restarts the config and prompts for a value for MEMORY_RESERVE. This breaks scripting/automation where there is no interactive user input.
Add a default value for MEMORY_RESERVE. (Any integer value will work here for kconfig.)
Fixes a kconfig warning:
.config:214:warning: symbol value '' invalid for MEMORY_RESERVE
* Restart config...
Memory reservation (MiB) (MEMORY_RESERVE) [] (NEW)
--- arch/m68k/Kconfig.machine | 1 + 1 file changed, 1 insertion(+)
arch/m68k/Kconfig.machine +1 -0
@@ -203,6 +203,7 @@ config INIT_LCD config MEMORY_RESERVE int "Memory reservation (MiB)" depends on (UCSIMM || UCDIMM) + default 0 help Reserve certain memory regions on 68x328 based boards.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 2/917 usb: xhci: Enable runtime-pm by default on AMD Yellow Carp platform
In reply to Greg Kroah-HartmanFrom: Nehal Bakulchandra Shah <[email protected]>
commit 660a92a59b9e831a0407e41ff62875656d30006e upstream.
AMD's Yellow Carp platform supports runtime power management for XHCI Controllers, so enable the same by default for all XHCI Controllers.
[ regrouped and aligned the PCI_DEVICE_ID definitions -Mathias]
--- drivers/usb/host/xhci-pci.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/usb/host/xhci-pci.c +16 -0
@@ -65,6 +65,13 @@#define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba#define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb#define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 0x161a +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 0x161b +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 0x161d +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 0x161e +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 0x15d6 +#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 0x15d7 +#define PCI_DEVICE_ID_ASMEDIA_1042_XHCI 0x1042#define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142#define PCI_DEVICE_ID_ASMEDIA_1142_XHCI 0x1242
@@ -317,6 +324,15 @@ static void xhci_pci_quirks(struct devic pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4)) xhci->quirks |= XHCI_NO_SOFT_RETRY; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && + (pdev->device ==PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 || + pdev->device ==PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 || + pdev->device ==PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 || + pdev->device ==PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 || + pdev->device ==PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 || + pdev->device ==PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 )) + xhci->quirks |=XHCI_DEFAULT_PM_RUNTIME_ALLOW ; +if (xhci->quirks &XHCI_RESET_ON_RESUME )xhci_dbg_trace (xhci, trace_xhci_dbg_quirks,"QUIRK: Resetting on resume" );
Greg Kroah-Hartman
maintainerPATCH 4/917 Input: elantench - fix misreporting trackpoint coordinates
In reply to Greg Kroah-HartmanFrom: Phoenix Huang <[email protected]>
commit be896bd3b72b44126c55768f14c22a8729b0992e upstream.
Some firmwares occasionally report bogus data from trackpoint, with X or Y displacement being too large (outside of [-127, 127] range). Let's drop such packets so that we do not generate jumps.
--- drivers/input/mouse/elantech.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/input/mouse/elantech.c +13 -0
@@ -517,6 +517,19 @@ static void elantech_report_trackpoint(scase 0x16008020U :case 0x26800010U :case 0x36808000U : + +/* +* This firmware misreport coordinates for trackpoint +* occasionally. Discard packets outside of [-127, 127] range +* to prevent cursor jumps. +*/ +if (packet[4 ] ==0x80 || packet[5 ] ==0x80 || + packet[1 ] >>7 == packet[4 ] >>7 || + packet[2 ] >>7 == packet[5 ] >>7 ) { +elantech_debug ("discarding packet [%6ph]\n" , packet); +break ; + + } x = packet[4 ] - (int )((packet[1 ]^0x80 ) <<1 ); y = (int )((packet[2 ]^0x80 ) <<1 ) - packet[5 ];
Greg Kroah-Hartman
maintainerPATCH 14/917 scsi: qla2xxx: Fix kernel crash when accessing port_speed sysfs file
In reply to Greg Kroah-HartmanFrom: Arun Easi <[email protected]>
commit 3ef68d4f0c9e7cb589ae8b70f07d77f528105331 upstream.
Kernel crashes when accessing port_speed sysfs file. The issue happens on a CNA when the local array was accessed beyond bounds. Fix this by changing the lookup.
BUG: unable to handle kernel paging request at 0000000000004000 PGD 0 P4D 0 Oops: 0000 [#1] SMP PTI CPU: 15 PID: 455213 Comm: sosreport Kdump: loaded Not tainted 4.18.0-305.7.1.el8_4.x86_64 #1 RIP: 0010:string_nocheck+0x12/0x70 Code: 00 00 4c 89 e2 be 20 00 00 00 48 89 ef e8 86 9a 00 00 4c 01 e3 eb 81 90 49 89 f2 48 89 ce 48 89 f8 48 c1 fe 30 66 85 f6 74 4f <44> 0f b6 0a 45 84 c9 74 46 83 ee 01 41 b8 01 00 00 00 48 8d 7c 37 RSP: 0018:ffffb5141c1afcf0 EFLAGS: 00010286 RAX: ffff8bf4009f8000 RBX: ffff8bf4009f9000 RCX: ffff0a00ffffff04 RDX: 0000000000004000 RSI: ffffffffffffffff RDI: ffff8bf4009f8000 RBP: 0000000000004000 R08: 0000000000000001 R09: ffffb5141c1afb84 R10: ffff8bf4009f9000 R11: ffffb5141c1afce6 R12: ffff0a00ffffff04 R13: ffffffffc08e21aa R14: 0000000000001000 R15: ffffffffc08e21aa FS: 00007fc4ebfff700(0000) GS:ffff8c717f7c0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000004000 CR3: 000000edfdee6006 CR4: 00000000001706e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: string+0x40/0x50 vsnprintf+0x33c/0x520 scnprintf+0x4d/0x90 qla2x00_port_speed_show+0xb5/0x100 [qla2xxx] dev_attr_show+0x1c/0x40 sysfs_kf_seq_show+0x9b/0x100 seq_read+0x153/0x410 vfs_read+0x91/0x140 ksys_read+0x4f/0xb0 do_syscall_64+0x5b/0x1a0 entry_SYSCALL_64_after_hwframe+0x65/0xca
--- drivers/scsi/qla2xxx/qla_attr.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +22 -2
@@ -1868,6 +1868,18 @@ qla2x00_port_speed_store(struct device *return strlen (buf); } +static const struct { +u16 rate; +char *str; +} port_speed_str[] = { + {PORT_SPEED_4GB ,"4" }, + {PORT_SPEED_8GB ,"8" }, + {PORT_SPEED_16GB ,"16" }, + {PORT_SPEED_32GB ,"32" }, + {PORT_SPEED_64GB ,"64" }, + {PORT_SPEED_10GB ,"10" }, +}; +static ssize_t qla2x00_port_speed_show (struct device *dev,struct device_attribute *attr,char *buf)
@@ -1875,7 +1887,8 @@ qla2x00_port_speed_show(struct device *dstruct scsi_qla_host *vha =shost_priv (dev_to_shost (dev));struct qla_hw_data *ha = vha->hw;ssize_t rval; -char *spd[7 ] = {"0" ,"0" ,"0" ,"4" ,"8" ,"16" ,"32" }; +u16 i; +char *speed ="Unknown" ; rval =qla2x00_get_data_rate (vha);if (rval !=QLA_SUCCESS ) {
@@ -1884,7 +1897,14 @@ qla2x00_port_speed_show(struct device *dreturn -EINVAL ; } -return scnprintf (buf,PAGE_SIZE ,"%s\n" , spd[ha->link_data_rate]); +for (i =0 ; i <ARRAY_SIZE (port_speed_str); i++) { +if (port_speed_str[i].rate != ha->link_data_rate) +continue ; + speed = port_speed_str[i].str; +break ; + } + +return scnprintf (buf,PAGE_SIZE ,"%s\n" , speed); } static ssize_t
Greg Kroah-Hartman
maintainerPATCH 16/917 ce/gf100: fix incorrect CE0 address calculation on some GPUs
In reply to Greg Kroah-HartmanFrom: Ben Skeggs <[email protected]>
commit 93f43ed81abec8c805e1b77eb1d20dbc51a24dc4 upstream.
The code which constructs the modules for each engine present on the GPU passes -1 for 'instance' on non-instanced engines, which affects how the name for a sub-device is generated. This is then stored as 'instance 0' in nvkm_subdev.inst, so code can potentially be shared with earlier GPUs that only had a single instance of an engine.
However, GF100's CE constructor uses this value to calculate the address of its falcon before it's translated, resulting in CE0 getting the wrong address.
This slightly modifies the approach, always passing a valid instance for engines that *can* have multiple copies, and having the code for earlier GPUs explicitly ask for non-instanced name generation.
--- drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c +1 -1
@@ -78,6 +78,6 @@ int gt215_ce_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_engine **pengine) { - return nvkm_falcon_new_(>215_ce, device, type, inst, + return nvkm_falcon_new_(>215_ce, device, type, -1, (device->chipset != 0xaf), 0x104000, pengine); }
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +1 -2
@@ -3147,8 +3147,7 @@ nvkm_device_ctor(const struct nvkm_devicWARN_ON (device->chip->ptr.inst & ~((1 <<ARRAY_SIZE (device->ptr)) -1 )); \for (j =0 ; device->chip->ptr.inst && j <ARRAY_SIZE (device->ptr); j++) { \if ((device->chip->ptr.inst &BIT (j)) && (subdev_mask &BIT_ULL (type))) { \ -int inst = (device->chip->ptr.inst ==1 ) ?-1 : (j); \ - ret = device->chip->ptr.ctor (device, (type), inst, &device->ptr[j]); \ + ret = device->chip->ptr.ctor (device, (type), (j), &device->ptr[j]); \ subdev =nvkm_device_subdev (device, (type), (j)); \if (ret) { \nvkm_subdev_del (&subdev); \
Greg Kroah-Hartman
maintainerPATCH 28/917 media: ite-cir: IR receiver stop working after receive overflow
In reply to Greg Kroah-HartmanFrom: Sean Young <[email protected]>
commit fdc881783099c6343921ff017450831c8766d12a upstream.
On an Intel NUC6iSYK, no IR is reported after a receive overflow.
When a receiver overflow occurs, this condition is only cleared by reading the fifo. Make sure we read anything in the fifo.
--- drivers/media/rc/ite-cir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/ite-cir.c +1 -1
@@ -242,7 +242,7 @@ static irqreturn_t ite_cir_isr(int irq, }/* check for the receive interrupt */ -if (iflags &ITE_IRQ_RX_FIFO ) { +if (iflags & (ITE_IRQ_RX_FIFO |ITE_IRQ_RX_FIFO_OVERRUN )) {/* read the FIFO bytes */ rx_bytes = dev->params->get_rx_bytes (dev, rx_buf,ITE_RX_FIFO_LEN );
Greg Kroah-Hartman
maintainerPATCH 34/917 ALSA: hda/realtek: Add quirk for Clevo PC70HS
In reply to Greg Kroah-HartmanFrom: Tim Crawford <[email protected]>
commit dbfe83507cf4ea66ce4efee2ac14c5ad420e31d3 upstream.
Apply the PB51ED PCI quirk to the Clevo PC70HS. Fixes audio output from the internal speakers.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -2539,6 +2539,7 @@ static const struct snd_pci_quirk alc882SND_PCI_QUIRK (0x1558 ,0x67d1 ,"Clevo PB71[ER][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK (0x1558 ,0x67e1 ,"Clevo PB71[DE][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK (0x1558 ,0x67e5 ,"Clevo PC70D[PRS](?:-D|-G)?" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ), +SND_PCI_QUIRK (0x1558 ,0x67f1 ,"Clevo PC70H[PRS]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK (0x1558 ,0x70d1 ,"Clevo PC70[ER][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK (0x1558 ,0x7714 ,"Clevo X170SM" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ), SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
Greg Kroah-Hartman
maintainerPATCH 35/917 ALSA: hda/realtek: Headset fixup for Clevo NH77HJQ
In reply to Greg Kroah-HartmanFrom: Jeremy Soller <[email protected]>
commit 1278cc5ac2f96bab50dd55c8c05e0a6a77ce323e upstream.
On Clevo NH77HJ, NH77HP, and their 15" variants, there is a headset microphone input attached to 0x19 that does not have a jack detect. In order to get it working, the pin configuration needs to be set correctly, and a new ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE fixup is applied. This is similar to the existing System76 quirk for ALC293, but for ALC256.
--- sound/pci/hda/patch_realtek.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
sound/pci/hda/patch_realtek.c +14 -0
@@ -6739,6 +6739,7 @@ enum {ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ,ALC287_FIXUP_13S_GEN2_SPEAKERS ,ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS , + ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE, }; static const struct hda_fixup alc269_fixups[] = {
@@ -8450,6 +8451,15 @@ static const struct hda_fixup alc269_fix .type = HDA_FIXUP_FUNC, .v.func = alc245_fixup_hp_gpio_led, }, + [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x19 ,0x03a11120 },/* use as headset mic, without its own jack detect */ + { } + }, + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, + }, };static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -8750,11 +8760,15 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1558 ,0x40a1 ,"Clevo NL40GU" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x40c1 ,"Clevo NL40[CZ]U" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x40d1 ,"Clevo NL41DU" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1558 ,0x5015 ,"Clevo NH5[58]H[HJK]Q" ,ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1558 ,0x5017 ,"Clevo NH7[79]H[HJK]Q" ,ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x50a3 ,"Clevo NJ51GU" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x50b3 ,"Clevo NK50S[BEZ]" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x50b6 ,"Clevo NK50S5" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x50b8 ,"Clevo NK50SZ" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x50d5 ,"Clevo NP50D5" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1558 ,0x50e1 ,"Clevo NH5[58]HPQ" ,ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1558 ,0x50e2 ,"Clevo NH7[79]HPQ" ,ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x50f0 ,"Clevo NH50A[CDF]" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1558 ,0x50f2 ,"Clevo NH50E[PR]" ,ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Greg Kroah-Hartman
maintainerPATCH 3/917 Input: iforce - fix control-message timeout
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 744d0090a5f6dfa4c81b53402ccdf08313100429 upstream.
USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ.
--- drivers/input/joystick/iforce/iforce-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/joystick/iforce/iforce-usb.c +1 -1
@@ -92,7 +92,7 @@ static int iforce_usb_get_id(struct ifor id,USB_TYPE_VENDOR |USB_DIR_IN |USB_RECIP_INTERFACE , - 0, 0, buf, IFORCE_MAX_LENGTH, HZ); + 0, 0, buf, IFORCE_MAX_LENGTH, 1000);if (status <0 ) {dev_err (&iforce_usb->intf->dev,"usb_submit_urb failed: %d\n" , status);
Greg Kroah-Hartman
maintainerPATCH 7/917 ocfs2: fix data corruption on truncate
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 839b63860eb3835da165642923120d305925561d upstream.
Patch series "ocfs2: Truncate data corruption fix".
As further testing has shown, commit 5314454ea3f ("ocfs2: fix data corruption after conversion from inline format") didn't fix all the data corruption issues the customer started observing after 6dbf7bb55598 ("fs: Don't invalidate page buffers in block_write_full_page()") This time I have tracked them down to two bugs in ocfs2 truncation code.
One bug (truncating page cache before clearing tail cluster and setting i_size) could cause data corruption even before 6dbf7bb55598, but before that commit it needed a race with page fault, after 6dbf7bb55598 it started to be pretty deterministic.
Another bug (zeroing pages beyond old i_size) used to be harmless inefficiency before commit 6dbf7bb55598. But after commit 6dbf7bb55598 in combination with the first bug it resulted in deterministic data corruption.
Although fixing only the first problem is needed to stop data corruption, I've fixed both issues to make the code more robust.
This patch (of 2):
ocfs2_truncate_file() did unmap invalidate page cache pages before zeroing partial tail cluster and setting i_size. Thus some pages could be left (and likely have left if the cluster zeroing happened) in the page cache beyond i_size after truncate finished letting user possibly see stale data once the file was extended again. Also the tail cluster zeroing was not guaranteed to finish before truncate finished causing possible stale data exposure. The problem started to be particularly easy to hit after commit 6dbf7bb55598 "fs: Don't invalidate page buffers in block_write_full_page()" stopped invalidation of pages beyond i_size from page writeback path.
Fix these problems by unmapping and invalidating pages in the page cache after the i_size is reduced and tail cluster is zeroed out.
--- fs/ocfs2/file.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/ocfs2/file.c +6 -2
@@ -476,10 +476,11 @@ int ocfs2_truncate_file(struct inode *in* greater than page size, so we have to truncate them * anyway. */ -unmap_mapping_range (inode->i_mapping, new_i_size +PAGE_SIZE -1 ,0 ,1 ); -truncate_inode_pages (inode->i_mapping, new_i_size);if (OCFS2_I (inode)->ip_dyn_features &OCFS2_INLINE_DATA_FL ) { +unmap_mapping_range (inode->i_mapping, + new_i_size +PAGE_SIZE -1 ,0 ,1 ); +truncate_inode_pages (inode->i_mapping, new_i_size); status =ocfs2_truncate_inline (inode, di_bh, new_i_size,i_size_read (inode),1 );if (status)
@@ -498,6 +499,9 @@ int ocfs2_truncate_file(struct inode *in goto bail_unlock_sem; } +unmap_mapping_range (inode->i_mapping, new_i_size +PAGE_SIZE -1 ,0 ,1 ); +truncate_inode_pages (inode->i_mapping, new_i_size); + status =ocfs2_commit_truncate (osb, inode, di_bh);if (status <0 ) {mlog_errno (status);
Greg Kroah-Hartman
maintainerPATCH 9/917 scsi: core: Avoid leaving shost->last_reset with stale value if EH does not run
In reply to Greg Kroah-HartmanFrom: Ewan D. Milne <[email protected]>
commit 5ae17501bc62a49b0b193dcce003f16375f16654 upstream.
The changes to issue the abort from the scmd->abort_work instead of the EH thread introduced a problem if eh_deadline is used. If aborting the command(s) is successful, and there are never any scmds added to the shost->eh_cmd_q, there is no code path which will reset the ->last_reset value back to zero.
The effect of this is that after a successful abort with no EH thread activity, a subsequent timeout, perhaps a long time later, might immediately be considered past a user-set eh_deadline time, and the host will be reset with no attempt at recovery.
Fix this by resetting ->last_reset back to zero in scmd_eh_abort_handler() if it is determined that the EH thread will not run to do this.
Thanks to Gopinath Marappan for investigating this problem.
--- drivers/scsi/hosts.c | 1 + drivers/scsi/scsi_error.c | 25 +++++++++++++++++++++++++ drivers/scsi/scsi_lib.c | 1 + include/scsi/scsi_cmnd.h | 2 +- include/scsi/scsi_host.h | 1 + 5 files changed, 29 insertions(+), 1 deletion(-)
drivers/scsi/hosts.c +1 -0
@@ -388,6 +388,7 @@ struct Scsi_Host *scsi_host_alloc(struct shost->shost_state =SHOST_CREATED ;INIT_LIST_HEAD (&shost->__devices);INIT_LIST_HEAD (&shost->__targets); +INIT_LIST_HEAD (&shost->eh_abort_list);INIT_LIST_HEAD (&shost->eh_cmd_q);INIT_LIST_HEAD (&shost->starved_list);init_waitqueue_head (&shost->host_wait);
drivers/scsi/scsi_error.c +25 -0
@@ -135,6 +135,23 @@ static bool scsi_eh_should_retry_cmd(strreturn true; } +static void scsi_eh_complete_abort (struct scsi_cmnd *scmd,struct Scsi_Host *shost) +{ +unsigned long flags; + +spin_lock_irqsave (shost->host_lock, flags); +list_del_init (&scmd->eh_entry); +/* +* If the abort succeeds, and there is no further +* EH action, clear the ->last_reset time. +*/ +if (list_empty (&shost->eh_abort_list) && +list_empty (&shost->eh_cmd_q)) +if (shost->eh_deadline !=-1 ) + shost->last_reset =0 ; +spin_unlock_irqrestore (shost->host_lock, flags); +} +/** * scmd_eh_abort_handler - Handle command aborts * @work: command to be aborted.
@@ -152,6 +169,7 @@ scmd_eh_abort_handler(struct work_struct container_of(work, struct scsi_cmnd, abort_work.work);struct scsi_device *sdev = scmd->device;enum scsi_disposition rtn; +unsigned long flags;if (scsi_host_eh_past_deadline (sdev->host)) { SCSI_LOG_ERROR_RECOVERY(3,
@@ -175,12 +193,14 @@ scmd_eh_abort_handler(struct work_structSCSI_LOG_ERROR_RECOVERY (3 ,scmd_printk (KERN_WARNING , scmd,"retry aborted command\n" )); +scsi_eh_complete_abort (scmd, sdev->host);scsi_queue_insert (scmd,SCSI_MLQUEUE_EH_RETRY );return ; }else {SCSI_LOG_ERROR_RECOVERY (3 ,scmd_printk (KERN_WARNING , scmd,"finish aborted command\n" )); +scsi_eh_complete_abort (scmd, sdev->host);scsi_finish_command (scmd);return ; }
@@ -193,6 +213,9 @@ scmd_eh_abort_handler(struct work_struct } } +spin_lock_irqsave (sdev->host->host_lock, flags); +list_del_init (&scmd->eh_entry); +spin_unlock_irqrestore (sdev->host->host_lock, flags);scsi_eh_scmd_add (scmd); }
@@ -223,6 +246,8 @@ scsi_abort_command(struct scsi_cmnd *scmspin_lock_irqsave (shost->host_lock, flags);if (shost->eh_deadline !=-1 && !shost->last_reset) shost->last_reset = jiffies; +BUG_ON (!list_empty (&scmd->eh_entry)); +list_add_tail (&scmd->eh_entry, &shost->eh_abort_list);spin_unlock_irqrestore (shost->host_lock, flags); scmd->eh_eflags |=SCSI_EH_ABORT_SCHEDULED ;
drivers/scsi/scsi_lib.c +1 -0
@@ -1143,6 +1143,7 @@ void scsi_init_command(struct scsi_devic cmd->sense_buffer = buf; cmd->prot_sdb = prot; cmd->flags = flags; +INIT_LIST_HEAD (&cmd->eh_entry);INIT_DELAYED_WORK (&cmd->abort_work, scmd_eh_abort_handler); cmd->jiffies_at_alloc = jiffies_at_alloc; cmd->retries = retries;
include/scsi/scsi_cmnd.h +1 -1
@@ -68,7 +68,7 @@ struct scsi_pointer {struct scsi_cmnd {struct scsi_request req;struct scsi_device *device; -struct list_head eh_entry;/* entry for the host eh_cmd_q */ +struct list_head eh_entry;/* entry for the host eh_abort_list/eh_cmd_q */ struct delayed_work abort_work;struct rcu_head rcu;
include/scsi/scsi_host.h +1 -0
@@ -556,6 +556,7 @@ struct Scsi_Host {struct mutex scan_mutex;/* serialize scanning activity */ +struct list_head eh_abort_list;struct list_head eh_cmd_q;struct task_struct * ehandler;/* Error recovery thread. */ struct completion * eh_action;/* Wait for specific actions on the
Greg Kroah-Hartman
maintainerPATCH 19/917 mmc: dw_mmc: Dont wait for DRTO on Write RSP error
In reply to Greg Kroah-HartmanFrom: Christian Löhle <[email protected]>
commit 43592c8736e84025d7a45e61a46c3fa40536a364 upstream.
Only wait for DRTO on reads, otherwise the driver hangs.
The driver prevents sending CMD12 on response errors like CRCs. According to the comment this is because some cards have problems with this during the UHS tuning sequence. Unfortunately this workaround currently also applies for any command with data. On reads this will set the drto timer, which then triggers after a while. On writes this will not set any timer and the tasklet will not be scheduled again.
I cannot test for the UHS workarounds need, but even if so, it should at most apply to reads. I have observed many hangs when CMD25 response contained a CRC error. This patch fixes this without touching the actual UHS tuning workaround.
--- drivers/mmc/host/dw_mmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/dw_mmc.c +2 -1
@@ -2086,7 +2086,8 @@ static void dw_mci_tasklet_func(struct t* delayed. Allowing the transfer to take place * avoids races and keeps things simple. */ -if (err != -ETIMEDOUT ) { +if (err != -ETIMEDOUT && + host->dir_status ==DW_MCI_RECV_STATUS ) { state =STATE_SENDING_DATA ;continue ; }
Greg Kroah-Hartman
maintainerPATCH 21/917 io-wq: remove worker to owner tw dependency
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
commit 1d5f5ea7cb7d15b9fb1cc82673ebb054f02cd7d2 upstream.
INFO: task iou-wrk-6609:6612 blocked for more than 143 seconds.
Not tainted 5.15.0-rc5-syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:iou-wrk-6609 state:D stack:27944 pid: 6612 ppid: 6526 flags:0x00004006
Call Trace:
context_switch kernel/sched/core.c:4940 [inline]
__schedule+0xb44/0x5960 kernel/sched/core.c:6287
schedule+0xd3/0x270 kernel/sched/core.c:6366
schedule_timeout+0x1db/0x2a0 kernel/time/timer.c:1857
do_wait_for_common kernel/sched/completion.c:85 [inline]
__wait_for_common kernel/sched/completion.c:106 [inline]
wait_for_common kernel/sched/completion.c:117 [inline]
wait_for_completion+0x176/0x280 kernel/sched/completion.c:138
io_worker_exit fs/io-wq.c:183 [inline]
io_wqe_worker+0x66d/0xc40 fs/io-wq.c:597
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295io-wq worker may submit a task_work to the master task and upon io_worker_exit() wait for the tw to get executed. The problem appears when the master task is waiting in coredump.c:
468 freezer_do_not_count(); 469 wait_for_completion(&core_state->startup); 470 freezer_count();
Apparently having some dependency on children threads getting everything stuck. Workaround it by cancelling the taks_work callback that causes it before going into io_worker_exit() waiting.
p.s. probably a better option is to not submit tw elevating the refcount in the first place, but let's leave this excercise for the future.
--- fs/io-wq.c | 46 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-)
fs/io-wq.c +37 -9
@@ -140,6 +140,7 @@ static void io_wqe_dec_running(struct iostatic bool io_acct_cancel_pending_work (struct io_wqe *wqe,struct io_wqe_acct *acct,struct io_cb_cancel_data *match); +static void create_worker_cb (struct callback_head *cb);static bool io_worker_get (struct io_worker *worker) {
@@ -174,9 +175,44 @@ static void io_worker_ref_put(struct io_complete (&wq->worker_done); } +static void io_worker_cancel_cb (struct io_worker *worker) +{ +struct io_wqe_acct *acct =io_wqe_get_acct (worker); +struct io_wqe *wqe = worker->wqe; +struct io_wq *wq = wqe->wq; + +atomic_dec (&acct->nr_running); +raw_spin_lock (&worker->wqe->lock); + acct->nr_workers--; +raw_spin_unlock (&worker->wqe->lock); +io_worker_ref_put (wq); +clear_bit_unlock (0 , &worker->create_state); +io_worker_release (worker); +} + +static bool io_task_worker_match (struct callback_head *cb,void *data) +{ +struct io_worker *worker; + +if (cb->func != create_worker_cb) +return false; + worker = container_of(cb, struct io_worker, create_work); +return worker == data; +} +static void io_worker_exit (struct io_worker *worker) {struct io_wqe *wqe = worker->wqe; +struct io_wq *wq = wqe->wq; + +while (1 ) { +struct callback_head *cb =task_work_cancel_match (wq->task, + io_task_worker_match, worker); + +if (!cb) +break ; +io_worker_cancel_cb (worker); + }if (refcount_dec_and_test (&worker->ref))complete (&worker->ref_done);
@@ -1150,17 +1186,9 @@ static void io_wq_exit_workers(struct iowhile ((cb =task_work_cancel_match (wq->task, io_task_work_match, wq)) !=NULL ) {struct io_worker *worker; -struct io_wqe_acct *acct; worker = container_of(cb, struct io_worker, create_work); - acct =io_wqe_get_acct (worker); -atomic_dec (&acct->nr_running); -raw_spin_lock (&worker->wqe->lock); - acct->nr_workers--; -raw_spin_unlock (&worker->wqe->lock); -io_worker_ref_put (wq); -clear_bit_unlock (0 , &worker->create_state); -io_worker_release (worker); +io_worker_cancel_cb (worker); }rcu_read_lock ();
Greg Kroah-Hartman
maintainerPATCH 29/917 media: rkvdec: Support dynamic resolution changes
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
commit 0887e9e152efbd3601d6c907e90033d25067277d upstream.
The mem-to-mem stateless decoder API specifies support for dynamic resolution changes. In particular, the decoder should accept format changes on the OUTPUT queue even when buffers have been allocated, as long as it is not streaming.
Relax restrictions for S_FMT as described in the previous paragraph, and as long as the codec format remains the same. This aligns it with the Hantro and Cedrus decoders. This change was mostly based on commit ae02d49493b5 ("media: hantro: Fix s_fmt for dynamic resolution changes").
Since rkvdec_s_fmt() is now just a wrapper around the output/capture variants without any additional shared functionality, drop the wrapper and call the respective functions directly.
--- drivers/staging/media/rkvdec/rkvdec.c | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/staging/media/rkvdec/rkvdec.c +20 -20
@@ -280,31 +280,20 @@ static int rkvdec_try_output_fmt(structreturn 0 ; } -static int rkvdec_s_fmt (struct file *file,void *priv, -struct v4l2_format *f, -int (*try_fmt)(struct file *,void *, -struct v4l2_format *)) +static int rkvdec_s_capture_fmt (struct file *file,void *priv, +struct v4l2_format *f) {struct rkvdec_ctx *ctx =fh_to_rkvdec_ctx (priv);struct vb2_queue *vq; +int ret; -if (!try_fmt) -return -EINVAL ; - - vq =v4l2_m2m_get_vq (ctx->fh.m2m_ctx, f->type); +/* Change not allowed if queue is busy */ + vq =v4l2_m2m_get_vq (ctx->fh.m2m_ctx, +V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE );if (vb2_is_busy (vq))return -EBUSY ; -return try_fmt (file, priv, f); -} - -static int rkvdec_s_capture_fmt (struct file *file,void *priv, -struct v4l2_format *f) -{ -struct rkvdec_ctx *ctx =fh_to_rkvdec_ctx (priv); -int ret; - - ret =rkvdec_s_fmt (file, priv, f, rkvdec_try_capture_fmt); + ret =rkvdec_try_capture_fmt (file, priv, f);if (ret)return ret;
@@ -319,10 +308,21 @@ static int rkvdec_s_output_fmt(struct fistruct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx;const struct rkvdec_coded_fmt_desc *desc;struct v4l2_format *cap_fmt; -struct vb2_queue *peer_vq; +struct vb2_queue *peer_vq, *vq;int ret;/* +* In order to support dynamic resolution change, the decoder admits +* a resolution change, as long as the pixelformat remains. Can't be +* done if streaming. +*/ + vq =v4l2_m2m_get_vq (m2m_ctx,V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ); +if (vb2_is_streaming (vq) || + (vb2_is_busy (vq) && + f->fmt.pix_mp.pixelformat != ctx->coded_fmt.fmt.pix_mp.pixelformat)) +return -EBUSY ; + +/* * Since format change on the OUTPUT queue will reset the CAPTURE * queue, we can't allow doing so when the CAPTURE queue has buffers * allocated.
@@ -331,7 +331,7 @@ static int rkvdec_s_output_fmt(struct fiif (vb2_is_busy (peer_vq))return -EBUSY ; - ret =rkvdec_s_fmt (file, priv, f, rkvdec_try_output_fmt); + ret =rkvdec_try_output_fmt (file, priv, f);if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 30/917 media: ir-kbd-i2c: improve responsiveness of hauppauge zilog receivers
In reply to Greg Kroah-HartmanFrom: Sean Young <[email protected]>
commit c73ba202a851c0b611ef2c25e568fadeff5e667f upstream.
The IR receiver has two issues:
- Sometimes there is no response to a button press
- Sometimes a button press is repeated when it should not have been
Hanging the polling interval fixes this behaviour.
--- drivers/media/i2c/ir-kbd-i2c.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/i2c/ir-kbd-i2c.c +1 -0
@@ -791,6 +791,7 @@ static int ir_probe(struct i2c_client *c rc_proto =RC_PROTO_BIT_RC5 |RC_PROTO_BIT_RC6_MCE |RC_PROTO_BIT_RC6_6A_32 ; ir_codes =RC_MAP_HAUPPAUGE ; + ir->polling_interval =125 ; probe_tx = true;break ; }
Greg Kroah-Hartman
maintainerPATCH 33/917 ALSA: hda/realtek: Add a quirk for HP OMEN 15 mute LED
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 375f8426ed994addd2be4d76febc946a6fdd8280 upstream.
HP OMEN 15 laptop requires the quirk to fiddle with COEF 0x0b bit 2 for toggling the mute LED. It's already implemented for other HP laptops, and we just need to add a proper fixup entry.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -8634,6 +8634,7 @@ static const struct snd_pci_quirk alc269 ALC285_FIXUP_HP_GPIO_AMP_INIT),SND_PCI_QUIRK (0x103c ,0x8783 ,"HP ZBook Fury 15 G7 Mobile Workstation" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ), +SND_PCI_QUIRK (0x103c ,0x8788 ,"HP OMEN 15" ,ALC285_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x103c ,0x87c8 ,"HP" ,ALC287_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x87e5 ,"HP ProBook 440 G8 Notebook PC" ,ALC236_FIXUP_HP_GPIO_LED ), SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Greg Kroah-Hartman
maintainerPATCH 37/917 ALSA: hda/realtek: Add quirk for ASUS UX550VE
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 4fad4fb9871b43389e4f4bead18ec693064697bb upstream.
ASUS UX550VE (SSID 1043:1970) requires a similar workaround for managing the routing of the 4 speakers like some other ASUS models. Add a corresponding quirk entry for fixing it.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -8698,6 +8698,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1043 ,0x18b1 ,"Asus MJ401TA" ,ALC256_FIXUP_ASUS_HEADSET_MIC ),SND_PCI_QUIRK (0x1043 ,0x18f1 ,"Asus FX505DT" ,ALC256_FIXUP_ASUS_HEADSET_MIC ),SND_PCI_QUIRK (0x1043 ,0x194e ,"ASUS UX563FD" ,ALC294_FIXUP_ASUS_HPE ), +SND_PCI_QUIRK (0x1043 ,0x1970 ,"ASUS UX550VE" ,ALC289_FIXUP_ASUS_GA401 ),SND_PCI_QUIRK (0x1043 ,0x1982 ,"ASUS B1400CEPE" ,ALC256_FIXUP_ASUS_HPE ),SND_PCI_QUIRK (0x1043 ,0x19ce ,"ASUS B9450FA" ,ALC294_FIXUP_ASUS_HPE ), SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Greg Kroah-Hartman
maintainerPATCH 42/917 ALSA: mixer: oss: Fix racy access to slots
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 411cef6adfb38a5bb6bd9af3941b28198e7fb680 upstream.
The OSS mixer can reassign the mapping slots dynamically via proc file. Although the addition and deletion of those slots are protected by mixer->reg_mutex, the access to slots aren't, hence this may cause UAF when the slots in use are deleted concurrently.
This patch applies the mixer->reg_mutex in all appropriate code paths (i.e. the ioctl functions) that may access slots.
--- sound/core/oss/mixer_oss.c | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-)
sound/core/oss/mixer_oss.c +33 -11
@@ -130,11 +130,13 @@ static int snd_mixer_oss_devmask(structif (mixer ==NULL )return -EIO ; +mutex_lock (&mixer->reg_mutex);for (chn =0 ; chn <31 ; chn++) { pslot = &mixer->slots[chn];if (pslot->put_volume || pslot->put_recsrc) result |=1 << chn; } +mutex_unlock (&mixer->reg_mutex);return result; }
@@ -146,11 +148,13 @@ static int snd_mixer_oss_stereodevs(struif (mixer ==NULL )return -EIO ; +mutex_lock (&mixer->reg_mutex);for (chn =0 ; chn <31 ; chn++) { pslot = &mixer->slots[chn];if (pslot->put_volume && pslot->stereo) result |=1 << chn; } +mutex_unlock (&mixer->reg_mutex);return result; }
@@ -161,6 +165,7 @@ static int snd_mixer_oss_recmask(structif (mixer ==NULL )return -EIO ; +mutex_lock (&mixer->reg_mutex);if (mixer->put_recsrc && mixer->get_recsrc) {/* exclusive */ result = mixer->mask_recsrc; }else {
@@ -172,6 +177,7 @@ static int snd_mixer_oss_recmask(struct result |=1 << chn; } } +mutex_unlock (&mixer->reg_mutex);return result; }
@@ -182,12 +188,12 @@ static int snd_mixer_oss_get_recsrc(struif (mixer ==NULL )return -EIO ; +mutex_lock (&mixer->reg_mutex);if (mixer->put_recsrc && mixer->get_recsrc) {/* exclusive */ -int err;unsigned int index; - err = mixer->get_recsrc (fmixer, &index); -if (err <0 ) -return err; + result = mixer->get_recsrc (fmixer, &index); +if (result <0 ) + goto unlock; result =1 << index; }else {struct snd_mixer_oss_slot *pslot;
@@ -202,7 +208,10 @@ static int snd_mixer_oss_get_recsrc(stru } } } -return mixer->oss_recsrc = result; + mixer->oss_recsrc = result; + unlock: +mutex_unlock (&mixer->reg_mutex); +return result; }static int snd_mixer_oss_set_recsrc (struct snd_mixer_oss_file *fmixer,int recsrc)
@@ -215,6 +224,7 @@ static int snd_mixer_oss_set_recsrc(struif (mixer ==NULL )return -EIO ; +mutex_lock (&mixer->reg_mutex);if (mixer->get_recsrc && mixer->put_recsrc) {/* exclusive input */ if (recsrc & ~mixer->oss_recsrc) recsrc &= ~mixer->oss_recsrc;
@@ -240,6 +250,7 @@ static int snd_mixer_oss_set_recsrc(stru } } } +mutex_unlock (&mixer->reg_mutex);return result; }
@@ -251,6 +262,7 @@ static int snd_mixer_oss_get_volume(struif (mixer ==NULL || slot >30 )return -EIO ; +mutex_lock (&mixer->reg_mutex); pslot = &mixer->slots[slot]; left = pslot->volume[0 ]; right = pslot->volume[1 ];
@@ -258,15 +270,21 @@ static int snd_mixer_oss_get_volume(stru result = pslot->get_volume (fmixer, pslot, &left, &right);if (!pslot->stereo) right = left; -if (snd_BUG_ON (left <0 || left >100 )) -return -EIO ; -if (snd_BUG_ON (right <0 || right >100 )) -return -EIO ; +if (snd_BUG_ON (left <0 || left >100 )) { + result = -EIO ; + goto unlock; + } +if (snd_BUG_ON (right <0 || right >100 )) { + result = -EIO ; + goto unlock; + }if (result >=0 ) { pslot->volume[0 ] = left; pslot->volume[1 ] = right; result = (left &0xff ) | ((right &0xff ) <<8 ); } + unlock: +mutex_unlock (&mixer->reg_mutex);return result; }
@@ -279,6 +297,7 @@ static int snd_mixer_oss_set_volume(struif (mixer ==NULL || slot >30 )return -EIO ; +mutex_lock (&mixer->reg_mutex); pslot = &mixer->slots[slot];if (left >100 ) left =100 ;
@@ -289,10 +308,13 @@ static int snd_mixer_oss_set_volume(struif (pslot->put_volume) result = pslot->put_volume (fmixer, pslot, left, right);if (result <0 ) -return result; + goto unlock; pslot->volume[0 ] = left; pslot->volume[1 ] = right; -return (left &0xff ) | ((right &0xff ) <<8 ); + result = (left &0xff ) | ((right &0xff ) <<8 ); + unlock: +mutex_lock (&mixer->reg_mutex); +return result; }static int snd_mixer_oss_ioctl1 (struct snd_mixer_oss_file *fmixer,unsigned int cmd,unsigned long arg)
Greg Kroah-Hartman
maintainerPATCH 43/917 ALSA: mixer: fix deadlock in snd_mixer_oss_set_volume
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
commit 3ab7992018455ac63c33e9b3eaa7264e293e40f4 upstream.
In commit 411cef6adfb3 ("ALSA: mixer: oss: Fix racy access to slots") added mutex protection in snd_mixer_oss_set_volume(). Second mutex_lock() in same function looks like typo, fix it.
--- sound/core/oss/mixer_oss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/oss/mixer_oss.c +1 -1
@@ -313,7 +313,7 @@ static int snd_mixer_oss_set_volume(stru pslot->volume[1 ] = right; result = (left &0xff ) | ((right &0xff ) <<8 ); unlock: -mutex_lock (&mixer->reg_mutex); +mutex_unlock (&mixer->reg_mutex);return result; }
Greg Kroah-Hartman
maintainerPATCH 46/917 ALSA: hda: Free card instance properly at probe errors
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 39173303c83859723dab32c2abfb97296d6af3bf upstream.
The recent change in hda-intel driver to allow repeated probes surfaced a problem that has been hidden until; the probe process in the work calls azx_free() at the error path, and this skips the card free process that eventually releases codec instances. As a result, we get a kernel WARNING like:
snd_hda_intel 0000:00:1f.3: Cannot probe codecs, giving up
------------[ cut here ]------------ WARNING: CPU: 14 PID: 186 at sound/hda/hdac_bus.c:73 ....
For fixing this, we need to call snd_card_free() instead of azx_free(). Additionally, the device drvdata has to be cleared, as the driver binding itself is still active. Then the PM and other driver callbacks will ignore the procedure.
--- sound/pci/hda/hda_intel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/hda_intel.c +2 -1
@@ -2330,7 +2330,8 @@ static int azx_probe_continue(struct azx out_free:if (err <0 ) { -azx_free (chip); +pci_set_drvdata (pci,NULL ); +snd_card_free (chip->card);return err; }
Greg Kroah-Hartman
maintainerPATCH 49/917 ALSA: PCM: Fix NULL dereference at mmap checks
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 8e537d5dec34cac746dd6abf6a83e5de3aa471fc upstream.
The recent refactoring of mmap handling caused Oops on some devices that don't use the standard memory allocations. This patch addresses it by allowing snd_dma_buffer_mmap() helper to receive the NULL pointer dmab argument (and return an error appropriately).
--- sound/core/memalloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/core/memalloc.c +4 -1
@@ -176,8 +176,11 @@ EXPORT_SYMBOL_GPL(snd_devm_alloc_pages);int snd_dma_buffer_mmap (struct snd_dma_buffer *dmab,struct vm_area_struct *area) { -const struct snd_malloc_ops *ops =snd_dma_get_ops (dmab); +const struct snd_malloc_ops *ops; +if (!dmab) +return -ENOENT ; + ops =snd_dma_get_ops (dmab);if (ops && ops->mmap)return ops->mmap (dmab, area);else
Greg Kroah-Hartman
maintainerPATCH 39/917 ALSA: ua101: fix division by zero at probe
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 55f261b73a7e1cb254577c3536cef8f415de220a upstream.
Add the missing endpoint max-packet sanity check to probe() to avoid division by zero in alloc_stream_buffers() in case a malicious device has broken descriptors (or when doing descriptor fuzz testing).
Note that USB core will reject URBs submitted for endpoints with zero wMaxPacketSize but that drivers doing packet-size calculations still need to handle this (cf. commit 2548288b4fb0 ("USB: Fix: Don't skip endpoint descriptors with maxpacket=0")).
--- sound/usb/misc/ua101.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/usb/misc/ua101.c +2 -2
@@ -1000,7 +1000,7 @@ static int detect_usb_format(struct ua10 fmt_playback->bSubframeSize * ua->playback.channels; epd = &ua->intf[INTF_CAPTURE ]->altsetting[1 ].endpoint[0 ].desc; -if (!usb_endpoint_is_isoc_in (epd)) { +if (!usb_endpoint_is_isoc_in (epd) ||usb_endpoint_maxp (epd) ==0 ) {dev_err (&ua->dev->dev,"invalid capture endpoint\n" );return -ENXIO ; }
@@ -1008,7 +1008,7 @@ static int detect_usb_format(struct ua10 ua->capture.max_packet_bytes =usb_endpoint_maxp (epd); epd = &ua->intf[INTF_PLAYBACK ]->altsetting[1 ].endpoint[0 ].desc; -if (!usb_endpoint_is_isoc_out (epd)) { +if (!usb_endpoint_is_isoc_out (epd) ||usb_endpoint_maxp (epd) ==0 ) {dev_err (&ua->dev->dev,"invalid playback endpoint\n" );return -ENXIO ; }
Greg Kroah-Hartman
maintainerPATCH 41/917 ALSA: line6: fix control and interrupt message timeouts
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit f4000b58b64344871d7b27c05e73932f137cfef6 upstream.
USB control and interrupt message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ.
--- sound/usb/line6/driver.c | 14 +++++++------- sound/usb/line6/driver.h | 2 +- sound/usb/line6/podhd.c | 6 +++--- sound/usb/line6/toneport.c | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-)
sound/usb/line6/driver.c +7 -7
@@ -113,12 +113,12 @@ int line6_send_raw_message(struct usb_li retval =usb_interrupt_msg (line6->usbdev,usb_sndintpipe (line6->usbdev, properties->ep_ctrl_w), (char *)frag_buf, frag_size, - &partial,LINE6_TIMEOUT *HZ ); + &partial,LINE6_TIMEOUT ); }else { retval =usb_bulk_msg (line6->usbdev,usb_sndbulkpipe (line6->usbdev, properties->ep_ctrl_w), (char *)frag_buf, frag_size, - &partial,LINE6_TIMEOUT *HZ ); + &partial,LINE6_TIMEOUT ); }if (retval) {
@@ -347,7 +347,7 @@ int line6_read_data(struct usb_line6 *li ret =usb_control_msg_send (usbdev,0 ,0x67 ,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_OUT , (datalen <<8 ) |0x21 , address,NULL ,0 , -LINE6_TIMEOUT *HZ ,GFP_KERNEL ); +LINE6_TIMEOUT ,GFP_KERNEL );if (ret) {dev_err (line6->ifcdev,"read request failed (error %d)\n" , ret); goto exit;
@@ -360,7 +360,7 @@ int line6_read_data(struct usb_line6 *li ret =usb_control_msg_recv (usbdev,0 ,0x67 ,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_IN ,0x0012 ,0x0000 , &len,1 , -LINE6_TIMEOUT *HZ ,GFP_KERNEL ); +LINE6_TIMEOUT ,GFP_KERNEL );if (ret) {dev_err (line6->ifcdev,"receive length failed (error %d)\n" , ret);
@@ -387,7 +387,7 @@ int line6_read_data(struct usb_line6 *li/* receive the result: */ ret =usb_control_msg_recv (usbdev,0 ,0x67 ,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_IN , -0x0013 ,0x0000 , data, datalen,LINE6_TIMEOUT *HZ , +0x0013 ,0x0000 , data, datalen,LINE6_TIMEOUT ,GFP_KERNEL );if (ret)dev_err (line6->ifcdev,"read failed (error %d)\n" , ret);
@@ -417,7 +417,7 @@ int line6_write_data(struct usb_line6 *l ret =usb_control_msg_send (usbdev,0 ,0x67 ,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_OUT , -0x0022 , address, data, datalen,LINE6_TIMEOUT *HZ , +0x0022 , address, data, datalen,LINE6_TIMEOUT ,GFP_KERNEL );if (ret) { dev_err(line6->ifcdev,
@@ -430,7 +430,7 @@ int line6_write_data(struct usb_line6 *l ret =usb_control_msg_recv (usbdev,0 ,0x67 ,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_IN , -0x0012 ,0x0000 , status,1 ,LINE6_TIMEOUT *HZ , +0x0012 ,0x0000 , status,1 ,LINE6_TIMEOUT ,GFP_KERNEL );if (ret) { dev_err(line6->ifcdev,
sound/usb/line6/driver.h +1 -1
@@ -27,7 +27,7 @@#define LINE6_FALLBACK_INTERVAL 10#define LINE6_FALLBACK_MAXPACKETSIZE 16 -#define LINE6_TIMEOUT 1 +#define LINE6_TIMEOUT 1000#define LINE6_BUFSIZE_LISTEN 64#define LINE6_MIDI_MESSAGE_MAXLEN 256
sound/usb/line6/podhd.c +3 -3
@@ -190,7 +190,7 @@ static int podhd_dev_start(struct usb_li ret =usb_control_msg_send (usbdev,0 ,0x67 ,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_OUT ,0x11 ,0 , -NULL ,0 ,LINE6_TIMEOUT *HZ ,GFP_KERNEL ); +NULL ,0 ,LINE6_TIMEOUT ,GFP_KERNEL );if (ret) {dev_err (pod->line6.ifcdev,"read request failed (error %d)\n" , ret); goto exit;
@@ -200,7 +200,7 @@ static int podhd_dev_start(struct usb_li ret =usb_control_msg_recv (usbdev,0 ,0x67 ,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_IN ,0x11 ,0x0 , - init_bytes,3 ,LINE6_TIMEOUT *HZ ,GFP_KERNEL ); + init_bytes,3 ,LINE6_TIMEOUT ,GFP_KERNEL );if (ret) {dev_err (pod->line6.ifcdev,"receive length failed (error %d)\n" , ret);
@@ -220,7 +220,7 @@ static int podhd_dev_start(struct usb_liUSB_REQ_SET_FEATURE ,USB_TYPE_STANDARD |USB_RECIP_DEVICE |USB_DIR_OUT ,1 ,0 , - NULL, 0, LINE6_TIMEOUT * HZ, GFP_KERNEL); + NULL, 0, LINE6_TIMEOUT, GFP_KERNEL); exit:return ret; }
sound/usb/line6/toneport.c +1 -1
@@ -128,7 +128,7 @@ static int toneport_send_cmd(struct usb_ ret =usb_control_msg_send (usbdev,0 ,0x67 ,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_OUT , - cmd1, cmd2,NULL ,0 ,LINE6_TIMEOUT *HZ , + cmd1, cmd2,NULL ,0 ,LINE6_TIMEOUT ,GFP_KERNEL );if (ret) {
Greg Kroah-Hartman
maintainerPATCH 13/917 scsi: qla2xxx: Fix crash in NVMe abort path
In reply to Greg Kroah-HartmanFrom: Arun Easi <[email protected]>
commit e6e22e6cc2962d3f3d71914b47f7fbc454670e8a upstream.
System crash was seen when I/O was run against an NVMe target and aborts were occurring.
Crash stack is:
-- relevant crash stack --
BUG: kernel NULL pointer dereference, address: 0000000000000010
:
#6 [ffffae1f8666bdd0] page_fault at ffffffffa740122e
[exception RIP: qla_nvme_abort_work+339]
RIP: ffffffffc0f592e3 RSP: ffffae1f8666be80 RFLAGS: 00010297
RAX: 0000000000000000 RBX: ffff9b581fc8af80 RCX: ffffffffc0f83bd0
RDX: 0000000000000001 RSI: ffff9b5839c6c7c8 RDI: 0000000008000000
RBP: ffff9b6832f85000 R8: ffffffffc0f68160 R9: ffffffffc0f70652
R10: ffffae1f862ffdc8 R11: 0000000000000300 R12: 000000000000010d
R13: 0000000000000000 R14: ffff9b5839cea000 R15: 0ffff9b583fab170
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
#7 [ffffae1f8666be98] process_one_work at ffffffffa6aba184
#8 [ffffae1f8666bed8] worker_thread at ffffffffa6aba39d
#9 [ffffae1f8666bf10] kthread at ffffffffa6ac06edThe crash was due to a stale SRB structure access after it was aborted. Fix the issue by removing stale access.
--- drivers/scsi/qla2xxx/qla_nvme.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_nvme.c +12 -2
@@ -228,6 +228,8 @@ static void qla_nvme_abort_work(struct wfc_port_t *fcport = sp->fcport;struct qla_hw_data *ha = fcport->vha->hw;int rval, abts_done_called =1 ; +bool io_wait_for_abort_done; +uint32_t handle; ql_dbg(ql_dbg_io, fcport->vha, 0xffff, "%s called for sp=%p, hndl=%x on fcport=%p desc=%p deleted=%d\n",
@@ -244,12 +246,20 @@ static void qla_nvme_abort_work(struct w goto out; } +/* +* sp may not be valid after abort_command if return code is either +* SUCCESS or ERR_FROM_FW codes, so cache the value here. +*/ + io_wait_for_abort_done = ql2xabts_wait_nvme && +QLA_ABTS_WAIT_ENABLED (sp); + handle = sp->handle; + rval = ha->isp_ops->abort_command (sp);ql_dbg (ql_dbg_io, fcport->vha,0x212b ,"%s: %s command for sp=%p, handle=%x on fcport=%p rval=%x\n" , __func__, (rval !=QLA_SUCCESS ) ?"Failed to abort" :"Aborted" , - sp, sp->handle, fcport, rval); + sp, handle, fcport, rval);/* * If async tmf is enabled, the abort callback is called only on
@@ -264,7 +274,7 @@ static void qla_nvme_abort_work(struct w* are waited until ABTS complete. This kref is decreased * at qla24xx_abort_sp_done function. */ -if (abts_done_called && ql2xabts_wait_nvme &&QLA_ABTS_WAIT_ENABLED (sp)) +if (abts_done_called && io_wait_for_abort_done)return ; out:/* kref_get was done before work was schedule. */
Greg Kroah-Hartman
maintainerPATCH 48/917 ALSA: pci: rme: Fix unaligned buffer addresses
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 43d35ccc36dad52377dd349b2e3ea803b72c3906 upstream.
The recent fix for setting up the DMA buffer type on RME drivers tried to address the non-standard memory managements and changed the DMA buffer information to the standard snd_dma_buffer object that is allocated at the probe time. However, I overlooked that the RME drivers handle the buffer addresses based on 64k alignment, and the previous conversion broke that silently.
This patch is an attempt to fix the regression. The snd_dma_buffer objects are copied to the original data with the correction to the aligned accesses, and those are passed to snd_pcm_set_runtime_buffer() helpers instead. The original snd_dma_buffer objects are managed by devres, hence they'll be released automagically.
--- sound/pci/rme9652/hdsp.c | 41 +++++++++++++++++++++++------------------ sound/pci/rme9652/rme9652.c | 41 +++++++++++++++++++++++------------------ 2 files changed, 46 insertions(+), 36 deletions(-)
sound/pci/rme9652/hdsp.c +23 -18
@@ -468,8 +468,11 @@ struct hdsp {unsigned char ss_out_channels;u32 io_loopback;/* output loopback channel states*/ -struct snd_dma_buffer *capture_dma_buf; -struct snd_dma_buffer *playback_dma_buf; +/* DMA buffers; those are copied instances from the original snd_dma_buf +* objects (which are managed via devres) for the address alignments +*/ +struct snd_dma_buffer capture_dma_buf; +struct snd_dma_buffer playback_dma_buf;unsigned char *capture_buffer;/* suitably aligned address */ unsigned char *playback_buffer;/* suitably aligned address */
@@ -3764,30 +3767,32 @@ static void snd_hdsp_proc_init(struct hdstatic int snd_hdsp_initialize_memory (struct hdsp *hdsp) { -unsigned long pb_bus, cb_bus; +struct snd_dma_buffer *capture_dma, *playback_dma; - hdsp->capture_dma_buf = -snd_hammerfall_get_buffer (hdsp->pci,HDSP_DMA_AREA_BYTES ); - hdsp->playback_dma_buf = -snd_hammerfall_get_buffer (hdsp->pci,HDSP_DMA_AREA_BYTES ); -if (!hdsp->capture_dma_buf || !hdsp->playback_dma_buf) { + capture_dma =snd_hammerfall_get_buffer (hdsp->pci,HDSP_DMA_AREA_BYTES ); + playback_dma =snd_hammerfall_get_buffer (hdsp->pci,HDSP_DMA_AREA_BYTES ); +if (!capture_dma || !playback_dma) {dev_err (hdsp->card->dev,"%s: no buffers available\n" , hdsp->card_name);return -ENOMEM ; } -/* Align to bus-space 64K boundary */ +/* copy to the own data for alignment */ + hdsp->capture_dma_buf = *capture_dma; + hdsp->playback_dma_buf = *playback_dma; - cb_bus =ALIGN (hdsp->capture_dma_buf->addr,0x10000ul ); - pb_bus =ALIGN (hdsp->playback_dma_buf->addr,0x10000ul ); +/* Align to bus-space 64K boundary */ + hdsp->capture_dma_buf.addr =ALIGN (capture_dma->addr,0x10000ul ); + hdsp->playback_dma_buf.addr =ALIGN (playback_dma->addr,0x10000ul );/* Tell the card where it is */ +hdsp_write (hdsp, HDSP_inputBufferAddress, hdsp->capture_dma_buf.addr); +hdsp_write (hdsp, HDSP_outputBufferAddress, hdsp->playback_dma_buf.addr); -hdsp_write (hdsp, HDSP_inputBufferAddress, cb_bus); -hdsp_write (hdsp, HDSP_outputBufferAddress, pb_bus); - - hdsp->capture_buffer = hdsp->capture_dma_buf->area + (cb_bus - hdsp->capture_dma_buf->addr); - hdsp->playback_buffer = hdsp->playback_dma_buf->area + (pb_bus - hdsp->playback_dma_buf->addr); + hdsp->capture_dma_buf.area += hdsp->capture_dma_buf.addr - capture_dma->addr; + hdsp->playback_dma_buf.area += hdsp->playback_dma_buf.addr - playback_dma->addr; + hdsp->capture_buffer = hdsp->capture_dma_buf.area; + hdsp->playback_buffer = hdsp->playback_dma_buf.area;return 0 ; }
@@ -4507,7 +4512,7 @@ static int snd_hdsp_playback_open(structsnd_pcm_set_sync (substream); runtime->hw = snd_hdsp_playback_subinfo; -snd_pcm_set_runtime_buffer (substream, hdsp->playback_dma_buf); +snd_pcm_set_runtime_buffer (substream, &hdsp->playback_dma_buf); hdsp->playback_pid = current->pid; hdsp->playback_substream = substream;
@@ -4583,7 +4588,7 @@ static int snd_hdsp_capture_open(structsnd_pcm_set_sync (substream); runtime->hw = snd_hdsp_capture_subinfo; -snd_pcm_set_runtime_buffer (substream, hdsp->capture_dma_buf); +snd_pcm_set_runtime_buffer (substream, &hdsp->capture_dma_buf); hdsp->capture_pid = current->pid; hdsp->capture_substream = substream;
sound/pci/rme9652/rme9652.c +23 -18
75 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 45/917 ALSA: usb-audio: Add registration quirk for JBL Quantum 400
In reply to Greg Kroah-HartmanFrom: Alexander Tsoy <[email protected]>
commit 763d92ed5dece7d439fc28a88b2d2728d525ffd9 upstream.
Add another device ID for JBL Quantum 400. It requires the same quirk as other JBL Quantum devices.
--- sound/usb/quirks.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/quirks.c +1 -0
@@ -1749,6 +1749,7 @@ static const struct registration_quirk rREG_QUIRK_ENTRY (0x0951 ,0x16ea ,2 ),/* Kingston HyperX Cloud Flight S */ REG_QUIRK_ENTRY (0x0ecb ,0x1f46 ,2 ),/* JBL Quantum 600 */ REG_QUIRK_ENTRY (0x0ecb ,0x1f47 ,2 ),/* JBL Quantum 800 */ +REG_QUIRK_ENTRY (0x0ecb ,0x1f4c ,2 ),/* JBL Quantum 400 */ REG_QUIRK_ENTRY (0x0ecb ,0x2039 ,2 ),/* JBL Quantum 400 */ REG_QUIRK_ENTRY (0x0ecb ,0x203c ,2 ),/* JBL Quantum 600 */ REG_QUIRK_ENTRY(0x0ecb, 0x203e, 2), /* JBL Quantum 800 */
Greg Kroah-Hartman
maintainerPATCH 44/917 ALSA: usb-audio: Line6 HX-Stomp XL USB_ID for 48k-fixed quirk
In reply to Greg Kroah-HartmanFrom: Jason Ormes <[email protected]>
commit 8f27b689066113a3e579d4df171c980c54368c4e upstream.
Adding the Line6 HX-Stomp XL USB_ID as it needs this fixed frequency quirk as well.
The device is basically just the HX-Stomp with some more buttons on the face. I've done some recording with it after adding it, and it seems to function properly with this fix. The Midi features appear to be working as well.
[ a coding style fix and patch reformat by tiwai ]
--- sound/usb/format.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/format.c +1 -0
@@ -414,6 +414,7 @@ static int line6_parse_audio_format_ratecase USB_ID (0x0e41 ,0x4242 ):/* Line6 Helix Rack */ case USB_ID (0x0e41 ,0x4244 ):/* Line6 Helix LT */ case USB_ID (0x0e41 ,0x4246 ):/* Line6 HX-Stomp */ +case USB_ID (0x0e41 ,0x4253 ):/* Line6 HX-Stomp XL */ case USB_ID (0x0e41 ,0x4247 ):/* Line6 Pod Go */ case USB_ID (0x0e41 ,0x4248 ):/* Line6 Helix >= fw 2.82 */ case USB_ID (0x0e41 ,0x4249 ):/* Line6 Helix Rack >= fw 2.82 */
Greg Kroah-Hartman
maintainerPATCH 40/917 ALSA: 6fire: fix control and bulk message timeouts
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 9b371c6cc37f954360989eec41c2ddc5a6b83917 upstream.
USB control and bulk message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ.
--- sound/usb/6fire/comm.c | 2 +- sound/usb/6fire/firmware.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
sound/usb/6fire/comm.c +1 -1
@@ -95,7 +95,7 @@ static int usb6fire_comm_send_buffer(u8int actual_len; ret =usb_interrupt_msg (dev,usb_sndintpipe (dev,COMM_EP ), - buffer, buffer[1 ] +2 , &actual_len,HZ ); + buffer, buffer[1 ] +2 , &actual_len,1000 );if (ret <0 )return ret;else if (actual_len != buffer[1 ] +2 )
sound/usb/6fire/firmware.c +3 -3
@@ -160,7 +160,7 @@ static int usb6fire_fw_ezusb_write(struc {return usb_control_msg_send (device,0 , type,USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_DEVICE , - value,0 , data, len,HZ ,GFP_KERNEL ); + value,0 , data, len,1000 ,GFP_KERNEL ); } static int usb6fire_fw_ezusb_read(struct usb_device *device,
@@ -168,7 +168,7 @@ static int usb6fire_fw_ezusb_read(struct {return usb_control_msg_recv (device,0 , type,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE , - value,0 , data, len,HZ ,GFP_KERNEL ); + value,0 , data, len,1000 ,GFP_KERNEL ); } static int usb6fire_fw_fpga_write(struct usb_device *device,
@@ -178,7 +178,7 @@ static int usb6fire_fw_fpga_write(structint ret; ret =usb_bulk_msg (device,usb_sndbulkpipe (device,FPGA_EP ), data, len, - &actual_len,HZ ); + &actual_len,1000 );if (ret <0 )return ret;else if (actual_len != len)
Greg Kroah-Hartman
maintainerPATCH 51/917 ALSA: timer: Unconditionally unlink slave instances, too
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit ffdd98277f0a1d15a67a74ae09bee713df4c0dbc upstream.
Like the previous fix (commit c0317c0e8709 "ALSA: timer: Fix use-after-free problem"), we have to unlink slave timer instances immediately at snd_timer_stop(), too. Otherwise it may leave a stale entry in the list if the slave instance is freed before actually running.
--- sound/core/timer.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
sound/core/timer.c +6 -7
@@ -665,23 +665,22 @@ static int snd_timer_stop1(struct snd_tistatic int snd_timer_stop_slave (struct snd_timer_instance *timeri,bool stop) {unsigned long flags; +bool running;spin_lock_irqsave (&slave_active_lock, flags); -if (!(timeri->flags &SNDRV_TIMER_IFLG_RUNNING )) { -spin_unlock_irqrestore (&slave_active_lock, flags); -return -EBUSY ; - } + running = timeri->flags &SNDRV_TIMER_IFLG_RUNNING ; timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING ;if (timeri->timer) {spin_lock (&timeri->timer->lock);list_del_init (&timeri->ack_list);list_del_init (&timeri->active_list); -snd_timer_notify1 (timeri, stop ?SNDRV_TIMER_EVENT_STOP : -SNDRV_TIMER_EVENT_PAUSE ); +if (running) +snd_timer_notify1 (timeri, stop ?SNDRV_TIMER_EVENT_STOP : +SNDRV_TIMER_EVENT_PAUSE );spin_unlock (&timeri->timer->lock); }spin_unlock_irqrestore (&slave_active_lock, flags); -return 0 ; +return running ?0 : -EBUSY ; }/*
Greg Kroah-Hartman
maintainerPATCH 47/917 ALSA: synth: missing check for possible NULL after the call to kstrdup
In reply to Greg Kroah-HartmanFrom: Austin Kim <[email protected]>
commit d159037abbe3412285c271bdfb9cdf19e62678ff upstream.
If kcalloc() return NULL due to memory starvation, it is possible for kstrdup() to return NULL in similar case. So add null check after the call to kstrdup() is made.
[ minor coding-style fix by tiwai ]
--- sound/synth/emux/emux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/synth/emux/emux.c +1 -1
@@ -88,7 +88,7 @@ int snd_emux_register(struct snd_emux *e emu->name =kstrdup (name,GFP_KERNEL ); emu->voices =kcalloc (emu->max_voices,sizeof (struct snd_emux_voice ),GFP_KERNEL ); -if (emu->voices ==NULL ) +if (emu->name ==NULL || emu->voices ==NULL )return -ENOMEM ;/* create soundfont list */
Greg Kroah-Hartman
maintainerPATCH 50/917 ALSA: timer: Fix use-after-free problem
In reply to Greg Kroah-HartmanFrom: Wang Wensheng <[email protected]>
commit c0317c0e87094f5b5782b6fdef5ae0a4b150496c upstream.
When the timer instance was add into ack_list but was not currently in process, the user could stop it via snd_timer_stop1() without delete it from the ack_list. Then the user could free the timer instance and when it was actually processed UAF occurred.
This issue could be reproduced via testcase snd_timer01 in ltp - running several instances of that testcase at the same time.
What I actually met was that the ack_list of the timer broken and the kernel went into deadloop with irqoff. That could be detected by hardlockup detector on board or when we run it on qemu, we could use gdb to dump the ack_list when the console has no response.
To fix this issue, we delete the timer instance from ack_list and active_list unconditionally in snd_timer_stop1().
--- sound/core/timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/timer.c +2 -2
@@ -624,13 +624,13 @@ static int snd_timer_stop1(struct snd_tiif (!timer)return -EINVAL ;spin_lock_irqsave (&timer->lock, flags); +list_del_init (&timeri->ack_list); +list_del_init (&timeri->active_list);if (!(timeri->flags & (SNDRV_TIMER_IFLG_RUNNING |SNDRV_TIMER_IFLG_START ))) { result = -EBUSY ; goto unlock; } -list_del_init (&timeri->ack_list); -list_del_init (&timeri->active_list);if (timer->card && timer->card->shutdown) goto unlock;if (stop) {
Greg Kroah-Hartman
maintainerPATCH 66/917 powerpc/kvm: Fix kvm_use_magic_page
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
commit 0c8eb2884a42d992c7726539328b7d3568f22143 upstream.
When switching from __get_user to fault_in_pages_readable, commit 9f9eae5ce717 broke kvm_use_magic_page: like __get_user, fault_in_pages_readable returns 0 on success.
--- arch/powerpc/kernel/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/kvm.c +1 -1
@@ -669,7 +669,7 @@ static void __init kvm_use_magic_page(voon_each_cpu (kvm_map_magic_page, &features,1 );/* Quick self-test to see if the mapping works */ -if (!fault_in_pages_readable ((const char *)KVM_MAGIC_PAGE ,sizeof (u32))) { +if (fault_in_pages_readable ((const char *)KVM_MAGIC_PAGE ,sizeof (u32))) { kvm_patching_worked = false;return ; }
Greg Kroah-Hartman
maintainerPATCH 67/917 KVM: PPC: Tick accounting should defer vtime accounting til after IRQ handling
In reply to Greg Kroah-HartmanFrom: Laurent Vivier <[email protected]>
commit 235cee162459d96153d63651ce7ff51752528c96 upstream.
Commit 112665286d08 ("KVM: PPC: Book3S HV: Context tracking exit guest context before enabling irqs") moved guest_exit() into the interrupt protected area to avoid wrong context warning (or worse). The problem is that tick-based time accounting has not yet been updated at this point (because it depends on the timer interrupt firing), so the guest time gets incorrectly accounted to system time.
To fix the problem, follow the x86 fix in commit 160457140187 ("Defer vtime accounting 'til after IRQ handling"), and allow host IRQs to run before accounting the guest exit time.
In the case vtime accounting is enabled, this is not required because TB is used directly for accounting.
Before this patch, with CONFIG_TICK_CPU_ACCOUNTING=y in the host and a guest running a kernel compile, the 'guest' fields of /proc/stat are stuck at zero. With the patch they can be observed increasing roughly as expected.
--- arch/powerpc/kvm/book3s_hv.c | 30 ++++++++++++++++++++++++++++-- arch/powerpc/kvm/booke.c | 16 +++++++++++++++- 2 files changed, 43 insertions(+), 3 deletions(-)
arch/powerpc/kvm/book3s_hv.c +28 -2
@@ -3726,7 +3726,20 @@ static noinline void kvmppc_run_core(strkvmppc_set_host_core (pcpu); -guest_exit_irqoff (); +context_tracking_guest_exit (); +if (!vtime_accounting_enabled_this_cpu ()) { +local_irq_enable (); +/* +* Service IRQs here before vtime_account_guest_exit() so any +* ticks that occurred while running the guest are accounted to +* the guest. If vtime accounting is enabled, accounting uses +* TB rather than ticks, so it can be done without enabling +* interrupts here, which has the problem that it accounts +* interrupt processing overhead to the host. +*/ +local_irq_disable (); + } +vtime_account_guest_exit ();local_irq_enable ();
@@ -4510,7 +4523,20 @@ int kvmhv_run_single_vcpu(struct kvm_vcpkvmppc_set_host_core (pcpu); -guest_exit_irqoff (); +context_tracking_guest_exit (); +if (!vtime_accounting_enabled_this_cpu ()) { +local_irq_enable (); +/* +* Service IRQs here before vtime_account_guest_exit() so any +* ticks that occurred while running the guest are accounted to +* the guest. If vtime accounting is enabled, accounting uses +* TB rather than ticks, so it can be done without enabling +* interrupts here, which has the problem that it accounts +* interrupt processing overhead to the host. +*/ +local_irq_disable (); + } +vtime_account_guest_exit ();local_irq_enable ();
arch/powerpc/kvm/booke.c +15 -1
@@ -1042,7 +1042,21 @@ int kvmppc_handle_exit(struct kvm_vcpu * }trace_kvm_exit (exit_nr, vcpu); -guest_exit_irqoff (); + +context_tracking_guest_exit (); +if (!vtime_accounting_enabled_this_cpu ()) { +local_irq_enable (); +/* +* Service IRQs here before vtime_account_guest_exit() so any +* ticks that occurred while running the guest are accounted to +* the guest. If vtime accounting is enabled, accounting uses +* TB rather than ticks, so it can be done without enabling +* interrupts here, which has the problem that it accounts +* interrupt processing overhead to the host. +*/ +local_irq_disable (); + } +vtime_account_guest_exit ();local_irq_enable ();
Greg Kroah-Hartman
maintainerPATCH 64/917 KVM: x86/mmu: Drop a redundant, broken remote TLB flush
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit bc3b3c1002ea684e618ff6d8c387b1b8b319f140 upstream.
A recent commit to fix the calls to kvm_flush_remote_tlbs_with_address() in kvm_zap_gfn_range() inadvertantly added yet another flush instead of fixing the existing flush. Drop the redundant flush, and fix the params for the existing flush.
Message-Id: <[email protected]>
--- arch/x86/kvm/mmu/mmu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/x86/kvm/mmu/mmu.c +2 -4
@@ -5758,13 +5758,11 @@ void kvm_zap_gfn_range(struct kvm *kvm,for (i =0 ; i <KVM_ADDRESS_SPACE_NUM ; i++) flush =kvm_tdp_mmu_zap_gfn_range (kvm, i, gfn_start, gfn_end, flush); -if (flush) -kvm_flush_remote_tlbs_with_address (kvm, gfn_start, - gfn_end - gfn_start); }if (flush) -kvm_flush_remote_tlbs_with_address (kvm, gfn_start, gfn_end); +kvm_flush_remote_tlbs_with_address (kvm, gfn_start, + gfn_end - gfn_start);kvm_dec_notifier_count (kvm, gfn_start, gfn_end);
Greg Kroah-Hartman
maintainerPATCH 65/917 KVM: VMX: Unregister posted interrupt wakeup handler on hardware unsetup
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit ec5a4919fa7b7d8c7a2af1c7e799b1fe4be84343 upstream.
Unregister KVM's posted interrupt wakeup handler during unsetup so that a spurious interrupt that arrives after kvm_intel.ko is unloaded doesn't call into freed memory.
Message-Id: <[email protected]>
--- arch/x86/kvm/vmx/vmx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/x86/kvm/vmx/vmx.c +5 -2
@@ -7551,6 +7551,8 @@ static void vmx_migrate_timers(struct kvstatic void hardware_unsetup (void ) { +kvm_set_posted_intr_wakeup_handler (NULL ); +if (nested)nested_vmx_hardware_unsetup ();
@@ -7879,8 +7881,6 @@ static __init int hardware_setup(void) vmx_x86_ops.request_immediate_exit = __kvm_request_immediate_exit; } -kvm_set_posted_intr_wakeup_handler (pi_wakeup_handler); - kvm_mce_cap_supported |=MCG_LMCE_P ;if (pt_mode !=PT_MODE_SYSTEM && pt_mode !=PT_MODE_HOST_GUEST )
@@ -7904,6 +7904,9 @@ static __init int hardware_setup(void) r =alloc_kvm_area ();if (r)nested_vmx_hardware_unsetup (); + +kvm_set_posted_intr_wakeup_handler (pi_wakeup_handler); +return r; }
Greg Kroah-Hartman
maintainerPATCH 71/917 md/raid1: only allocate write behind bio for WriteMostly device
In reply to Greg Kroah-HartmanFrom: Guoqing Jiang <[email protected]>
commit fd3b6975e9c11c4fa00965f82a0bfbb3b7b44101 upstream.
Commit 6607cd319b6b91bff94e90f798a61c031650b514 ("raid1: ensure write behind bio has less than BIO_MAX_VECS sectors") tried to guarantee the size of behind bio is not bigger than BIO_MAX_VECS sectors.
Unfortunately the same calltrace still could happen since an array could enable write-behind without write mostly device.
To match the manpage of mdadm (which says "write-behind is only attempted on drives marked as write-mostly"), we need to check WriteMostly flag to avoid such unexpected behavior.
[1]. https://bugzilla.kernel.org/show_bug.cgi?id=213181#c25
--- drivers/md/raid1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid1.c +1 -1
@@ -1496,7 +1496,7 @@ static void raid1_write_request(struct mif (!r1_bio->bios[i])continue ; -if (first_clone) { +if (first_clone &&test_bit (WriteMostly, &rdev->flags)) {/* do behind I/O ? * Not if there are too many, or cannot * allocate memory, or a reader on WriteMostly
Greg Kroah-Hartman
maintainerPATCH 73/917 regulator: s5m8767: do not use reset value as DVS voltage if GPIO DVS is disabled
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit b16bef60a9112b1e6daf3afd16484eb06e7ce792 upstream.
The driver and its bindings, before commit 04f9f068a619 ("regulator:
s5m8767: Modify parsing method of the voltage table of buck2/3/4") were requiring to provide at least one safe/default voltage for DVS registers if DVS GPIO is not being enabled.
IOW, if s5m8767,pmic-buck2-uses-gpio-dvs is missing, the s5m8767,pmic-buck2-dvs-voltage should still be present and contain one voltage.
This requirement was coming from driver behavior matching this condition (none of DVS GPIO is enabled): it was always initializing the DVS selector pins to 0 and keeping the DVS enable setting at reset value (enabled). Therefore if none of DVS GPIO is enabled in devicetree, driver was configuring the first DVS voltage for buck[234].
Mentioned commit 04f9f068a619 ("regulator: s5m8767: Modify parsing method of the voltage table of buck2/3/4") broke it because DVS voltage won't be parsed from devicetree if DVS GPIO is not enabled. After the change, driver will configure bucks to use the register reset value as voltage which might have unpleasant effects.
Fix this by relaxing the bindings constrain: if DVS GPIO is not enabled in devicetree (therefore DVS voltage is also not parsed), explicitly disable it.
Message-Id: <[email protected]>
--- Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt | 21 +++------- drivers/regulator/s5m8767.c | 21 ++++------ 2 files changed, 17 insertions(+), 25 deletions(-)
Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt +8 -13
@@ -13,6 +13,14 @@ common regulator binding documented in: Required properties of the main device node (the parent!): + - s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used + for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines. + + [1] If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional + property is specified, then all the eight voltage values for the + 's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified. + +Optional properties of the main device node (the parent!): - s5m8767,pmic-buck2-dvs-voltage: A set of 8 voltage values in micro-volt (uV) units for buck2 when changing voltage using gpio dvs. Refer to [1] below for additional information.
@@ -25,19 +33,6 @@ Required properties of the main device n units for buck4 when changing voltage using gpio dvs. Refer to [1] below for additional information. - - s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used - for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines. - - [1] If none of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional - property is specified, the 's5m8767,pmic-buck[2/3/4]-dvs-voltage' - property should specify atleast one voltage level (which would be a - safe operating voltage). - - If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional - property is specified, then all the eight voltage values for the - 's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified. - -Optional properties of the main device node (the parent!): - s5m8767,pmic-buck2-uses-gpio-dvs: 'buck2' can be controlled by gpio dvs. - s5m8767,pmic-buck3-uses-gpio-dvs: 'buck3' can be controlled by gpio dvs. - s5m8767,pmic-buck4-uses-gpio-dvs: 'buck4' can be controlled by gpio dvs.
drivers/regulator/s5m8767.c +9 -12
@@ -850,18 +850,15 @@ static int s5m8767_pmic_probe(struct pla/* DS4 GPIO */ gpio_direction_output (pdata->buck_ds[2 ],0x0 ); -if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs || - pdata->buck4_gpiodvs) { -regmap_update_bits (s5m8767->iodev->regmap_pmic, -S5M8767_REG_BUCK2CTRL ,1 <<1 , - (pdata->buck2_gpiodvs) ? (1 <<1 ) : (0 <<1 )); -regmap_update_bits (s5m8767->iodev->regmap_pmic, -S5M8767_REG_BUCK3CTRL ,1 <<1 , - (pdata->buck3_gpiodvs) ? (1 <<1 ) : (0 <<1 )); -regmap_update_bits (s5m8767->iodev->regmap_pmic, -S5M8767_REG_BUCK4CTRL ,1 <<1 , - (pdata->buck4_gpiodvs) ? (1 <<1 ) : (0 <<1 )); - } +regmap_update_bits (s5m8767->iodev->regmap_pmic, +S5M8767_REG_BUCK2CTRL ,1 <<1 , + (pdata->buck2_gpiodvs) ? (1 <<1 ) : (0 <<1 )); +regmap_update_bits (s5m8767->iodev->regmap_pmic, +S5M8767_REG_BUCK3CTRL ,1 <<1 , + (pdata->buck3_gpiodvs) ? (1 <<1 ) : (0 <<1 )); +regmap_update_bits (s5m8767->iodev->regmap_pmic, +S5M8767_REG_BUCK4CTRL ,1 <<1 , + (pdata->buck4_gpiodvs) ? (1 <<1 ) : (0 <<1 ));/* Initialize GPIO DVS registers */ for (i =0 ; i <8 ; i++) {
Greg Kroah-Hartman
maintainerPATCH 75/917 EDAC/sb_edac: Fix top-of-high-memory value for Broadwell/Haswell
In reply to Greg Kroah-HartmanFrom: Eric Badger <[email protected]>
commit 537bddd069c743759addf422d0b8f028ff0f8dbc upstream.
The computation of TOHM is off by one bit. This missed bit results in too low a value for TOHM, which can cause errors in regular memory to incorrectly report:
EDAC MC0: 1 CE Error at MMIOH area, on addr 0x000000207fffa680 on any memory
--- drivers/edac/sb_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/sb_edac.c +1 -1
@@ -1052,7 +1052,7 @@ static u64 haswell_get_tohm(struct sbridpci_read_config_dword (pvt->info.pci_vtd,HASWELL_TOHM_1 , ®); rc = ((reg <<6 ) | rc) <<26 ; -return rc |0x1ffffff ; +return rc |0x3ffffff ; }static u64 knl_get_tolm (struct sbridge_pvt *pvt)
Greg Kroah-Hartman
maintainerPATCH 76/917 mwifiex: fix division by zero in fw download path
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 89f8765a11d8df49296d92c404067f9b5c58ee26 upstream.
Add the missing endpoint sanity checks to probe() to avoid division by zero in mwifiex_write_data_sync() in case a malicious device has broken descriptors (or when doing descriptor fuzz testing).
Only add checks for the firmware-download boot stage, which require both command endpoints, for now. The driver looks like it will handle a missing endpoint during normal operation without oopsing, albeit not very gracefully as it will try to submit URBs to the default pipe and fail.
Note that USB core will reject URBs submitted for endpoints with zero wMaxPacketSize but that drivers doing packet-size calculations still need to handle this (cf. commit 2548288b4fb0 ("USB: Fix: Don't skip endpoint descriptors with maxpacket=0")).
--- drivers/net/wireless/marvell/mwifiex/usb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/net/wireless/marvell/mwifiex/usb.c +16 -0
@@ -505,6 +505,22 @@ static int mwifiex_usb_probe(struct usb_ } } +switch (card->usb_boot_state) { +case USB8XXX_FW_DNLD : +/* Reject broken descriptors. */ +if (!card->rx_cmd_ep || !card->tx_cmd_ep) +return -ENODEV ; +if (card->bulk_out_maxpktsize ==0 ) +return -ENODEV ; +break ; +case USB8XXX_FW_READY : +/* Assume the driver can handle missing endpoints for now. */ +break ; +default : +WARN_ON (1 ); +return -ENODEV ; + } +usb_set_intfdata (intf, card); ret = mwifiex_add_card(card, &card->fw_done, &usb_ops,
Greg Kroah-Hartman
maintainerPATCH 77/917 ath6kl: fix division by zero in send path
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit c1b9ca365deae667192be9fe24db244919971234 upstream.
Add the missing endpoint max-packet sanity check to probe() to avoid division by zero in ath10k_usb_hif_tx_sg() in case a malicious device has broken descriptors (or when doing descriptor fuzz testing).
Note that USB core will reject URBs submitted for endpoints with zero wMaxPacketSize but that drivers doing packet-size calculations still need to handle this (cf. commit 2548288b4fb0 ("USB: Fix: Don't skip endpoint descriptors with maxpacket=0")).
--- drivers/net/wireless/ath/ath6kl/usb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath6kl/usb.c +5 -0
@@ -340,6 +340,11 @@ static int ath6kl_usb_setup_pipe_resourcle16_to_cpu (endpoint->wMaxPacketSize), endpoint->bInterval); } + +/* Ignore broken descriptors. */ +if (usb_endpoint_maxp (endpoint) ==0 ) +continue ; + urbcount =0 ; pipe_num =
Greg Kroah-Hartman
maintainerPATCH 78/917 ath6kl: fix control-message timeout
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit a066d28a7e729f808a3e6eff22e70c003091544e upstream.
USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ.
--- drivers/net/wireless/ath/ath6kl/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/usb.c +1 -1
@@ -912,7 +912,7 @@ static int ath6kl_usb_submit_ctrl_in(str req,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE , value, index, buf, - size, 2 * HZ); + size, 2000);if (ret <0 ) {ath6kl_warn ("Failed to read usb control message: %d\n" , ret);
Greg Kroah-Hartman
maintainerPATCH 79/917 ath10k: fix control-message timeout
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 5286132324230168d3fab6ffc16bfd7de85bdfb4 upstream.
USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ.
--- drivers/net/wireless/ath/ath10k/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/usb.c +1 -1
@@ -525,7 +525,7 @@ static int ath10k_usb_submit_ctrl_in(str req,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE , value, index, buf, - size, 2 * HZ); + size, 2000);if (ret <0 ) { ath10k_warn(ar, "Failed to read usb control message: %d\n",
Greg Kroah-Hartman
maintainerPATCH 81/917 PCI: Mark Atheros QCA6174 to avoid bus reset
In reply to Greg Kroah-HartmanFrom: Ingmar Klein <[email protected]>
commit e3f4bd3462f6f796594ecc0dda7144ed2d1e5a26 upstream.
When passing the Atheros QCA6174 through to a virtual machine, the VM hangs at the point where the ath10k driver loads.
Add a quirk to avoid bus resets on this device, which avoids the hang.
--- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
@@ -3612,6 +3612,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ADECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x003c , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0033 , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0034 , quirk_no_bus_reset); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x003e , quirk_no_bus_reset);/* * Root port on some Cavium CN8xxx chips do not successfully complete a bus
Greg Kroah-Hartman
maintainerPATCH 82/917 rtl8187: fix control-message timeouts
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 2e9be536a213e838daed6ba42024dd68954ac061 upstream.
USB control-message timeouts are specified in milliseconds and should specifically not vary with CONFIG_HZ.
--- drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c +7 -7
@@ -28,7 +28,7 @@ u8 rtl818x_ioread8_idx(struct rtl8187_prusb_control_msg (priv->udev,usb_rcvctrlpipe (priv->udev,0 ),RTL8187_REQ_GET_REG ,RTL8187_REQT_READ , (unsigned long )addr, idx &0x03 , - &priv->io_dmabuf->bits8,sizeof (val),HZ /2 ); + &priv->io_dmabuf->bits8,sizeof (val),500 ); val = priv->io_dmabuf->bits8;mutex_unlock (&priv->io_mutex);
@@ -45,7 +45,7 @@ u16 rtl818x_ioread16_idx(struct rtl8187_usb_control_msg (priv->udev,usb_rcvctrlpipe (priv->udev,0 ),RTL8187_REQ_GET_REG ,RTL8187_REQT_READ , (unsigned long )addr, idx &0x03 , - &priv->io_dmabuf->bits16,sizeof (val),HZ /2 ); + &priv->io_dmabuf->bits16,sizeof (val),500 ); val = priv->io_dmabuf->bits16;mutex_unlock (&priv->io_mutex);
@@ -62,7 +62,7 @@ u32 rtl818x_ioread32_idx(struct rtl8187_usb_control_msg (priv->udev,usb_rcvctrlpipe (priv->udev,0 ),RTL8187_REQ_GET_REG ,RTL8187_REQT_READ , (unsigned long )addr, idx &0x03 , - &priv->io_dmabuf->bits32,sizeof (val),HZ /2 ); + &priv->io_dmabuf->bits32,sizeof (val),500 ); val = priv->io_dmabuf->bits32;mutex_unlock (&priv->io_mutex);
@@ -79,7 +79,7 @@ void rtl818x_iowrite8_idx(struct rtl8187usb_control_msg (priv->udev,usb_sndctrlpipe (priv->udev,0 ),RTL8187_REQ_SET_REG ,RTL8187_REQT_WRITE , (unsigned long )addr, idx &0x03 , - &priv->io_dmabuf->bits8,sizeof (val),HZ /2 ); + &priv->io_dmabuf->bits8,sizeof (val),500 );mutex_unlock (&priv->io_mutex); }
@@ -93,7 +93,7 @@ void rtl818x_iowrite16_idx(struct rtl818usb_control_msg (priv->udev,usb_sndctrlpipe (priv->udev,0 ),RTL8187_REQ_SET_REG ,RTL8187_REQT_WRITE , (unsigned long )addr, idx &0x03 , - &priv->io_dmabuf->bits16,sizeof (val),HZ /2 ); + &priv->io_dmabuf->bits16,sizeof (val),500 );mutex_unlock (&priv->io_mutex); }
@@ -107,7 +107,7 @@ void rtl818x_iowrite32_idx(struct rtl818usb_control_msg (priv->udev,usb_sndctrlpipe (priv->udev,0 ),RTL8187_REQ_SET_REG ,RTL8187_REQT_WRITE , (unsigned long )addr, idx &0x03 , - &priv->io_dmabuf->bits32,sizeof (val),HZ /2 ); + &priv->io_dmabuf->bits32,sizeof (val),500 );mutex_unlock (&priv->io_mutex); }
@@ -183,7 +183,7 @@ static void rtl8225_write_8051(struct ieusb_control_msg (priv->udev,usb_sndctrlpipe (priv->udev,0 ),RTL8187_REQ_SET_REG ,RTL8187_REQT_WRITE , addr,0x8225 , &priv->io_dmabuf->bits16,sizeof (data), -HZ /2 ); +500 );mutex_unlock (&priv->io_mutex);
Greg Kroah-Hartman
maintainerPATCH 57/917 x86/sme: Use #define USE_EARLY_PGTABLE_L5 in mem_encrypt_identity.c
In reply to Greg Kroah-HartmanFrom: Tom Lendacky <[email protected]>
commit e7d445ab26db833d6640d4c9a08bee176777cc82 upstream.
When runtime support for converting between 4-level and 5-level pagetables was added to the kernel, the SME code that built pagetables was updated to use the pagetable functions, e.g. p4d_offset(), etc., in order to simplify the code. However, the use of the pagetable functions in early boot code requires the use of the USE_EARLY_PGTABLE_L5 #define in order to ensure that the proper definition of pgtable_l5_enabled() is used.
Without the #define, pgtable_l5_enabled() is #defined as cpu_feature_enabled(X86_FEATURE_LA57). In early boot, the CPU features have not yet been discovered and populated, so pgtable_l5_enabled() will return false even when 5-level paging is enabled. This causes the SME code to always build 4-level pagetables to perform the in-place encryption. If 5-level paging is enabled, switching to the SME pagetables results in a page-fault that kills the boot.
Adding the #define results in pgtable_l5_enabled() using the __pgtable_l5_enabled variable set in early boot and the SME code building pagetables for the proper paging level.
--- arch/x86/mm/mem_encrypt_identity.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/x86/mm/mem_encrypt_identity.c +9 -0
@@ -27,6 +27,15 @@#undef CONFIG_PARAVIRT_XXL#undef CONFIG_PARAVIRT_SPINLOCKS +/* +* This code runs before CPU feature bits are set. By default, the +* pgtable_l5_enabled() function uses bit X86_FEATURE_LA57 to determine if +* 5-level paging is active, so that won't work here. USE_EARLY_PGTABLE_L5 +* is provided to handle this situation and, instead, use a variable that +* has been set by the early boot code. +*/ +#define USE_EARLY_PGTABLE_L5 +#include <linux/kernel.h> #include <linux/mm.h> #include <linux/mem_encrypt.h>
Greg Kroah-Hartman
maintainerPATCH 74/917 regulator: dt-bindings: samsung,s5m8767: correct s5m8767,pmic-buck-default-dvs-idx property
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit a7fda04bc9b6ad9da8e19c9e6e3b1dab773d068a upstream.
The driver was always parsing "s5m8767,pmic-buck-default-dvs-idx", not "s5m8767,pmic-buck234-default-dvs-idx".
Message-Id: <[email protected]>
--- Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt +1 -1
@@ -39,7 +39,7 @@ Optional properties of the main device n Additional properties required if either of the optional properties are used: - - s5m8767,pmic-buck234-default-dvs-idx: Default voltage setting selected from + - s5m8767,pmic-buck-default-dvs-idx: Default voltage setting selected from the possible 8 options selectable by the dvs gpios. The value of this property should be between 0 and 7. If not specified or if out of range, the default value of this property is set to 0.
Greg Kroah-Hartman
maintainerPATCH 80/917 ath10k: fix division by zero in send path
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit a006acb931317aad3a8dd41333ebb0453caf49b8 upstream.
Add the missing endpoint max-packet sanity check to probe() to avoid division by zero in ath10k_usb_hif_tx_sg() in case a malicious device has broken descriptors (or when doing descriptor fuzz testing).
Note that USB core will reject URBs submitted for endpoints with zero wMaxPacketSize but that drivers doing packet-size calculations still need to handle this (cf. commit 2548288b4fb0 ("USB: Fix: Don't skip endpoint descriptors with maxpacket=0")).
--- drivers/net/wireless/ath/ath10k/usb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath10k/usb.c +5 -0
@@ -853,6 +853,11 @@ static int ath10k_usb_setup_pipe_resourcle16_to_cpu (endpoint->wMaxPacketSize), endpoint->bInterval); } + +/* Ignore broken descriptors. */ +if (usb_endpoint_maxp (endpoint) ==0 ) +continue ; + urbcount =0 ; pipe_num =
Greg Kroah-Hartman
maintainerPATCH 83/917 evm: mark evm_fixmode as __ro_after_init
In reply to Greg Kroah-HartmanFrom: Austin Kim <[email protected]>
commit 32ba540f3c2a7ef61ed5a577ce25069a3d714fc9 upstream.
The evm_fixmode is only configurable by command-line option and it is never modified outside initcalls, so declaring it with __ro_after_init is better.
--- security/integrity/evm/evm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/evm/evm_main.c +1 -1
@@ -78,7 +78,7 @@ static struct xattr_list evm_config_defaLIST_HEAD (evm_config_xattrnames); -static int evm_fixmode; +static int evm_fixmode__ro_after_init ;static int __init evm_set_fixmode (char *str) {if (strncmp (str,"fix" ,3 ) ==0 )
Greg Kroah-Hartman
maintainerPATCH 84/917 ifb: Depend on netfilter alternatively to tc
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit 046178e726c2977d686ba5e07105d5a6685c830e upstream.
IFB originally depended on NET_CLS_ACT for traffic redirection. But since v4.5, that may be achieved with NFT_FWD_NETDEV as well.
--- drivers/net/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/Kconfig +1 -1
@@ -150,7 +150,7 @@ config NET_FC config IFB tristate "Intermediate Functional Block support" - depends on NET_CLS_ACT + depends on NET_ACT_MIRRED || NFT_FWD_NETDEV select NET_REDIRECT help This is an intermediate driver that allows sharing of
Greg Kroah-Hartman
maintainerPATCH 85/917 platform/surface: aggregator_registry: Add support for Surface Laptop Studio
In reply to Greg Kroah-HartmanFrom: Maximilian Luz <[email protected]>
commit 4f042e40199ce8bac6bc2b853e81744ee4ea759c upstream.
Add support for the Surface Laptop Studio.
In contrast to previous Surface Laptop models, this one has its HID devices attached to target ID 1 (instead of 2). It also has a couple more of them, including a new notifier for when the pen is stashed / taken out of its place, a "Sys Control" device, and two other unidentified HID devices with unknown usages.
Battery and performance profile interfaces remain the same.
--- drivers/platform/surface/surface_aggregator_registry.c | 54 +++++++++++++++++ 1 file changed, 54 insertions(+)
drivers/platform/surface/surface_aggregator_registry.c +54 -0
@@ -77,6 +77,42 @@ static const struct software_node ssam_n .parent = &ssam_node_root, }; +/* HID keyboard (TID1). */ +static const struct software_node ssam_node_hid_tid1_keyboard = { + .name ="ssam:01:15:01:01:00" , + .parent = &ssam_node_root, +}; + +/* HID pen stash (TID1; pen taken / stashed away evens). */ +static const struct software_node ssam_node_hid_tid1_penstash = { + .name ="ssam:01:15:01:02:00" , + .parent = &ssam_node_root, +}; + +/* HID touchpad (TID1). */ +static const struct software_node ssam_node_hid_tid1_touchpad = { + .name ="ssam:01:15:01:03:00" , + .parent = &ssam_node_root, +}; + +/* HID device instance 6 (TID1, unknown HID device). */ +static const struct software_node ssam_node_hid_tid1_iid6 = { + .name ="ssam:01:15:01:06:00" , + .parent = &ssam_node_root, +}; + +/* HID device instance 7 (TID1, unknown HID device). */ +static const struct software_node ssam_node_hid_tid1_iid7 = { + .name ="ssam:01:15:01:07:00" , + .parent = &ssam_node_root, +}; + +/* HID system controls (TID1). */ +static const struct software_node ssam_node_hid_tid1_sysctrl = { + .name ="ssam:01:15:01:08:00" , + .parent = &ssam_node_root, +}; +/* HID keyboard. */ static const struct software_node ssam_node_hid_main_keyboard = { .name ="ssam:01:15:02:01:00" ,
@@ -159,6 +195,21 @@ static const struct software_node *ssam_ NULL, }; +/* Devices for Surface Laptop Studio. */ +static const struct software_node *ssam_node_group_sls[] = { + &ssam_node_root, + &ssam_node_bat_ac, + &ssam_node_bat_main, + &ssam_node_tmp_pprof, + &ssam_node_hid_tid1_keyboard, + &ssam_node_hid_tid1_penstash, + &ssam_node_hid_tid1_touchpad, + &ssam_node_hid_tid1_iid6, + &ssam_node_hid_tid1_iid7, + &ssam_node_hid_tid1_sysctrl, +NULL , +}; +/* Devices for Surface Laptop Go. */ static const struct software_node *ssam_node_group_slg1[] = { &ssam_node_root,
@@ -507,6 +558,9 @@ static const struct acpi_device_id ssam_/* Surface Laptop Go 1 */ { "MSHW0118", (unsigned long)ssam_node_group_slg1 }, +/* Surface Laptop Studio */ + { "MSHW0123", (unsigned long)ssam_node_group_sls }, + { }, };MODULE_DEVICE_TABLE (acpi, ssam_platform_hub_match);
Greg Kroah-Hartman
maintainerPATCH 86/917 mt76: mt7615: fix skb use-after-free on mac reset
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
commit b5cd1fd6043bbb7c5810067b5f93f3016bfd8a6f upstream.
When clearing all existing pending tx slots, mt76_tx_complete_skb needs to be used to free the skbs, to ensure that they are cleared from the status list as well.
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 45 ++++++++++++------------ 1 file changed, 23 insertions(+), 22 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +23 -22
@@ -1494,32 +1494,41 @@ out: }static void -mt7615_mac_tx_free_token (struct mt7615_dev *dev,u16 token) +mt7615_txwi_free (struct mt7615_dev *dev,struct mt76_txwi_cache *txwi) {struct mt76_dev *mdev = &dev->mt76; -struct mt76_txwi_cache *txwi;__le32 *txwi_data;u32 val;u8 wcid; -trace_mac_tx_free (dev, token); - txwi =mt76_token_put (mdev, token); -if (!txwi) -return ; +mt7615_txp_skb_unmap (mdev, txwi); +if (!txwi->skb) + goto out; txwi_data = (__le32 *)mt76_get_txwi_ptr (mdev, txwi); val =le32_to_cpu (txwi_data[1 ]); wcid =FIELD_GET (MT_TXD1_WLAN_IDX , val); +mt76_tx_complete_skb (mdev, wcid, txwi->skb); -mt7615_txp_skb_unmap (mdev, txwi); -if (txwi->skb) { -mt76_tx_complete_skb (mdev, wcid, txwi->skb); - txwi->skb =NULL ; - } - +out: + txwi->skb =NULL ;mt76_put_txwi (mdev, txwi); } +static void +mt7615_mac_tx_free_token (struct mt7615_dev *dev,u16 token) +{ +struct mt76_dev *mdev = &dev->mt76; +struct mt76_txwi_cache *txwi; + +trace_mac_tx_free (dev, token); + txwi =mt76_token_put (mdev, token); +if (!txwi) +return ; + +mt7615_txwi_free (dev, txwi); +} +static void mt7615_mac_tx_free (struct mt7615_dev *dev,struct sk_buff *skb) {struct mt7615_tx_free *free = (struct mt7615_tx_free *)skb->data;
@@ -2026,16 +2035,8 @@ void mt7615_tx_token_put(struct mt7615_dint id;spin_lock_bh (&dev->mt76.token_lock); -idr_for_each_entry (&dev->mt76.token, txwi, id) { -mt7615_txp_skb_unmap (&dev->mt76, txwi); -if (txwi->skb) { -struct ieee80211_hw *hw; - - hw =mt76_tx_status_get_hw (&dev->mt76, txwi->skb); -ieee80211_free_txskb (hw, txwi->skb); - } -mt76_put_txwi (&dev->mt76, txwi); - } +idr_for_each_entry (&dev->mt76.token, txwi, id) +mt7615_txwi_free (dev, txwi);spin_unlock_bh (&dev->mt76.token_lock);idr_destroy (&dev->mt76.token); }
Greg Kroah-Hartman
maintainerPATCH 88/917 HID: surface-hid: Allow driver matching for target ID 1 devices
In reply to Greg Kroah-HartmanFrom: Maximilian Luz <[email protected]>
commit ab5fe33925c6b03f646a1153771dab047548e4d8 upstream.
Until now we have only ever seen HID devices with target ID 2. The new Surface Laptop Studio however uses HID devices with target ID 1. Allow matching this driver to those as well.
--- drivers/hid/surface-hid/surface_hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/surface-hid/surface_hid.c +1 -1
@@ -230,7 +230,7 @@ static void surface_hid_remove(struct ss }static const struct ssam_device_id surface_hid_match[] = { - {SSAM_SDEV (HID ,0x02 ,SSAM_ANY_IID ,0x00 ) }, + {SSAM_SDEV (HID ,SSAM_ANY_TID ,SSAM_ANY_IID ,0x00 ) }, { }, };MODULE_DEVICE_TABLE (ssam, surface_hid_match);
Greg Kroah-Hartman
maintainerPATCH 90/917 wcn36xx: Fix tx_status mechanism
In reply to Greg Kroah-HartmanFrom: Loic Poulain <[email protected]>
commit a9e79b116cc4d0057e912be8f40b2c2e5bdc7c43 upstream.
This change fix the TX ack mechanism in various ways:
- For NO_ACK tagged packets, we don't need to wait for TX_ACK indication and so are not subject to the single packet ack limitation. So we don't have to stop the tx queue, and can call the tx status callback as soon as DMA transfer has completed.
- Fix skb ownership/reference. Only start status indication timeout once the DMA transfer has been completed. This avoids the skb to be both referenced in the DMA tx ring and by the tx_ack_skb pointer, preventing any use-after-free or double-free.
- This adds a sanity (paranoia?) check on the skb tx ack pointer.
- Resume TX queue if TX status tagged packet TX fails.
--- drivers/net/wireless/ath/wcn36xx/dxe.c | 37 ++++++++++++-------------------- drivers/net/wireless/ath/wcn36xx/txrx.c | 31 +++++--------------------- 2 files changed, 21 insertions(+), 47 deletions(-)
drivers/net/wireless/ath/wcn36xx/dxe.c +15 -22
@@ -403,8 +403,21 @@ static void reap_tx_dxes(struct wcn36xxdma_unmap_single (wcn->dev, ctl->desc->src_addr_l, ctl->skb->len,DMA_TO_DEVICE ); info =IEEE80211_SKB_CB (ctl->skb); -if (!(info->flags &IEEE80211_TX_CTL_REQ_TX_STATUS )) { -/* Keep frame until TX status comes */ +if (info->flags &IEEE80211_TX_CTL_REQ_TX_STATUS ) { +if (info->flags &IEEE80211_TX_CTL_NO_ACK ) { + info->flags |=IEEE80211_TX_STAT_NOACK_TRANSMITTED ; +ieee80211_tx_status_irqsafe (wcn->hw, ctl->skb); + }else { +/* Wait for the TX ack indication or timeout... */ +spin_lock (&wcn->dxe_lock); +if (WARN_ON (wcn->tx_ack_skb)) +ieee80211_free_txskb (wcn->hw, wcn->tx_ack_skb); + wcn->tx_ack_skb = ctl->skb;/* Tracking ref */ +mod_timer (&wcn->tx_ack_timer, jiffies +HZ /10 ); +spin_unlock (&wcn->dxe_lock); + } +/* do not free, ownership transferred to mac80211 status cb */ + }else {ieee80211_free_txskb (wcn->hw, ctl->skb); }
@@ -426,7 +439,6 @@ static irqreturn_t wcn36xx_irq_tx_comple {struct wcn36xx *wcn = (struct wcn36xx *)dev;int int_src, int_reason; -bool transmitted = false;wcn36xx_dxe_read_register (wcn,WCN36XX_DXE_INT_SRC_RAW_REG , &int_src);
@@ -466,7 +478,6 @@ static irqreturn_t wcn36xx_irq_tx_compleif (int_reason & (WCN36XX_CH_STAT_INT_DONE_MASK |WCN36XX_CH_STAT_INT_ED_MASK )) {reap_tx_dxes (wcn, &wcn->dxe_tx_h_ch); - transmitted = true; } }
@@ -479,7 +490,6 @@ static irqreturn_t wcn36xx_irq_tx_compleWCN36XX_DXE_0_INT_CLR , WCN36XX_INT_MASK_CHAN_TX_L); -if (int_reason &WCN36XX_CH_STAT_INT_ERR_MASK ) { wcn36xx_dxe_write_register(wcn, WCN36XX_DXE_0_INT_ERR_CLR,
@@ -507,25 +517,8 @@ static irqreturn_t wcn36xx_irq_tx_compleif (int_reason & (WCN36XX_CH_STAT_INT_DONE_MASK |WCN36XX_CH_STAT_INT_ED_MASK )) {reap_tx_dxes (wcn, &wcn->dxe_tx_l_ch); - transmitted = true; - } - } - -spin_lock (&wcn->dxe_lock); -if (wcn->tx_ack_skb && transmitted) { -struct ieee80211_tx_info *info =IEEE80211_SKB_CB (wcn->tx_ack_skb); - -/* TX complete, no need to wait for 802.11 ack indication */ -if (info->flags &IEEE80211_TX_CTL_REQ_TX_STATUS && - info->flags &IEEE80211_TX_CTL_NO_ACK ) { - info->flags |=IEEE80211_TX_STAT_NOACK_TRANSMITTED ; -del_timer (&wcn->tx_ack_timer); -ieee80211_tx_status_irqsafe (wcn->hw, wcn->tx_ack_skb); - wcn->tx_ack_skb =NULL ; -ieee80211_wake_queues (wcn->hw); } } -spin_unlock (&wcn->dxe_lock);return IRQ_HANDLED ; }
drivers/net/wireless/ath/wcn36xx/txrx.c +6 -25
@@ -502,10 +502,11 @@ int wcn36xx_start_tx(struct wcn36xx *wcnstruct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;struct wcn36xx_vif *vif_priv =NULL ;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb); -unsigned long flags;bool is_low =ieee80211_is_data (hdr->frame_control);bool bcast =is_broadcast_ether_addr (hdr->addr1) ||is_multicast_ether_addr (hdr->addr1); +bool ack_ind = (info->flags &IEEE80211_TX_CTL_REQ_TX_STATUS ) && + !(info->flags &IEEE80211_TX_CTL_NO_ACK );struct wcn36xx_tx_bd bd;int ret;
@@ -521,30 +522,16 @@ int wcn36xx_start_tx(struct wcn36xx *wcn bd.dpu_rf =WCN36XX_BMU_WQ_TX ; -if (info->flags &IEEE80211_TX_CTL_REQ_TX_STATUS ) { +if (unlikely (ack_ind)) {wcn36xx_dbg (WCN36XX_DBG_DXE ,"TX_ACK status requested\n" ); -spin_lock_irqsave (&wcn->dxe_lock, flags); -if (wcn->tx_ack_skb) { -spin_unlock_irqrestore (&wcn->dxe_lock, flags); -wcn36xx_warn ("tx_ack_skb already set\n" ); -return -EINVAL ; - } - - wcn->tx_ack_skb = skb; -spin_unlock_irqrestore (&wcn->dxe_lock, flags); -/* Only one at a time is supported by fw. Stop the TX queues * until the ack status gets back. */ ieee80211_stop_queues (wcn->hw); -/* TX watchdog if no TX irq or ack indication received */ -mod_timer (&wcn->tx_ack_timer, jiffies +HZ /10 ); -/* Request ack indication from the firmware */ -if (!(info->flags &IEEE80211_TX_CTL_NO_ACK )) - bd.tx_comp =1 ; + bd.tx_comp =1 ; }/* Data frames served first*/
@@ -558,14 +545,8 @@ int wcn36xx_start_tx(struct wcn36xx *wcn bd.tx_bd_sign =0xbdbdbdbd ; ret =wcn36xx_dxe_tx_frame (wcn, vif_priv, &bd, skb, is_low); -if (ret && (info->flags &IEEE80211_TX_CTL_REQ_TX_STATUS )) { -/* If the skb has not been transmitted, -* don't keep a reference to it. -*/ -spin_lock_irqsave (&wcn->dxe_lock, flags); - wcn->tx_ack_skb =NULL ; -spin_unlock_irqrestore (&wcn->dxe_lock, flags); - +if (unlikely (ret && ack_ind)) { +/* If the skb has not been transmitted, resume TX queue */ ieee80211_wake_queues (wcn->hw); }
Greg Kroah-Hartman
maintainerPATCH 91/917 wcn36xx: Fix (QoS) null data frame bitrate/modulation
In reply to Greg Kroah-HartmanFrom: Loic Poulain <[email protected]>
commit d3fd2c95c1c13ec217d43ebef3c61cfa00a6cd37 upstream.
We observe unexpected connection drops with some APs due to non-acked mac80211 generated null data frames (keep-alive). After debugging and capture, we noticed that null frames are submitted at standard data bitrate and that the given APs are in trouble with that.
After setting the null frame bitrate to control bitrate, all null frames are acked as expected and connection is maintained.
Not sure if it's a requirement of the specification, but it seems the right thing to do anyway, null frames are mostly used for control purpose (power-saving, keep-alive...), and submitting them with a slower/simpler bitrate/modulation is more robust.
--- drivers/net/wireless/ath/wcn36xx/txrx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/wcn36xx/txrx.c +1 -0
@@ -429,6 +429,7 @@ static void wcn36xx_set_tx_data(struct wif (ieee80211_is_any_nullfunc (hdr->frame_control)) {/* Don't use a regular queue for null packet (no ampdu) */ bd->queue_id =WCN36XX_TX_U_WQ_ID ; + bd->bd_rate =WCN36XX_BD_RATE_CTRL ; }if (bcast) {
Greg Kroah-Hartman
maintainerPATCH 95/917 libata: fix checking of DMA state
In reply to Greg Kroah-HartmanFrom: Reimar Döffinger <[email protected]>
commit f971a85439bd25dc7b4d597cf5e4e8dc7ffc884b upstream.
Checking if DMA is enabled should be done via the ata_dma_enabled helper function, since the init state 0xff indicates disabled.
This meant that ATA_CMD_READ_LOG_DMA_EXT was used and probed for before DMA was enabled, which caused hangs for some combinations of controllers and devices.
It might also have caused it to be incorrectly disabled as broken, but there have been no reports of that.
--- drivers/ata/libata-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-core.c +1 -1
@@ -2007,7 +2007,7 @@ unsigned int ata_read_log_page(struct at retry:ata_tf_init (dev, &tf); -if (dev->dma_mode &&ata_id_has_read_log_dma_ext (dev->id) && +if (ata_dma_enabled (dev) &&ata_id_has_read_log_dma_ext (dev->id) && !(dev->horkage &ATA_HORKAGE_NO_DMA_LOG )) { tf.command =ATA_CMD_READ_LOG_DMA_EXT ; tf.protocol =ATA_PROT_DMA ;
Greg Kroah-Hartman
maintainerPATCH 97/917 wcn36xx: handle connection loss indication
In reply to Greg Kroah-HartmanFrom: Benjamin Li <[email protected]>
commit d6dbce453b19c64b96f3e927b10230f9a704b504 upstream.
Firmware sends delete_sta_context_ind when it detects the AP has gone away in STA mode. Right now the handler for that indication only handles AP mode; fix it to also handle STA mode.
--- drivers/net/wireless/ath/wcn36xx/smd.c | 44 ++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 11 deletions(-)
drivers/net/wireless/ath/wcn36xx/smd.c +33 -11
@@ -2623,30 +2623,52 @@ static int wcn36xx_smd_delete_sta_contex size_t len) {struct wcn36xx_hal_delete_sta_context_ind_msg *rsp = buf; -struct wcn36xx_vif *tmp; +struct wcn36xx_vif *vif_priv; +struct ieee80211_vif *vif; +struct ieee80211_bss_conf *bss_conf;struct ieee80211_sta *sta; +bool found = false;if (len !=sizeof (*rsp)) {wcn36xx_warn ("Corrupted delete sta indication\n" );return -EIO ; } -wcn36xx_dbg (WCN36XX_DBG_HAL ,"delete station indication %pM index %d\n" , - rsp->addr2, rsp->sta_id); +wcn36xx_dbg (WCN36XX_DBG_HAL , +"delete station indication %pM index %d reason %d\n" , + rsp->addr2, rsp->sta_id, rsp->reason_code); -list_for_each_entry (tmp, &wcn->vif_list, list) { +list_for_each_entry (vif_priv, &wcn->vif_list, list) {rcu_read_lock (); - sta =ieee80211_find_sta (wcn36xx_priv_to_vif (tmp), rsp->addr2); -if (sta) -ieee80211_report_low_ack (sta,0 ); + vif =wcn36xx_priv_to_vif (vif_priv); + +if (vif->type ==NL80211_IFTYPE_STATION ) { +/* We could call ieee80211_find_sta too, but checking +* bss_conf is clearer. +*/ + bss_conf = &vif->bss_conf; +if (vif_priv->sta_assoc && + !memcmp (bss_conf->bssid, rsp->addr2,ETH_ALEN )) { + found = true; +wcn36xx_dbg (WCN36XX_DBG_HAL , +"connection loss bss_index %d\n" , + vif_priv->bss_index); +ieee80211_connection_loss (vif); + } + }else { + sta =ieee80211_find_sta (vif, rsp->addr2); +if (sta) { + found = true; +ieee80211_report_low_ack (sta,0 ); + } + } +rcu_read_unlock (); -if (sta) +if (found)return 0 ; } -wcn36xx_warn ("STA with addr %pM and index %d not found\n" , - rsp->addr2, - rsp->sta_id); +wcn36xx_warn ("BSS or STA with addr %pM not found\n" , rsp->addr2);return -ENOENT ; }
Greg Kroah-Hartman
maintainerPATCH 108/917 signal: Remove the bogus sigkill_pending in ptrace_stop
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
commit 7d613f9f72ec8f90ddefcae038fdae5adb8404b3 upstream.
The existence of sigkill_pending is a little silly as it is functionally a duplicate of fatal_signal_pending that is used in exactly one place.
Checking for pending fatal signals and returning early in ptrace_stop is actively harmful. It casues the ptrace_stop called by ptrace_signal to return early before setting current->exit_code. Later when ptrace_signal reads the signal number from current->exit_code is undefined, making it unpredictable what will happen.
Instead rely on the fact that schedule will not sleep if there is a pending signal that can awaken a task.
Removing the explict sigkill_pending test fixes fixes ptrace_signal when ptrace_stop does not stop because current->exit_code is always set to to signr.
--- kernel/signal.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
kernel/signal.c +4 -14
@@ -2169,15 +2169,6 @@ static inline bool may_ptrace_stop(void)return true; } -/* -* Return non-zero if there is a SIGKILL that should be waking us up. -* Called with the siglock held. -*/ -static bool sigkill_pending (struct task_struct *tsk) -{ -return sigismember (&tsk->pending.signal,SIGKILL ) || -sigismember (&tsk->signal->shared_pending.signal,SIGKILL ); -}/* * This must be called with current->sighand->siglock held.
@@ -2204,17 +2195,16 @@ static void ptrace_stop(int exit_code, i* calling arch_ptrace_stop, so we must release it now. * To preserve proper semantics, we must do this before * any signal bookkeeping like checking group_stop_count. -* Meanwhile, a SIGKILL could come in before we retake the -* siglock. That must prevent us from sleeping in TASK_TRACED. -* So after regaining the lock, we must check for SIGKILL. */ spin_unlock_irq (¤t->sighand->siglock);arch_ptrace_stop (exit_code, info);spin_lock_irq (¤t->sighand->siglock); -if (sigkill_pending (current)) -return ; } +/* +* schedule() will not sleep if there is a pending signal that +* can awaken the task. +*/ set_special_state (TASK_TRACED );/*
Greg Kroah-Hartman
maintainerPATCH 118/917 power: supply: max17042_battery: use VFSOC for capacity when no rsns
In reply to Greg Kroah-HartmanFrom: Henrik Grimler <[email protected]>
commit 223a3b82834f036a62aa831f67cbf1f1d644c6e2 upstream.
On Galaxy S3 (i9300/i9305), which has the max17047 fuel gauge and no current sense resistor (rsns), the RepSOC register does not provide an accurate state of charge value. The reported value is wrong, and does not change over time. VFSOC however, which uses the voltage fuel gauge to determine the state of charge, always shows an accurate value.
For devices without current sense, VFSOC is already used for the soc-alert (0x0003 is written to MiscCFG register), so with this change the source of the alert and the PROP_CAPACITY value match.
--- drivers/power/supply/max17042_battery.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/power/supply/max17042_battery.c +4 -1
@@ -313,7 +313,10 @@ static int max17042_get_property(struct val->intval = data *625 /8 ;break ;case POWER_SUPPLY_PROP_CAPACITY : - ret =regmap_read (map, MAX17042_RepSOC, &data); +if (chip->pdata->enable_current_sense) + ret =regmap_read (map, MAX17042_RepSOC, &data); +else + ret =regmap_read (map,MAX17042_VFSOC , &data);if (ret <0 )return ret;
Greg Kroah-Hartman
maintainerPATCH 126/917 can: peak_usb: always ask for BERR reporting for PCAN-USB devices
In reply to Greg Kroah-HartmanFrom: Stephane Grosjean <[email protected]>
commit 3f1c7aa28498e52a5e6aa2f1b89bf35c63352cfd upstream.
Since for the PCAN-USB, the management of the transition to the ERROR_WARNING or ERROR_PASSIVE state is done according to the error counters, these must be requested unconditionally.
--- drivers/net/can/usb/peak_usb/pcan_usb.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/net/can/usb/peak_usb/pcan_usb.c +8 -9
@@ -841,14 +841,14 @@ static int pcan_usb_start(struct peak_us pdev->bec.rxerr =0 ; pdev->bec.txerr =0 ; -/* be notified on error counter changes (if requested by user) */ -if (dev->can.ctrlmode &CAN_CTRLMODE_BERR_REPORTING ) { - err =pcan_usb_set_err_frame (dev,PCAN_USB_BERR_MASK ); -if (err) -netdev_warn (dev->netdev, -"Asking for BERR reporting error %u\n" , - err); - } +/* always ask the device for BERR reporting, to be able to switch from +* WARNING to PASSIVE state +*/ + err =pcan_usb_set_err_frame (dev,PCAN_USB_BERR_MASK ); +if (err) +netdev_warn (dev->netdev, +"Asking for BERR reporting error %u\n" , + err);/* if revision greater than 3, can put silent mode on/off */ if (dev->device_rev >3 ) {
@@ -986,7 +986,6 @@ const struct peak_usb_adapter pcan_usb = .device_id = PCAN_USB_PRODUCT_ID, .ctrl_count = 1, .ctrlmode_supported =CAN_CTRLMODE_3_SAMPLES |CAN_CTRLMODE_LISTENONLY | -CAN_CTRLMODE_BERR_REPORTING | CAN_CTRLMODE_CC_LEN8_DLC, .clock = { .freq = PCAN_USB_CRYSTAL_HZ / 2,
Greg Kroah-Hartman
maintainerPATCH 127/917 can: mcp251xfd: mcp251xfd_irq(): add missing can_rx_offload_threaded_irq_finish() in case of bus off
In reply to Greg Kroah-HartmanFrom: Marc Kleine-Budde <[email protected]>
commit 691204bd66b34ba982e19988e6eba9f6321dfe6c upstream.
The function can_rx_offload_threaded_irq_finish() is needed to trigger the NAPI thread to deliver read CAN frames to the networking stack.
This patch adds the missing call to can_rx_offload_threaded_irq_finish() in case of a bus off, before leaving the interrupt handler to avoid packet starvation.
--- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +3 -1
@@ -2290,8 +2290,10 @@ static irqreturn_t mcp251xfd_irq(int irq* check will fail, too. So leave IRQ handler * directly. */ -if (priv->can.state ==CAN_STATE_BUS_OFF ) +if (priv->can.state ==CAN_STATE_BUS_OFF ) { +can_rx_offload_threaded_irq_finish (&priv->offload);return IRQ_HANDLED ; + } } handled =IRQ_HANDLED ;
Greg Kroah-Hartman
maintainerPATCH 139/917 ovl: fix filattr copy-up failure
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
commit 5b0a414d06c3ed2097e32ef7944a4abb644b89bd upstream.
This regression can be reproduced with ntfs-3g and overlayfs:
mkdir lower upper work overlay
dd if=/dev/zero of=ntfs.raw bs=1M count=2
mkntfs -F ntfs.raw
mount ntfs.raw lower
touch lower/file.txt
mount -t overlay -o lowerdir=lower,upperdir=upper,workdir=work - overlay mv overlay/file.txt overlay/file2.txt
mv fails and (misleadingly) prints
mv: cannot move 'overlay/file.txt' to a subdirectory of itself, 'overlay/file2.txt'
The reason is that ovl_copy_fileattr() is triggered due to S_NOATIME being set on all inodes (by fuse) regardless of fileattr.
ovl_copy_fileattr() tries to retrieve file attributes from lower file, but that fails because filesystem does not support this ioctl (this should fail with ENOTTY, but ntfs-3g return EINVAL instead). This failure is propagated to origial operation (in this case rename) that triggered the copy-up.
The fix is to ignore ENOTTY and EINVAL errors from fileattr_get() in copy up. This also requires turning the internal ENOIOCTLCMD into ENOTTY.
As a further measure to prevent unnecessary failures, only try the fileattr_get/set on upper if there are any flags to copy up.
Side note: a number of filesystems set S_NOATIME (and sometimes other inode flags) irrespective of fileattr flags. This causes unnecessary calls during copy up, which might lead to a performance issue, especially if latency is high. To fix this, the kernel would need to differentiate between the two cases. E.g. introduce SB_NOATIME_UPDATE, a per-sb variant of S_NOATIME. SB_NOATIME doesn't work, because that's interpreted as "filesystem doesn't store an atime attribute"
--- fs/overlayfs/copy_up.c | 23 ++++++++++++++++++----- fs/overlayfs/inode.c | 5 ++++- 2 files changed, 22 insertions(+), 6 deletions(-)
fs/overlayfs/copy_up.c +18 -5
@@ -140,12 +140,14 @@ static int ovl_copy_fileattr(struct inodint err; err =ovl_real_fileattr_get (old, &oldfa); -if (err) -return err; - - err =ovl_real_fileattr_get (new, &newfa); -if (err) +if (err) { +/* Ntfs-3g returns -EINVAL for "no fileattr support" */ +if (err == -ENOTTY || err == -EINVAL ) +return 0 ; +pr_warn ("failed to retrieve lower fileattr (%pd2, err=%i)\n" , + old, err);return err; + }/* * We cannot set immutable and append-only flags on upper inode,
@@ -159,6 +161,17 @@ static int ovl_copy_fileattr(struct inodreturn err; } +/* Don't bother copying flags if none are set */ +if (!(oldfa.flags &OVL_COPY_FS_FLAGS_MASK )) +return 0 ; + + err =ovl_real_fileattr_get (new, &newfa); +if (err) { +pr_warn ("failed to retrieve upper fileattr (%pd2, err=%i)\n" , + new, err); +return err; + } +BUILD_BUG_ON (OVL_COPY_FS_FLAGS_MASK & ~FS_COMMON_FL ); newfa.flags &= ~OVL_COPY_FS_FLAGS_MASK ; newfa.flags |= (oldfa.flags &OVL_COPY_FS_FLAGS_MASK );
fs/overlayfs/inode.c +4 -1
@@ -610,7 +610,10 @@ int ovl_real_fileattr_get(struct path *rif (err)return err; -return vfs_fileattr_get (realpath->dentry, fa); + err =vfs_fileattr_get (realpath->dentry, fa); +if (err == -ENOIOCTLCMD ) + err = -ENOTTY ; +return err; }int ovl_fileattr_get (struct dentry *dentry,struct fileattr *fa)
Greg Kroah-Hartman
maintainerPATCH 143/917 PCI: aardvark: Do not clear status bits of masked interrupts
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit a7ca6d7fa3c02c032db5440ff392d96c04684c21 upstream.
The PCIE_ISR1_REG says which interrupts are currently set / active, including those which are masked.
The driver currently reads this register and looks if some unmasked interrupts are active, and if not, it clears status bits of _all_ interrupts, including the masked ones.
This is incorrect, since, for example, some drivers may poll these bits.
Remove this clearing, and also remove this early return statement completely, since it does not change functionality in any way.
--- drivers/pci/controller/pci-aardvark.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/pci/controller/pci-aardvark.c +0 -6
@@ -1286,12 +1286,6 @@ static void advk_pcie_handle_int(struct isr1_mask =advk_readl (pcie,PCIE_ISR1_MASK_REG ); isr1_status = isr1_val & ((~isr1_mask) &PCIE_ISR1_ALL_MASK ); -if (!isr0_status && !isr1_status) { -advk_writel (pcie, isr0_val,PCIE_ISR0_REG ); -advk_writel (pcie, isr1_val,PCIE_ISR1_REG ); -return ; - } -/* Process MSI interrupts */ if (isr0_status &PCIE_ISR0_MSI_INT_PENDING )advk_pcie_handle_msi (pcie);
Greg Kroah-Hartman
maintainerPATCH 144/917 PCI: aardvark: Fix checking for link up via LTSSM state
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 661c399a651c11aaf83c45cbfe0b4a1fb7bc3179 upstream.
Current implementation of advk_pcie_link_up() is wrong as it marks also link disabled or hot reset states as link up.
Fix it by marking link up only to those states which are defined in PCIe Base specification 3.0, Table 4-14: Link Status Mapped to the LTSSM.
To simplify implementation, Define macros for every LTSSM state which aardvark hardware can return in CFG_REG register.
Fix also checking for link training according to the same Table 4-14. Define a new function advk_pcie_link_training() for this purpose.
--- drivers/pci/controller/pci-aardvark.c | 76 +++++++++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 6 deletions(-)
drivers/pci/controller/pci-aardvark.c +70 -6
@@ -164,8 +164,50 @@#define CFG_REG (LMI_BASE_ADDR + 0x0)#define LTSSM_SHIFT 24#define LTSSM_MASK 0x3f -#define LTSSM_L0 0x10#define RC_BAR_CONFIG 0x300 + +/* LTSSM values in CFG_REG */ +enum { +LTSSM_DETECT_QUIET =0x0 , +LTSSM_DETECT_ACTIVE =0x1 , +LTSSM_POLLING_ACTIVE =0x2 , +LTSSM_POLLING_COMPLIANCE =0x3 , +LTSSM_POLLING_CONFIGURATION =0x4 , +LTSSM_CONFIG_LINKWIDTH_START =0x5 , +LTSSM_CONFIG_LINKWIDTH_ACCEPT =0x6 , +LTSSM_CONFIG_LANENUM_ACCEPT =0x7 , +LTSSM_CONFIG_LANENUM_WAIT =0x8 , +LTSSM_CONFIG_COMPLETE =0x9 , +LTSSM_CONFIG_IDLE =0xa , +LTSSM_RECOVERY_RCVR_LOCK =0xb , +LTSSM_RECOVERY_SPEED =0xc , +LTSSM_RECOVERY_RCVR_CFG =0xd , +LTSSM_RECOVERY_IDLE =0xe , +LTSSM_L0 =0x10 , +LTSSM_RX_L0S_ENTRY =0x11 , +LTSSM_RX_L0S_IDLE =0x12 , +LTSSM_RX_L0S_FTS =0x13 , +LTSSM_TX_L0S_ENTRY =0x14 , +LTSSM_TX_L0S_IDLE =0x15 , +LTSSM_TX_L0S_FTS =0x16 , +LTSSM_L1_ENTRY =0x17 , +LTSSM_L1_IDLE =0x18 , +LTSSM_L2_IDLE =0x19 , +LTSSM_L2_TRANSMIT_WAKE =0x1a , +LTSSM_DISABLED =0x20 , +LTSSM_LOOPBACK_ENTRY_MASTER =0x21 , +LTSSM_LOOPBACK_ACTIVE_MASTER =0x22 , +LTSSM_LOOPBACK_EXIT_MASTER =0x23 , +LTSSM_LOOPBACK_ENTRY_SLAVE =0x24 , +LTSSM_LOOPBACK_ACTIVE_SLAVE =0x25 , +LTSSM_LOOPBACK_EXIT_SLAVE =0x26 , +LTSSM_HOT_RESET =0x27 , +LTSSM_RECOVERY_EQUALIZATION_PHASE0 =0x28 , +LTSSM_RECOVERY_EQUALIZATION_PHASE1 =0x29 , +LTSSM_RECOVERY_EQUALIZATION_PHASE2 =0x2a , +LTSSM_RECOVERY_EQUALIZATION_PHASE3 =0x2b , +}; +#define VENDOR_ID_REG (LMI_BASE_ADDR + 0x44)/* PCIe core controller registers */
@@ -262,13 +304,35 @@ static inline u16 advk_read16(struct advreturn advk_readl (pcie, (reg & ~0x3 )) >> ((reg &0x3 ) *8 ); } -static int advk_pcie_link_up (struct advk_pcie *pcie) +static u8 advk_pcie_ltssm_state (struct advk_pcie *pcie) { -u32 val, ltssm_state; +u32 val; +u8 ltssm_state; val =advk_readl (pcie,CFG_REG ); ltssm_state = (val >>LTSSM_SHIFT ) <SSM_MASK ; -return ltssm_state >=LTSSM_L0 ; +return ltssm_state; +} + +static inline bool advk_pcie_link_up (struct advk_pcie *pcie) +{ +/* check if LTSSM is in normal operation - some L* state */ +u8 ltssm_state =advk_pcie_ltssm_state (pcie); +return ltssm_state >=LTSSM_L0 && ltssm_state <LTSSM_DISABLED ; +} + +static inline bool advk_pcie_link_training (struct advk_pcie *pcie) +{ +/* +* According to PCIe Base specification 3.0, Table 4-14: Link +* Status Mapped to the LTSSM is Link Training mapped to LTSSM +* Configuration and Recovery states. +*/ +u8 ltssm_state =advk_pcie_ltssm_state (pcie); +return ((ltssm_state >=LTSSM_CONFIG_LINKWIDTH_START && + ltssm_state <LTSSM_L0 ) || + (ltssm_state >=LTSSM_RECOVERY_EQUALIZATION_PHASE0 && + ltssm_state <=LTSSM_RECOVERY_EQUALIZATION_PHASE3 )); }static int advk_pcie_wait_for_link (struct advk_pcie *pcie)
@@ -291,7 +355,7 @@ static void advk_pcie_wait_for_retrain(ssize_t retries;for (retries =0 ; retries <RETRAIN_WAIT_MAX_RETRIES ; ++retries) { -if (!advk_pcie_link_up (pcie)) +if (advk_pcie_link_training (pcie))break ;udelay (RETRAIN_WAIT_USLEEP_US ); }
@@ -738,7 +802,7 @@ advk_pci_bridge_emul_pcie_conf_read(stru/* u32 contains both PCI_EXP_LNKCTL and PCI_EXP_LNKSTA */ u32 val =advk_readl (pcie,PCIE_CORE_PCIEXP_CAP + reg) & ~(PCI_EXP_LNKSTA_LT <<16 ); -if (!advk_pcie_link_up (pcie)) +if (advk_pcie_link_training (pcie)) val |= (PCI_EXP_LNKSTA_LT <<16 ); *value = val;return PCI_BRIDGE_EMUL_HANDLED ;
Greg Kroah-Hartman
maintainerPATCH 146/917 PCI: aardvark: Fix reporting Data Link Layer Link Active
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 2b650b7ff20eb7ea8ef9031d20fb657286ab90cc upstream.
Add support for reporting PCI_EXP_LNKSTA_DLLLA bit in Link Control register on emulated bridge via current LTSSM state. Also correctly indicate DLLLA capability via PCI_EXP_LNKCAP_DLLLARC bit in Link Control Capability register.
--- drivers/pci/controller/pci-aardvark.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +28 -1
@@ -321,6 +321,20 @@ static inline bool advk_pcie_link_up(strreturn ltssm_state >=LTSSM_L0 && ltssm_state <LTSSM_DISABLED ; } +static inline bool advk_pcie_link_active (struct advk_pcie *pcie) +{ +/* +* According to PCIe Base specification 3.0, Table 4-14: Link +* Status Mapped to the LTSSM, and 4.2.6.3.6 Configuration.Idle +* is Link Up mapped to LTSSM Configuration.Idle, Recovery, L0, +* L0s, L1 and L2 states. And according to 3.2.1. Data Link +* Control and Management State Machine Rules is DL Up status +* reported in DL Active state. +*/ +u8 ltssm_state =advk_pcie_ltssm_state (pcie); +return ltssm_state >=LTSSM_CONFIG_IDLE && ltssm_state <LTSSM_DISABLED ; +} +static inline bool advk_pcie_link_training (struct advk_pcie *pcie) {/*
@@ -798,12 +812,26 @@ advk_pci_bridge_emul_pcie_conf_read(strureturn PCI_BRIDGE_EMUL_HANDLED ; } +case PCI_EXP_LNKCAP : { +u32 val =advk_readl (pcie,PCIE_CORE_PCIEXP_CAP + reg); +/* +* PCI_EXP_LNKCAP_DLLLARC bit is hardwired in aardvark HW to 0. +* But support for PCI_EXP_LNKSTA_DLLLA is emulated via ltssm +* state so explicitly enable PCI_EXP_LNKCAP_DLLLARC flag. +*/ + val |=PCI_EXP_LNKCAP_DLLLARC ; + *value = val; +return PCI_BRIDGE_EMUL_HANDLED ; + } +case PCI_EXP_LNKCTL : {/* u32 contains both PCI_EXP_LNKCTL and PCI_EXP_LNKSTA */ u32 val =advk_readl (pcie,PCIE_CORE_PCIEXP_CAP + reg) & ~(PCI_EXP_LNKSTA_LT <<16 );if (advk_pcie_link_training (pcie)) val |= (PCI_EXP_LNKSTA_LT <<16 ); +if (advk_pcie_link_active (pcie)) + val |= (PCI_EXP_LNKSTA_DLLLA <<16 ); *value = val;return PCI_BRIDGE_EMUL_HANDLED ; }
@@ -811,7 +839,6 @@ advk_pci_bridge_emul_pcie_conf_read(strucase PCI_CAP_LIST_ID :case PCI_EXP_DEVCAP :case PCI_EXP_DEVCTL : -case PCI_EXP_LNKCAP : *value =advk_readl (pcie,PCIE_CORE_PCIEXP_CAP + reg);return PCI_BRIDGE_EMUL_HANDLED ;default :
Greg Kroah-Hartman
maintainerPATCH 149/917 PCI: aardvark: Read all 16-bits from PCIE_MSI_PAYLOAD_REG
In reply to Greg Kroah-HartmanFrom: Marek Behún <[email protected]>
commit 95997723b6402cd6c53e0f9e7ac640ec64eaaff8 upstream.
The PCIE_MSI_PAYLOAD_REG contains 16-bit MSI number, not only lower 8 bits. Fix reading content of this register and add a comment describing the access to this register.
--- drivers/pci/controller/pci-aardvark.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +6 -1
@@ -119,6 +119,7 @@#define PCIE_MSI_STATUS_REG (CONTROL_BASE_ADDR + 0x58)#define PCIE_MSI_MASK_REG (CONTROL_BASE_ADDR + 0x5C)#define PCIE_MSI_PAYLOAD_REG (CONTROL_BASE_ADDR + 0x9C) +#define PCIE_MSI_DATA_MASK GENMASK(15, 0)/* PCIe window configuration */ #define OB_WIN_BASE_ADDR 0x4c00
@@ -1361,8 +1362,12 @@ static void advk_pcie_handle_msi(structif (!(BIT (msi_idx) & msi_status))continue ; +/* +* msi_idx contains bits [4:0] of the msi_data and msi_data +* contains 16bit MSI interrupt number +*/ advk_writel (pcie,BIT (msi_idx),PCIE_MSI_STATUS_REG ); - msi_data =advk_readl (pcie,PCIE_MSI_PAYLOAD_REG ) &0xFF ; + msi_data =advk_readl (pcie,PCIE_MSI_PAYLOAD_REG ) &PCIE_MSI_DATA_MASK ;generic_handle_irq (msi_data); }
Greg Kroah-Hartman
maintainerPATCH 128/917 can: j1939: j1939_tp_cmd_recv(): ignore abort message in the BAM transport
In reply to Greg Kroah-HartmanFrom: Zhang Changzhong <[email protected]>
commit c0f49d98006f2db3333b917caac65bce2af9865c upstream.
This patch prevents BAM transport from being closed by receiving abort message, as specified in SAE-J1939-82 2015 (A.3.3 Row 4).
--- net/can/j1939/transport.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/can/j1939/transport.c +6 -0
@@ -2085,6 +2085,12 @@ static void j1939_tp_cmd_recv(struct j19break ;case J1939_ETP_CMD_ABORT :/* && J1939_TP_CMD_ABORT */ +if (j1939_cb_is_broadcast (skcb)) { +netdev_err_once (priv->ndev,"%s: abort to broadcast (%02x), ignoring!\n" , + __func__, skcb->addr.sa); +return ; + } +if (j1939_tp_im_transmitter (skcb))j1939_xtp_rx_abort (priv, skb, true);
Greg Kroah-Hartman
maintainerPATCH 131/917 iio: adc: tsc2046: fix scan interval warning
In reply to Greg Kroah-HartmanFrom: Oleksij Rempel <[email protected]>
commit 69b31fd7a61784692db6433c05d46915b1b1a680 upstream.
Sync if statement with the actual warning.
--- drivers/iio/adc/ti-tsc2046.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-tsc2046.c +1 -1
@@ -398,7 +398,7 @@ static int tsc2046_adc_update_scan_mode( priv->xfer.len = size; priv->time_per_scan_us = size *8 * priv->time_per_bit_ns /NSEC_PER_USEC ; -if (priv->scan_interval_us > priv->time_per_scan_us) +if (priv->scan_interval_us < priv->time_per_scan_us)dev_warn (&priv->spi->dev,"The scan interval (%d) is less then calculated scan time (%d)\n" , priv->scan_interval_us, priv->time_per_scan_us);
Greg Kroah-Hartman
maintainerPATCH 132/917 powerpc/85xx: Fix oops when mpc85xx_smp_guts_ids node cannot be found
In reply to Greg Kroah-HartmanFrom: Xiaoming Ni <[email protected]>
commit 3c2172c1c47b4079c29f0e6637d764a99355ebcd upstream.
When the field described in mpc85xx_smp_guts_ids[] is not configured in dtb, the mpc85xx_setup_pmc() does not assign a value to the "guts" variable. As a result, the oops is triggered when mpc85xx_freeze_time_base() is executed.
--- arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c +1 -2
@@ -94,9 +94,8 @@ int __init mpc85xx_setup_pmc(void)pr_err ("Could not map guts node address\n" );return -ENOMEM ; } + qoriq_pm_ops = &mpc85xx_pm_ops; } - qoriq_pm_ops = &mpc85xx_pm_ops; -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 150/917 PCI: aardvark: Fix support for bus mastering and PCI_COMMAND on emulated bridge
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 771153fc884f566a89af2d30033b7f3bc6e24e84 upstream.
Quoted 1 line
From very vague, ambiguous and incomplete information from Marvell we
deduced that the 32-bit Aardvark register at address 0x4 (PCIE_CORE_CMD_STATUS_REG), which is not documented for Root Complex mode in the Functional Specification (only for Endpoint mode), controls two 16-bit PCIe registers: Command Register and Status Registers of PCIe Root Port.
This means that bit 2 controls bus mastering and forwarding of memory and I/O requests in the upstream direction. According to PCI specifications bits [0:2] of Command Register, this should be by default disabled on reset. So explicitly disable these bits at early setup of the Aardvark driver.
Remove code which unconditionally enables all 3 bits and let kernel code (via pci_set_master() function) to handle bus mastering of Root PCIe Bridge via emulated PCI_COMMAND on emulated bridge.
--- drivers/pci/controller/pci-aardvark.c | 54 +++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 16 deletions(-)
drivers/pci/controller/pci-aardvark.c +38 -16
@@ -31,9 +31,6 @@/* PCIe core registers */ #define PCIE_CORE_DEV_ID_REG 0x0#define PCIE_CORE_CMD_STATUS_REG 0x4 -#define PCIE_CORE_CMD_IO_ACCESS_EN BIT(0) -#define PCIE_CORE_CMD_MEM_ACCESS_EN BIT(1) -#define PCIE_CORE_CMD_MEM_IO_REQ_EN BIT(2)#define PCIE_CORE_DEV_REV_REG 0x8#define PCIE_CORE_PCIEXP_CAP 0xc0#define PCIE_CORE_ERR_CAPCTL_REG 0x118
@@ -563,6 +560,11 @@ static void advk_pcie_setup_hw(struct ad reg = (PCI_VENDOR_ID_MARVELL <<16 ) |PCI_VENDOR_ID_MARVELL ;advk_writel (pcie, reg,VENDOR_ID_REG ); +/* Disable Root Bridge I/O space, memory space and bus mastering */ + reg =advk_readl (pcie,PCIE_CORE_CMD_STATUS_REG ); + reg &= ~(PCI_COMMAND_IO |PCI_COMMAND_MEMORY |PCI_COMMAND_MASTER ); +advk_writel (pcie, reg,PCIE_CORE_CMD_STATUS_REG ); +/* Set Advanced Error Capabilities and Control PF0 register */ reg =PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX | PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX_EN |
@@ -660,19 +662,6 @@ static void advk_pcie_setup_hw(struct adadvk_pcie_disable_ob_win (pcie, i);advk_pcie_train_link (pcie); - -/* -* FIXME: The following register update is suspicious. This register is -* applicable only when the PCI controller is configured for Endpoint -* mode, not as a Root Complex. But apparently when this code is -* removed, some cards stop working. This should be investigated and -* a comment explaining this should be put here. -*/ - reg =advk_readl (pcie,PCIE_CORE_CMD_STATUS_REG ); - reg |=PCIE_CORE_CMD_MEM_ACCESS_EN | -PCIE_CORE_CMD_IO_ACCESS_EN | -PCIE_CORE_CMD_MEM_IO_REQ_EN ; -advk_writel (pcie, reg,PCIE_CORE_CMD_STATUS_REG ); }static int advk_pcie_check_pio_status (struct advk_pcie *pcie,bool allow_crs,u32 *val)
@@ -793,6 +782,37 @@ static int advk_pcie_wait_pio(struct advreturn -ETIMEDOUT ; } +static pci_bridge_emul_read_status_t +advk_pci_bridge_emul_base_conf_read (struct pci_bridge_emul *bridge, +int reg,u32 *value) +{ +struct advk_pcie *pcie = bridge->data; + +switch (reg) { +case PCI_COMMAND : + *value =advk_readl (pcie,PCIE_CORE_CMD_STATUS_REG ); +return PCI_BRIDGE_EMUL_HANDLED ; + +default : +return PCI_BRIDGE_EMUL_NOT_HANDLED ; + } +} + +static void +advk_pci_bridge_emul_base_conf_write (struct pci_bridge_emul *bridge, +int reg,u32 old,u32 new,u32 mask) +{ +struct advk_pcie *pcie = bridge->data; + +switch (reg) { +case PCI_COMMAND : +advk_writel (pcie, new,PCIE_CORE_CMD_STATUS_REG ); +break ; + +default : +break ; + } +} static pci_bridge_emul_read_status_t advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge,
@@ -893,6 +913,8 @@ advk_pci_bridge_emul_pcie_conf_write(str }static struct pci_bridge_emul_ops advk_pci_bridge_emul_ops = { + .read_base = advk_pci_bridge_emul_base_conf_read, + .write_base = advk_pci_bridge_emul_base_conf_write, .read_pcie = advk_pci_bridge_emul_pcie_conf_read, .write_pcie = advk_pci_bridge_emul_pcie_conf_write, };
Greg Kroah-Hartman
maintainerPATCH 152/917 PCI: aardvark: Set PCI Bridge Class Code to PCI Bridge
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 84e1b4045dc887b78bdc87d92927093dc3a465aa upstream.
Aardvark controller has something like config space of a Root Port available at offset 0x0 of internal registers - these registers are used for implementation of the emulated bridge.
The default value of Class Code of this bridge corresponds to a RAID Mass storage controller, though. (This is probably intended for when the controller is used as Endpoint.)
Change the Class Code to correspond to a PCI Bridge.
Add comment explaining this change.
--- drivers/pci/controller/pci-aardvark.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/pci/controller/pci-aardvark.c +20 -0
@@ -560,6 +560,26 @@ static void advk_pcie_setup_hw(struct ad reg = (PCI_VENDOR_ID_MARVELL <<16 ) |PCI_VENDOR_ID_MARVELL ;advk_writel (pcie, reg,VENDOR_ID_REG ); +/* +* Change Class Code of PCI Bridge device to PCI Bridge (0x600400), +* because the default value is Mass storage controller (0x010400). +* +* Note that this Aardvark PCI Bridge does not have compliant Type 1 +* Configuration Space and it even cannot be accessed via Aardvark's +* PCI config space access method. Something like config space is +* available in internal Aardvark registers starting at offset 0x0 +* and is reported as Type 0. In range 0x10 - 0x34 it has totally +* different registers. +* +* Therefore driver uses emulation of PCI Bridge which emulates +* access to configuration space via internal Aardvark registers or +* emulated configuration buffer. +*/ + reg =advk_readl (pcie,PCIE_CORE_DEV_REV_REG ); + reg &= ~0xffffff00 ; + reg |= (PCI_CLASS_BRIDGE_PCI <<8 ) <<8 ; +advk_writel (pcie, reg,PCIE_CORE_DEV_REV_REG ); +/* Disable Root Bridge I/O space, memory space and bus mastering */ reg =advk_readl (pcie,PCIE_CORE_CMD_STATUS_REG ); reg &= ~(PCI_COMMAND_IO |PCI_COMMAND_MEMORY |PCI_COMMAND_MASTER );
Greg Kroah-Hartman
maintainerPATCH 153/917 PCI: aardvark: Fix support for PCI_ROM_ADDRESS1 on emulated bridge
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 239edf686c14a9ff926dec2f350289ed7adfefe2 upstream.
This register is exported at address offset 0x30.
--- drivers/pci/controller/pci-aardvark.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/pci/controller/pci-aardvark.c +9 -0
@@ -32,6 +32,7 @@#define PCIE_CORE_DEV_ID_REG 0x0#define PCIE_CORE_CMD_STATUS_REG 0x4#define PCIE_CORE_DEV_REV_REG 0x8 +#define PCIE_CORE_EXP_ROM_BAR_REG 0x30#define PCIE_CORE_PCIEXP_CAP 0xc0#define PCIE_CORE_ERR_CAPCTL_REG 0x118#define PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX BIT(5)
@@ -813,6 +814,10 @@ advk_pci_bridge_emul_base_conf_read(stru *value =advk_readl (pcie,PCIE_CORE_CMD_STATUS_REG );return PCI_BRIDGE_EMUL_HANDLED ; +case PCI_ROM_ADDRESS1 : + *value =advk_readl (pcie,PCIE_CORE_EXP_ROM_BAR_REG ); +return PCI_BRIDGE_EMUL_HANDLED ; +case PCI_INTERRUPT_LINE : {/* * From the whole 32bit register we support reading from HW only
@@ -845,6 +850,10 @@ advk_pci_bridge_emul_base_conf_write(stradvk_writel (pcie, new,PCIE_CORE_CMD_STATUS_REG );break ; +case PCI_ROM_ADDRESS1 : +advk_writel (pcie, new,PCIE_CORE_EXP_ROM_BAR_REG ); +break ; +case PCI_INTERRUPT_LINE :if (mask & (PCI_BRIDGE_CTL_BUS_RESET <<16 )) {u32 val =advk_readl (pcie,PCIE_CORE_CTRL1_REG );
Greg Kroah-Hartman
maintainerPATCH 154/917 quota: check block number when reading the block in quota file
In reply to Greg Kroah-HartmanFrom: Zhang Yi <[email protected]>
commit 9bf3d20331295b1ecb81f4ed9ef358c51699a050 upstream.
The block number in the quota tree on disk should be smaller than the v2_disk_dqinfo.dqi_blocks. If the quota file was corrupted, we may be allocating an 'allocated' block and that would lead to a loop in a tree, which will probably trigger oops later. This patch adds a check for the block number in the quota tree to prevent such potential issue.
--- fs/quota/quota_tree.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
fs/quota/quota_tree.c +14 -0
@@ -479,6 +479,13 @@ static int remove_tree(struct qtree_mem_ goto out_buf; } newblk =le32_to_cpu (ref[get_index (info, dquot->dq_id, depth)]); +if (newblk <QT_TREEOFF || newblk >= info->dqi_blocks) { +quota_error (dquot->dq_sb,"Getting block too big (%u >= %u)" , + newblk, info->dqi_blocks); + ret = -EUCLEAN ; + goto out_buf; + } +if (depth == info->dqi_qtree_depth -1 ) { ret =free_dqentry (info, dquot, newblk); newblk =0 ;
@@ -578,6 +585,13 @@ static loff_t find_tree_dqentry(struct q blk =le32_to_cpu (ref[get_index (info, dquot->dq_id, depth)]);if (!blk)/* No reference? */ goto out_buf; +if (blk <QT_TREEOFF || blk >= info->dqi_blocks) { +quota_error (dquot->dq_sb,"Getting block too big (%u >= %u)" , + blk, info->dqi_blocks); + ret = -EUCLEAN ; + goto out_buf; + } +if (depth < info->dqi_qtree_depth -1 ) ret =find_tree_dqentry (info, dquot, blk, depth+1 );else
Greg Kroah-Hartman
maintainerPATCH 156/917 cifs: To match file servers, make sure the server hostname matches
In reply to Greg Kroah-HartmanFrom: Shyam Prasad N <[email protected]>
commit 7be3248f313930ff3d3436d4e9ddbe9fccc1f541 upstream.
We generally rely on a bunch of factors to differentiate between servers. For example, IP address, port etc.
For certain server types (like Azure), it is important to make sure that the server hostname matches too, even if the both hostnames currently resolve to the same IP address.
--- fs/cifs/connect.c | 19 +++++++++++-------- fs/cifs/fs_context.c | 8 ++++++++ fs/cifs/fs_context.h | 1 + 3 files changed, 20 insertions(+), 8 deletions(-)
fs/cifs/connect.c +11 -8
@@ -794,7 +794,6 @@ static void clean_demultiplex_info(struc*/ } -kfree (server->hostname);kfree (server); length =atomic_dec_return (&tcpSesAllocCount);
@@ -1235,6 +1234,9 @@ static int match_server(struct TCP_Serveif (!net_eq (cifs_net_ns (server), current->nsproxy->net_ns))return 0 ; +if (strcasecmp (server->hostname, ctx->server_hostname)) +return 0 ; +if (!match_address (server, addr, (struct sockaddr *)&ctx->srcaddr))return 0 ;
@@ -1336,6 +1338,7 @@ cifs_put_tcp_session(struct TCP_Server_Ikfree (server->session_key.response); server->session_key.response =NULL ; server->session_key.len =0 ; +kfree (server->hostname); task =xchg (&server->tsk,NULL );if (task)
@@ -1361,14 +1364,15 @@ cifs_get_tcp_session(struct smb3_fs_cont goto out_err; } + tcp_ses->hostname =kstrdup (ctx->server_hostname,GFP_KERNEL ); +if (!tcp_ses->hostname) { + rc = -ENOMEM ; + goto out_err; + } + tcp_ses->ops = ctx->ops; tcp_ses->vals = ctx->vals;cifs_set_net_ns (tcp_ses,get_net (current->nsproxy->net_ns)); - tcp_ses->hostname =extract_hostname (ctx->UNC); -if (IS_ERR (tcp_ses->hostname)) { - rc =PTR_ERR (tcp_ses->hostname); - goto out_err_crypto_release; - } tcp_ses->conn_id =atomic_inc_return (&tcpSesNextId); tcp_ses->noblockcnt = ctx->rootfs;
@@ -1497,8 +1501,7 @@ out_err_crypto_release: out_err:if (tcp_ses) { -if (!IS_ERR (tcp_ses->hostname)) -kfree (tcp_ses->hostname); +kfree (tcp_ses->hostname);if (tcp_ses->ssocket)sock_release (tcp_ses->ssocket);kfree (tcp_ses);
fs/cifs/fs_context.c +8 -0
@@ -318,6 +318,7 @@ smb3_fs_context_dup(struct smb3_fs_conteDUP_CTX_STR (mount_options);DUP_CTX_STR (username);DUP_CTX_STR (password); +DUP_CTX_STR (server_hostname);DUP_CTX_STR (UNC );DUP_CTX_STR (source);DUP_CTX_STR (domainname);
@@ -456,6 +457,11 @@ smb3_parse_devname(const char *devname,if (!pos)return -EINVAL ; +/* record the server hostname */ + ctx->server_hostname =kstrndup (devname +2 , pos - devname -2 ,GFP_KERNEL ); +if (!ctx->server_hostname) +return -ENOMEM ; +/* skip past delimiter */ ++pos;
@@ -1496,6 +1502,8 @@ smb3_cleanup_fs_context_contents(struct ctx->username =NULL ;kfree_sensitive (ctx->password); ctx->password =NULL ; +kfree (ctx->server_hostname); + ctx->server_hostname =NULL ;kfree (ctx->UNC); ctx->UNC =NULL ;kfree (ctx->source);
fs/cifs/fs_context.h +1 -0
@@ -166,6 +166,7 @@ struct smb3_fs_context {char *password;char *domainname;char *source; +char *server_hostname;char *UNC ;char *nodename;char *iocharset;/* local code page for mapping to and from Unicode */
Greg Kroah-Hartman
maintainerPATCH 157/917 cifs: set a minimum of 120s for next dns resolution
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara <[email protected]>
commit 4ac0536f8874a903a72bddc57eb88db774261e3a upstream.
With commit 506c1da44fee ("cifs: use the expiry output of dns_query to schedule next resolution") and after triggering the first reconnect, the next async dns resolution of tcp server's hostname would be scheduled based on dns_resolver's key expiry default, which happens to default to 5s on most systems that use key.dns_resolver for upcall.
As per key.dns_resolver.conf(5):
default_ttl=<number>
The number of seconds to set as the expiration on a cached record. This will be overridden if the program manages to re- trieve TTL information along with the addresses (if, for exam- ple, it accesses the DNS directly). The default is 5 seconds. The value must be in the range 1 to INT_MAX.
Make the next async dns resolution no shorter than 120s as we do not want to be upcalling too often.
--- fs/cifs/cifsglob.h | 3 ++- fs/cifs/connect.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
fs/cifs/cifsglob.h +2 -1
@@ -74,7 +74,8 @@#define SMB_ECHO_INTERVAL_MAX 600#define SMB_ECHO_INTERVAL_DEFAULT 60 -/* dns resolution interval in seconds */ +/* dns resolution intervals in seconds */ +#define SMB_DNS_RESOLVE_INTERVAL_MIN 120#define SMB_DNS_RESOLVE_INTERVAL_DEFAULT 600/* maximum number of PDUs in one compound */
fs/cifs/connect.c +1 -1
@@ -115,7 +115,7 @@ static int reconn_set_ipaddr_from_hostna* To make sure we don't use the cached entry, retry 1s * after expiry. */ - ttl = (expiry - now +1 ); + ttl = max_t(unsigned long, expiry - now, SMB_DNS_RESOLVE_INTERVAL_MIN) + 1; } rc = !rc ?-1 :0 ;
Greg Kroah-Hartman
maintainerPATCH 159/917 pinctrl: core: fix possible memory leak in pinctrl_enable()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
commit c7892ae13e461ed20154321eb792e07ebe38f5b3 upstream.
I got memory leak as follows when doing fault injection test:
unreferenced object 0xffff888020a7a680 (size 64):
comm "i2c-mcp23018-41", pid 23090, jiffies 4295160544 (age 8.680s) hex dump (first 32 bytes):
00 48 d3 1e 80 88 ff ff 00 1a 56 c1 ff ff ff ff .H........V.....
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<0000000083c79b35>] kmem_cache_alloc_trace+0x16d/0x360
[<0000000051803c95>] pinctrl_init_controller+0x6ed/0xb70
[<0000000064346707>] pinctrl_register+0x27/0x80
[<0000000029b0e186>] devm_pinctrl_register+0x5b/0xe0
[<00000000391f5a3e>] mcp23s08_probe_one+0x968/0x118a [pinctrl_mcp23s08]
[<000000006112c039>] mcp230xx_probe+0x266/0x560 [pinctrl_mcp23s08_i2c]If pinctrl_claim_hogs() fails, the 'pindesc' allocated in pinctrl_register_one_pin() need be freed.
--- drivers/pinctrl/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/core.c +2 -0
@@ -2100,6 +2100,8 @@ int pinctrl_enable(struct pinctrl_dev *pif (error) {dev_err (pctldev->dev,"could not claim hogs: %i\n" , error); +pinctrl_free_pindescs (pctldev, pctldev->desc->pins, + pctldev->desc->npins);mutex_destroy (&pctldev->mutex);kfree (pctldev);
Greg Kroah-Hartman
maintainerPATCH 174/917 io-wq: serialize hash clear with wakeup
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit d3e3c102d107bb84251455a298cf475f24bab995 upstream.
We need to ensure that we serialize the stalled and hash bits with the wait_queue wait handler, or we could be racing with someone modifying the hashed state after we find it busy, but before we then give up and wait for it to be cleared. This can cause random delays or stalls when handling buffered writes for many files, where some of these files cause hash collisions between the worker threads.
--- fs/io-wq.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
fs/io-wq.c +15 -2
@@ -421,9 +421,10 @@ static inline unsigned int io_get_work_hreturn work->flags >>IO_WQ_HASH_SHIFT ; } -static void io_wait_on_hash (struct io_wqe *wqe,unsigned int hash) +static bool io_wait_on_hash (struct io_wqe *wqe,unsigned int hash) {struct io_wq *wq = wqe->wq; +bool ret = false;spin_lock_irq (&wq->hash->wait.lock);if (list_empty (&wqe->wait.entry)) {
@@ -431,9 +432,11 @@ static void io_wait_on_hash(struct io_wqif (!test_bit (hash, &wq->hash->map)) {__set_current_state (TASK_RUNNING );list_del_init (&wqe->wait.entry); + ret = true; } }spin_unlock_irq (&wq->hash->wait.lock); +return ret; } static struct io_wq_work *io_get_next_work(struct io_wqe_acct *acct,
@@ -473,14 +476,21 @@ static struct io_wq_work *io_get_next_wo }if (stall_hash !=-1U ) { +bool unstalled; +/* * Set this before dropping the lock to avoid racing with new * work being added and clearing the stalled bit. */ set_bit (IO_ACCT_STALLED_BIT , &acct->flags);raw_spin_unlock (&wqe->lock); -io_wait_on_hash (wqe, stall_hash); + unstalled =io_wait_on_hash (wqe, stall_hash);raw_spin_lock (&wqe->lock); +if (unstalled) { +clear_bit (IO_ACCT_STALLED_BIT , &acct->flags); +if (wq_has_sleeper (&wqe->wq->hash->wait)) +wake_up (&wqe->wq->hash->wait); + } }return NULL ;
@@ -562,8 +572,11 @@ get_next:io_wqe_enqueue (wqe, linked);if (hash !=-1U && !next_hashed) { +/* serialize hash clear with wake_up() */ +spin_lock_irq (&wq->hash->wait.lock);clear_bit (hash, &wq->hash->map);clear_bit (IO_ACCT_STALLED_BIT , &acct->flags); +spin_unlock_irq (&wq->hash->wait.lock);if (wq_has_sleeper (&wq->hash->wait))wake_up (&wq->hash->wait);raw_spin_lock (&wqe->lock);
Greg Kroah-Hartman
maintainerPATCH 176/917 Revert "serial: 8250: Fix reporting real baudrate value in c_ospeed field"
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit d02b006b29de14968ba4afa998bede0d55469e29 upstream.
This reverts commit 32262e2e429cdb31f9e957e997d53458762931b7.
The commit in question claims to determine the inverse of serial8250_get_divisor() but failed to notice that some drivers override the default implementation using a get_divisor() callback.
This means that the computed line-speed values can be completely wrong and results in regular TCSETS requests failing (the incorrect values would also be passed to any overridden set_divisor() callback).
Similarly, it also failed to honour the old (deprecated) ASYNC_SPD_FLAGS and would break applications relying on those when re-encoding the actual line speed.
There are also at least two quirks, UART_BUG_QUOT and an OMAP1510 workaround, which were happily ignored and that are now broken.
Finally, even if the offending commit were to be implemented correctly, this is a new feature and not something which should be backported to stable.
--- drivers/tty/serial/8250/8250_port.c | 17 ----------------- 1 file changed, 17 deletions(-)
drivers/tty/serial/8250/8250_port.c +0 -17
@@ -2584,19 +2584,6 @@ static unsigned int serial8250_get_divisreturn serial8250_do_get_divisor (port, baud, frac); } -static unsigned int serial8250_compute_baud_rate (struct uart_port *port, -unsigned int quot) -{ -if ((port->flags &UPF_MAGIC_MULTIPLIER ) && quot ==0x8001 ) -return port->uartclk /4 ; -else if ((port->flags &UPF_MAGIC_MULTIPLIER ) && quot ==0x8002 ) -return port->uartclk /8 ; -else if (port->type ==PORT_NPCM ) -return DIV_ROUND_CLOSEST (port->uartclk -2 * (quot +2 ),16 * (quot +2 )); -else -return DIV_ROUND_CLOSEST (port->uartclk,16 * quot); -} -static unsigned char serial8250_compute_lcr (struct uart_8250_port *up,tcflag_t c_cflag) {
@@ -2738,14 +2725,11 @@ void serial8250_update_uartclk(struct ua baud =serial8250_get_baud_rate (port, termios,NULL ); quot =serial8250_get_divisor (port, baud, &frac); - baud =serial8250_compute_baud_rate (port, quot);serial8250_rpm_get (up);spin_lock_irqsave (&port->lock, flags);uart_update_timeout (port, termios->c_cflag, baud); -if (tty_termios_baud_rate (termios)) -tty_termios_encode_baud_rate (termios, baud, baud);serial8250_set_divisor (port, baud, quot, frac);serial_port_out (port,UART_LCR , up->lcr);
@@ -2779,7 +2763,6 @@ serial8250_do_set_termios(struct uart_po baud =serial8250_get_baud_rate (port, termios, old); quot =serial8250_get_divisor (port, baud, &frac); - baud =serial8250_compute_baud_rate (port, quot);/* * Ok, we're now changing the port state. Do it with
Greg Kroah-Hartman
maintainerPATCH 184/917 drm: panel-orientation-quirks: Add quirk for KD Kurio Smart C15200 2-in-1
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit a53f1dd3ab9fec715c6c2e8e01bf4d3c07eef8e5 ]
The KD Kurio Smart C15200 2-in-1 uses a panel which has been mounted 90 degrees rotated. Add a quirk for this.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +7 -0
@@ -205,6 +205,13 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_BOARD_NAME, "TW891"), }, .driver_data = (void *)&itworks_tw891, + }, { /* KD Kurio Smart C15200 2-in-1 */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"KD Interactive" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"Kurio Smart" ), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "KDM960BCP"), + }, + .driver_data = (void *)&lcd800x1280_rightside_up, }, { /** Lenovo Ideapad Miix 310 laptop, only some production batches * have a portrait screen, the resolution checks makes the quirk
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 164/917 iio: buffer: Fix memory leak in iio_buffers_alloc_sysfs_and_mask()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
commit 486a25084155bf633768c26f022201c051d6fd95 upstream.
When 'iio_dev_opaque->buffer_ioctl_handler' alloc fails in iio_buffers_alloc_sysfs_and_mask(), the 'attrs' allocated in iio_buffer_register_legacy_sysfs_groups() will be leaked:
unreferenced object 0xffff888108568d00 (size 128):
comm "88", pid 2014, jiffies 4294963294 (age 26.920s) hex dump (first 32 bytes):
80 3e da 02 80 88 ff ff 00 3a da 02 80 88 ff ff .>.......:......
00 35 da 02 80 88 ff ff 00 38 da 02 80 88 ff ff .5.......8......
backtrace:
[<0000000095a9e51e>] __kmalloc+0x1a3/0x2f0
[<00000000faa3735e>] iio_buffers_alloc_sysfs_and_mask+0xfa3/0x1480 [industrialio]
[<00000000a46384dc>] __iio_device_register+0x52e/0x1b40 [industrialio]
[<00000000210af05e>] __devm_iio_device_register+0x22/0x80 [industrialio]
[<00000000730d7b41>] adjd_s311_probe+0x195/0x200 [adjd_s311]
[<00000000c0f70eb9>] i2c_device_probe+0xa07/0xbb0The iio_buffer_register_legacy_sysfs_groups() is called in __iio_buffer_alloc_sysfs_and_mask(), so move the iio_buffer_unregister_legacy_sysfs_groups() into __iio_buffer_free_sysfs_and_mask(), then the memory will be freed.
--- drivers/iio/industrialio-buffer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/iio/industrialio-buffer.c +7 -5
@@ -1588,8 +1588,12 @@ error_cleanup_dynamic:return ret; } -static void __iio_buffer_free_sysfs_and_mask (struct iio_buffer *buffer) +static void __iio_buffer_free_sysfs_and_mask (struct iio_buffer *buffer, +struct iio_dev *indio_dev, +int index) { +if (index ==0 ) +iio_buffer_unregister_legacy_sysfs_groups (indio_dev);bitmap_free (buffer->scan_mask);kfree (buffer->buffer_group.name);kfree (buffer->buffer_group.attrs);
@@ -1643,7 +1647,7 @@ int iio_buffers_alloc_sysfs_and_mask(str error_unwind_sysfs_and_mask:for (; unwind_idx >=0 ; unwind_idx--) { buffer = iio_dev_opaque->attached_buffers[unwind_idx]; -__iio_buffer_free_sysfs_and_mask (buffer); +__iio_buffer_free_sysfs_and_mask (buffer, indio_dev, unwind_idx); }return ret; }
@@ -1660,11 +1664,9 @@ void iio_buffers_free_sysfs_and_mask(striio_device_ioctl_handler_unregister (iio_dev_opaque->buffer_ioctl_handler);kfree (iio_dev_opaque->buffer_ioctl_handler); -iio_buffer_unregister_legacy_sysfs_groups (indio_dev); -for (i = iio_dev_opaque->attached_buffers_cnt -1 ; i >=0 ; i--) { buffer = iio_dev_opaque->attached_buffers[i]; -__iio_buffer_free_sysfs_and_mask (buffer); +__iio_buffer_free_sysfs_and_mask (buffer, indio_dev, i); } }
Greg Kroah-Hartman
maintainerPATCH 165/917 iio: buffer: Fix memory leak in __iio_buffer_alloc_sysfs_and_mask()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
commit 9a2ff8009e53296e47de72d5af0bc31cd53274ff upstream.
When iio_buffer_wrap_attr() returns NULL or buffer->buffer_group.name alloc fails, the 'attr' which is allocated in __iio_buffer_alloc_sysfs_and_mask() is not freed, and cause memory leak.
unreferenced object 0xffff888014882a00 (size 64):
comm "i2c-adjd_s311-8", pid 424, jiffies 4294907737 (age 44.396s) hex dump (first 32 bytes):
00 0f 8a 15 80 88 ff ff 00 0e 8a 15 80 88 ff ff ................
80 04 8a 15 80 88 ff ff 80 05 8a 15 80 88 ff ff ................
backtrace:
[<0000000021752e67>] __kmalloc+0x1af/0x3c0
[<0000000043e8305c>] iio_buffers_alloc_sysfs_and_mask+0xe73/0x1570 [industrialio]
[<00000000b7aa5a17>] __iio_device_register+0x483/0x1a30 [industrialio]
[<000000003fa0fb2f>] __devm_iio_device_register+0x23/0x90 [industrialio]
[<000000003ab040cf>] adjd_s311_probe+0x19c/0x200 [adjd_s311]
[<0000000080458969>] i2c_device_probe+0xa31/0xbe0
[<00000000e20678ad>] really_probe+0x299/0xc30
[<000000006bea9b27>] __driver_probe_device+0x357/0x500
[<00000000e1df10d4>] driver_probe_device+0x4e/0x140
[<0000000003661beb>] __device_attach_driver+0x257/0x340
[<000000005bb4aa26>] bus_for_each_drv+0x166/0x1e0
[<00000000272c5236>] __device_attach+0x272/0x420
[<00000000d52a96ae>] bus_probe_device+0x1eb/0x2a0
[<00000000129f7737>] device_add+0xbf0/0x1f90
[<000000005eed4e52>] i2c_new_client_device+0x622/0xb20
[<00000000b85a9c43>] new_device_store+0x1fa/0x420This patch fix to free it before the error return.
--- drivers/iio/industrialio-buffer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/industrialio-buffer.c +2 -3
@@ -1536,6 +1536,7 @@ static int __iio_buffer_alloc_sysfs_and_ sizeof(struct attribute *) * buffer_attrcount); buffer_attrcount +=ARRAY_SIZE (iio_buffer_attrs); + buffer->buffer_group.attrs = attr;for (i =0 ; i < buffer_attrcount; i++) {struct attribute *wrapped;
@@ -1543,7 +1544,7 @@ static int __iio_buffer_alloc_sysfs_and_ wrapped =iio_buffer_wrap_attr (buffer, attr[i]);if (!wrapped) { ret = -ENOMEM ; - goto error_free_scan_mask; + goto error_free_buffer_attrs; } attr[i] = wrapped; }
@@ -1558,8 +1559,6 @@ static int __iio_buffer_alloc_sysfs_and_ goto error_free_buffer_attrs; } - buffer->buffer_group.attrs = attr; - ret =iio_device_register_sysfs_group (indio_dev, &buffer->buffer_group);if (ret) goto error_free_buffer_attr_group_name;
Greg Kroah-Hartman
maintainerPATCH 179/917 USB: chipidea: fix interrupt deadlock
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 9aaa81c3366e8393a62374e3a1c67c69edc07b8a upstream.
Chipidea core was calling the interrupt handler from non-IRQ context with interrupts enabled, something which can lead to a deadlock if there's an actual interrupt trying to take a lock that's already held (e.g. the controller lock in udc_irq()).
Add a wrapper that can be used to fake interrupts instead of calling the handler directly.
--- drivers/usb/chipidea/core.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/usb/chipidea/core.c +16 -7
@@ -514,7 +514,7 @@ int hw_device_reset(struct ci_hdrc *ci)return 0 ; } -static irqreturn_t ci_irq (int irq,void *data) +static irqreturn_t ci_irq_handler (int irq,void *data) {struct ci_hdrc *ci = data;irqreturn_t ret =IRQ_NONE ;
@@ -567,6 +567,15 @@ static irqreturn_t ci_irq(int irq, voidreturn ret; } +static void ci_irq (struct ci_hdrc *ci) +{ +unsigned long flags; + +local_irq_save (flags); +ci_irq_handler (ci->irq, ci); +local_irq_restore (flags); +} +static int ci_cable_notifier (struct notifier_block *nb,unsigned long event,void *ptr) {
@@ -576,7 +585,7 @@ static int ci_cable_notifier(struct noti cbl->connected = event; cbl->changed = true; -ci_irq (ci->irq, ci); +ci_irq (ci);return NOTIFY_DONE ; }
@@ -617,7 +626,7 @@ static int ci_usb_role_switch_set(structif (cable) { cable->changed = true; cable->connected = false; -ci_irq (ci->irq, ci); +ci_irq (ci);spin_unlock_irqrestore (&ci->lock, flags);if (ci->wq && role !=USB_ROLE_NONE )flush_workqueue (ci->wq);
@@ -635,7 +644,7 @@ static int ci_usb_role_switch_set(structif (cable) { cable->changed = true; cable->connected = true; -ci_irq (ci->irq, ci); +ci_irq (ci); }spin_unlock_irqrestore (&ci->lock, flags);pm_runtime_put_sync (ci->dev);
@@ -1174,7 +1183,7 @@ static int ci_hdrc_probe(struct platform } } - ret =devm_request_irq (dev, ci->irq, ci_irq,IRQF_SHARED , + ret =devm_request_irq (dev, ci->irq, ci_irq_handler,IRQF_SHARED , ci->platdata->name, ci);if (ret) goto stop;
@@ -1295,11 +1304,11 @@ static void ci_extcon_wakeup_int(structif (!IS_ERR (cable_id->edev) && ci->is_otg && (otgsc &OTGSC_IDIE ) && (otgsc &OTGSC_IDIS )) -ci_irq (ci->irq, ci); +ci_irq (ci);if (!IS_ERR (cable_vbus->edev) && ci->is_otg && (otgsc &OTGSC_BSVIE ) && (otgsc &OTGSC_BSVIS )) -ci_irq (ci->irq, ci); +ci_irq (ci); }static int ci_controller_resume (struct device *dev)
Greg Kroah-Hartman
maintainerPATCH 180/917 power: supply: max17042_battery: Clear status bits in interrupt handler
In reply to Greg Kroah-HartmanFrom: Sebastian Krzyszkowiak <[email protected]>
commit 0cf48167b87e388fa1268c9fe6d2443ae7f43d8a upstream.
The gauge requires us to clear the status bits manually for some alerts to be properly dismissed. Previously the IRQ was configured to react only on falling edge, which wasn't technically correct (the ALRT line is active low), but it had a happy side-effect of preventing interrupt storms on uncleared alerts from happening.
--- drivers/power/supply/max17042_battery.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/power/supply/max17042_battery.c +4 -0
@@ -880,6 +880,10 @@ static irqreturn_t max17042_thread_handlmax17042_set_soc_threshold (chip,1 ); } +/* we implicitly handle all alerts via power_supply_changed */ +regmap_clear_bits (chip->regmap,MAX17042_STATUS , +0xFFFF & ~(STATUS_POR_BIT |STATUS_BST_BIT )); +power_supply_changed (chip->battery);return IRQ_HANDLED ; }
Greg Kroah-Hartman
maintainerPATCH 181/917 component: do not leave master devres group open after bind
In reply to Greg Kroah-HartmanFrom: Kai Vehmanen <[email protected]>
commit c87761db2100677a69be551365105125d872af5b upstream.
In current code, the devres group for aggregate master is left open after call to component_master_add_*(). This leads to problems when the master does further managed allocations on its own. When any participating driver calls component_del(), this leads to immediate release of resources.
This came up when investigating a page fault occurring with i915 DRM driver unbind with 5.15-rc1 kernel. The following sequence occurs:
i915_pci_remove()
-> intel_display_driver_unregister()
-> i915_audio_component_cleanup()
-> component_del()
-> component.c:take_down_master()
-> hdac_component_master_unbind() [via master->ops->unbind()]
-> devres_release_group(master->parent, NULL)With older kernels this has not caused issues, but with audio driver moving to use managed interfaces for more of its allocations, this no longer works. Devres log shows following to occur:
component_master_add_with_match()
[ 126.886032] snd_hda_intel 0000:00:1f.3: DEVRES ADD 00000000323ccdc5 devm_component_match_release (24 bytes) [ 126.886045] snd_hda_intel 0000:00:1f.3: DEVRES ADD 00000000865cdb29 grp< (0 bytes) [ 126.886049] snd_hda_intel 0000:00:1f.3: DEVRES ADD 000000001b480725 grp< (0 bytes)
audio driver completes its PCI probe()
[ 126.892238] snd_hda_intel 0000:00:1f.3: DEVRES ADD 000000001b480725 pcim_iomap_release (48 bytes)
component_del() called() at DRM/i915 unbind()
[ 137.579422] i915 0000:00:02.0: DEVRES REL 00000000ef44c293 grp< (0 bytes) [ 137.579445] snd_hda_intel 0000:00:1f.3: DEVRES REL 00000000865cdb29 grp< (0 bytes) [ 137.579458] snd_hda_intel 0000:00:1f.3: DEVRES REL 000000001b480725 pcim_iomap_release (48 bytes)
So the "devres_release_group(master->parent, NULL)" ends up freeing the pcim_iomap allocation. Upon next runtime resume, the audio driver will cause a page fault as the iomap alloc was released without the driver knowing about it.
Fix this issue by using the "struct master" pointer as identifier for the devres group, and by closing the devres group after
the master->ops->bind() call is done. This allows devres allocations done by the driver acting as master to be isolated from the binding state of the aggregate driver. This modifies the logic originally introduced in commit 9e1ccb4a7700 ("drivers/base: fix devres handling for master device")
--- drivers/base/component.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/base/component.c +3 -2
@@ -246,7 +246,7 @@ static int try_to_bring_up_master(structreturn 0 ; } -if (!devres_open_group (master->parent,NULL ,GFP_KERNEL )) +if (!devres_open_group (master->parent, master,GFP_KERNEL ))return -ENOMEM ;/* Found all components */
@@ -258,6 +258,7 @@ static int try_to_bring_up_master(structreturn ret; } +devres_close_group (master->parent,NULL ); master->bound = true;return 1 ; }
@@ -282,7 +283,7 @@ static void take_down_master(struct mast {if (master->bound) { master->ops->unbind (master->parent); -devres_release_group (master->parent,NULL ); +devres_release_group (master->parent, master); master->bound = false; } }
Greg Kroah-Hartman
maintainerPATCH 186/917 Bluetooth: sco: Fix lock_sock() blockage by memcpy_from_msg()
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 99c23da0eed4fd20cae8243f2b51e10e66aa0951 ]
The sco_send_frame() also takes lock_sock() during memcpy_from_msg() call that may be endlessly blocked by a task with userfaultd technique, and this will result in a hung task watchdog trigger.
Just like the similar fix for hci_sock_sendmsg() in commit 92c685dc5de0 ("Bluetooth: reorganize functions..."), this patch moves the memcpy_from_msg() out of lock_sock() for addressing the hang.
This should be the last piece for fixing CVE-2021-3640 after a few already queued fixes.
--- net/bluetooth/sco.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
net/bluetooth/sco.c +16 -8
@@ -280,7 +280,8 @@ static int sco_connect(struct hci_dev *hdev, struct sock *sk)return err; } -static int sco_send_frame (struct sock *sk,struct msghdr *msg,int len) +static int sco_send_frame (struct sock *sk,void *buf,int len, +unsigned int msg_flags) {struct sco_conn *conn =sco_pi (sk)->conn;struct sk_buff *skb;
@@ -292,15 +293,11 @@ static int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)BT_DBG ("sk %p len %d" , sk, len); - skb =bt_skb_send_alloc (sk, len, msg->msg_flags &MSG_DONTWAIT , &err); + skb =bt_skb_send_alloc (sk, len, msg_flags &MSG_DONTWAIT , &err);if (!skb)return err; -if (memcpy_from_msg (skb_put (skb, len), msg, len)) { -kfree_skb (skb); -return -EFAULT ; - } - +memcpy (skb_put (skb, len), buf, len);hci_send_sco (conn->hcon, skb);return len;
@@ -725,6 +722,7 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) {struct sock *sk = sock->sk; +void *buf;int err;BT_DBG ("sock %p, sk %p" , sock, sk);
@@ -736,14 +734,24 @@ static int sco_sock_sendmsg(struct socket *sock, struct msghdr *msg,if (msg->msg_flags &MSG_OOB )return -EOPNOTSUPP ; + buf =kmalloc (len,GFP_KERNEL ); +if (!buf) +return -ENOMEM ; + +if (memcpy_from_msg (buf, msg, len)) { +kfree (buf); +return -EFAULT ; + } +lock_sock (sk);if (sk->sk_state ==BT_CONNECTED ) - err =sco_send_frame (sk, msg, len); + err =sco_send_frame (sk, buf, len, msg->msg_flags);else err = -ENOTCONN ;release_sock (sk); +kfree (buf);return err; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 188/917 Bluetooth: call sock_hold earlier in sco_conn_del
In reply to Greg Kroah-HartmanFrom: Desmond Cheong Zhi Xi <[email protected]>
[ Upstream commit f4712fa993f688d0a48e0c28728fcdeb88c1ea58 ]
In sco_conn_del, conn->sk is read while holding on to the sco_conn.lock to avoid races with a socket that could be released concurrently.
However, in between unlocking sco_conn.lock and calling sock_hold, it's possible for the socket to be freed, which would cause a use-after-free write when sock_hold is finally called.
To fix this, the reference count of the socket should be increased while the sco_conn.lock is still held.
--- net/bluetooth/sco.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/sco.c +2 -1
@@ -187,10 +187,11 @@ static void sco_conn_del(struct hci_conn *hcon, int err)/* Kill socket */ sco_conn_lock (conn); sk = conn->sk; +if (sk) +sock_hold (sk);sco_conn_unlock (conn);if (sk) { -sock_hold (sk);lock_sock (sk);sco_sock_clear_timer (sk);sco_chan_del (sk, err);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 192/917 drm/amdgpu: move iommu_resume before ip init/resume
In reply to Greg Kroah-HartmanFrom: James Zhu <[email protected]>
[ Upstream commit 9cec53c18a3170c7e5673c414da56aeecee94832 ]
Separate iommu_resume from kfd_resume, and move it before other amdgpu ip init/resume.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
@@ -2394,6 +2394,10 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)if (r) goto init_failed; + r =amdgpu_amdkfd_resume_iommu (adev); +if (r) + goto init_failed; + r =amdgpu_device_ip_hw_init_phase1 (adev);if (r) goto init_failed;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 199/917 smackfs: Fix use-after-free in netlbl_catmap_walk()
In reply to Greg Kroah-HartmanFrom: Pawan Gupta <[email protected]>
[ Upstream commit 0817534ff9ea809fac1322c5c8c574be8483ea57 ]
Syzkaller reported use-after-free bug as described in [1]. The bug is triggered when smk_set_cipso() tries to free stale category bitmaps while there are concurrent reader(s) using the same bitmaps.
Wait for RCU grace period to finish before freeing the category bitmaps in smk_set_cipso(). This makes sure that there are no more readers using the stale bitmaps and freeing them should be safe.
[1] https://lore.kernel.org/netdev/[email protected]/
--- security/smack/smackfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
security/smack/smackfs.c +4 -1
@@ -831,6 +831,7 @@ static int smk_open_cipso(struct inode *inode, struct file *file)static ssize_t smk_set_cipso (struct file *file,const char __user *buf,size_t count,loff_t *ppos,int format) { +struct netlbl_lsm_catmap *old_cat;struct smack_known *skp;struct netlbl_lsm_secattr ncats;char mapcatset[SMK_CIPSOLEN ];
@@ -920,9 +921,11 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, rc =smk_netlbl_mls (maplevel, mapcatset, &ncats,SMK_CIPSOLEN );if (rc >=0 ) { -netlbl_catmap_free (skp->smk_netlabel.attr.mls.cat); + old_cat = skp->smk_netlabel.attr.mls.cat; skp->smk_netlabel.attr.mls.cat = ncats.attr.mls.cat; skp->smk_netlabel.attr.mls.lvl = ncats.attr.mls.lvl; +synchronize_rcu (); +netlbl_catmap_free (old_cat); rc = count;/* * This mapping may have been cached, so clear the cache.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 212/917 leds: trigger: use RCU to protect the led_cdevs list
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 2a5a8fa8b23144d14567d6f8293dd6fbeecee393 ]
Even with the previous commit 27af8e2c90fb ("leds: trigger: fix potential deadlock with libata") to this file, we still get lockdep unhappy, and Boqun explained the report here:
https://lore.kernel.org/r/YNA+d1X4UkoQ7g8a@boqun-archlinux
Effectively, this means that the read_lock_irqsave() isn't enough here because another CPU might be trying to do a write lock, and thus block the readers.
This is all pretty messy, but it doesn't seem right that the LEDs framework imposes some locking requirements on users, in particular we'd have to make the spinlock in the iwlwifi driver always disable IRQs, even if we don't need that for any other reason, just to avoid this deadlock.
Since writes to the led_cdevs list are rare (and are done by userspace), just switch the list to RCU. This costs a synchronize_rcu() at removal time so we can ensure things are correct, but that seems like a small price to pay for getting lock-free iterations and no deadlocks (nor any locking requirements imposed on users.)
--- drivers/leds/led-triggers.c | 41 +++++++++++++++++++------------------ include/linux/leds.h | 2 +- 2 files changed, 22 insertions(+), 21 deletions(-)
drivers/leds/led-triggers.c +21 -20
@@ -157,7 +157,6 @@ EXPORT_SYMBOL_GPL(led_trigger_read);/* Caller must ensure led_cdev->trigger_lock held */ int led_trigger_set (struct led_classdev *led_cdev,struct led_trigger *trig) { -unsigned long flags;char *event =NULL ;char *envp[2 ];const char *name;
@@ -171,10 +170,13 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)/* Remove any existing trigger */ if (led_cdev->trigger) { -write_lock_irqsave (&led_cdev->trigger->leddev_list_lock, flags); -list_del (&led_cdev->trig_list); -write_unlock_irqrestore (&led_cdev->trigger->leddev_list_lock, - flags); +spin_lock (&led_cdev->trigger->leddev_list_lock); +list_del_rcu (&led_cdev->trig_list); +spin_unlock (&led_cdev->trigger->leddev_list_lock); + +/* ensure it's no longer visible on the led_cdevs list */ +synchronize_rcu (); +cancel_work_sync (&led_cdev->set_brightness_work);led_stop_software_blink (led_cdev);if (led_cdev->trigger->deactivate)
@@ -186,9 +188,9 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)led_set_brightness (led_cdev,LED_OFF ); }if (trig) { -write_lock_irqsave (&trig->leddev_list_lock, flags); -list_add_tail (&led_cdev->trig_list, &trig->led_cdevs); -write_unlock_irqrestore (&trig->leddev_list_lock, flags); +spin_lock (&trig->leddev_list_lock); +list_add_tail_rcu (&led_cdev->trig_list, &trig->led_cdevs); +spin_unlock (&trig->leddev_list_lock); led_cdev->trigger = trig;if (trig->activate)
@@ -223,9 +225,10 @@ err_add_groups: trig->deactivate (led_cdev); err_activate: -write_lock_irqsave (&led_cdev->trigger->leddev_list_lock, flags); -list_del (&led_cdev->trig_list); -write_unlock_irqrestore (&led_cdev->trigger->leddev_list_lock, flags); +spin_lock (&led_cdev->trigger->leddev_list_lock); +list_del_rcu (&led_cdev->trig_list); +spin_unlock (&led_cdev->trigger->leddev_list_lock); +synchronize_rcu (); led_cdev->trigger =NULL ; led_cdev->trigger_data =NULL ;led_set_brightness (led_cdev,LED_OFF );
@@ -285,7 +288,7 @@ int led_trigger_register(struct led_trigger *trig)struct led_classdev *led_cdev;struct led_trigger *_trig; -rwlock_init (&trig->leddev_list_lock); +spin_lock_init (&trig->leddev_list_lock);INIT_LIST_HEAD (&trig->led_cdevs);down_write (&triggers_list_lock);
@@ -378,15 +381,14 @@ void led_trigger_event(struct led_trigger *trig, enum led_brightness brightness) {struct led_classdev *led_cdev; -unsigned long flags;if (!trig)return ; -read_lock_irqsave (&trig->leddev_list_lock, flags); -list_for_each_entry (led_cdev, &trig->led_cdevs, trig_list) +rcu_read_lock (); +list_for_each_entry_rcu (led_cdev, &trig->led_cdevs, trig_list)led_set_brightness (led_cdev, brightness); -read_unlock_irqrestore (&trig->leddev_list_lock, flags); +rcu_read_unlock (); }EXPORT_SYMBOL_GPL (led_trigger_event);
@@ -397,20 +399,19 @@ static void led_trigger_blink_setup(struct led_trigger *trig, int invert) {struct led_classdev *led_cdev; -unsigned long flags;if (!trig)return ; -read_lock_irqsave (&trig->leddev_list_lock, flags); -list_for_each_entry (led_cdev, &trig->led_cdevs, trig_list) { +rcu_read_lock (); +list_for_each_entry_rcu (led_cdev, &trig->led_cdevs, trig_list) {if (oneshot)led_blink_set_oneshot (led_cdev, delay_on, delay_off, invert);else led_blink_set (led_cdev, delay_on, delay_off); } -read_unlock_irqrestore (&trig->leddev_list_lock, flags); +rcu_read_unlock (); } void led_trigger_blink(struct led_trigger *trig,
include/linux/leds.h +1 -1
@@ -360,7 +360,7 @@ struct led_trigger {struct led_hw_trigger_type *trigger_type;/* LEDs under control by this trigger (for simple triggers) */ -rwlock_t leddev_list_lock; +spinlock_t leddev_list_lock;struct list_head led_cdevs;/* Link to next registered trigger */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 216/917 ath10k: high latency fixes for beacon buffer
In reply to Greg Kroah-HartmanFrom: Alagu Sankar <[email protected]>
[ Upstream commit e263bdab9c0e8025fb7f41f153709a9cda51f6b6 ]
Beacon buffer for high latency devices does not use DMA. other similar buffer allocation methods in the driver have already been modified for high latency path. Fix the beacon buffer allocation left out in the earlier high latency changes.
--- drivers/net/wireless/ath/ath10k/mac.c | 31 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +23 -8
@@ -993,8 +993,12 @@ static void ath10k_mac_vif_beacon_cleanup(struct ath10k_vif *arvif)ath10k_mac_vif_beacon_free (arvif);if (arvif->beacon_buf) { -dma_free_coherent (ar->dev,IEEE80211_MAX_FRAME_LEN , - arvif->beacon_buf, arvif->beacon_paddr); +if (ar->bus_param.dev_type ==ATH10K_DEV_TYPE_HL ) +kfree (arvif->beacon_buf); +else +dma_free_coherent (ar->dev,IEEE80211_MAX_FRAME_LEN , + arvif->beacon_buf, + arvif->beacon_paddr); arvif->beacon_buf =NULL ; } }
@@ -5576,10 +5580,17 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,if (vif->type ==NL80211_IFTYPE_ADHOC || vif->type ==NL80211_IFTYPE_MESH_POINT || vif->type ==NL80211_IFTYPE_AP ) { - arvif->beacon_buf =dma_alloc_coherent (ar->dev, -IEEE80211_MAX_FRAME_LEN , - &arvif->beacon_paddr, -GFP_ATOMIC ); +if (ar->bus_param.dev_type ==ATH10K_DEV_TYPE_HL ) { + arvif->beacon_buf =kmalloc (IEEE80211_MAX_FRAME_LEN , +GFP_KERNEL ); + arvif->beacon_paddr = (dma_addr_t )arvif->beacon_buf; + }else { + arvif->beacon_buf = +dma_alloc_coherent (ar->dev, +IEEE80211_MAX_FRAME_LEN , + &arvif->beacon_paddr, +GFP_ATOMIC ); + }if (!arvif->beacon_buf) { ret = -ENOMEM ; ath10k_warn(ar, "failed to allocate beacon buffer: %d\n",
@@ -5794,8 +5805,12 @@ err_vdev_delete: err:if (arvif->beacon_buf) { -dma_free_coherent (ar->dev,IEEE80211_MAX_FRAME_LEN , - arvif->beacon_buf, arvif->beacon_paddr); +if (ar->bus_param.dev_type ==ATH10K_DEV_TYPE_HL ) +kfree (arvif->beacon_buf); +else +dma_free_coherent (ar->dev,IEEE80211_MAX_FRAME_LEN , + arvif->beacon_buf, + arvif->beacon_paddr); arvif->beacon_buf =NULL ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 217/917 octeontx2-pf: Enable promisc/allmulti match MCAM entries.
In reply to Greg Kroah-HartmanFrom: Rakesh Babu <[email protected]>
[ Upstream commit ffd2f89ad05cd620d822112a07b0c5669fa9e333 ]
Whenever the interface is brought up/down then set_rx_mode function is called by the stack which enables promisc/allmulti MCAM entries. But there are cases when driver brings interface down and then up such as while changing number of channels. In these cases promisc/allmulti MCAM entries are left disabled as set_rx_mode callback is not called. This patch enables these MCAM entries in all such cases.
--- .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 78 ++++++++++--------- 1 file changed, 43 insertions(+), 35 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +43 -35
@@ -1493,6 +1493,44 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)mutex_unlock (&mbox->lock); } +static void otx2_do_set_rx_mode (struct otx2_nic *pf) +{ +struct net_device *netdev = pf->netdev; +struct nix_rx_mode *req; +bool promisc = false; + +if (!(netdev->flags &IFF_UP )) +return ; + +if ((netdev->flags &IFF_PROMISC ) || + (netdev_uc_count (netdev) >OTX2_MAX_UNICAST_FLOWS )) { + promisc = true; + } + +/* Write unicast address to mcam entries or del from mcam */ +if (!promisc && netdev->priv_flags &IFF_UNICAST_FLT ) +__dev_uc_sync (netdev, otx2_add_macfilter, otx2_del_macfilter); + +mutex_lock (&pf->mbox.lock); + req =otx2_mbox_alloc_msg_nix_set_rx_mode (&pf->mbox); +if (!req) { +mutex_unlock (&pf->mbox.lock); +return ; + } + + req->mode =NIX_RX_MODE_UCAST ; + +if (promisc) + req->mode |=NIX_RX_MODE_PROMISC ; +if (netdev->flags & (IFF_ALLMULTI |IFF_MULTICAST )) + req->mode |=NIX_RX_MODE_ALLMULTI ; + + req->mode |=NIX_RX_MODE_USE_MCE ; + +otx2_sync_mbox_msg (&pf->mbox); +mutex_unlock (&pf->mbox.lock); +} +int otx2_open (struct net_device *netdev) {struct otx2_nic *pf =netdev_priv (netdev);
@@ -1646,6 +1684,8 @@ int otx2_open(struct net_device *netdev)if (err) goto err_tx_stop_queues; +otx2_do_set_rx_mode (pf); +return 0 ; err_tx_stop_queues:
@@ -1791,43 +1831,11 @@ static void otx2_set_rx_mode(struct net_device *netdev)queue_work (pf->otx2_wq, &pf->rx_mode_work); } -static void otx2_do_set_rx_mode (struct work_struct *work) +static void otx2_rx_mode_wrk_handler (struct work_struct *work) { struct otx2_nic *pf = container_of(work, struct otx2_nic, rx_mode_work); -struct net_device *netdev = pf->netdev; -struct nix_rx_mode *req; -bool promisc = false; - -if (!(netdev->flags &IFF_UP )) -return ; - -if ((netdev->flags &IFF_PROMISC ) || - (netdev_uc_count (netdev) >OTX2_MAX_UNICAST_FLOWS )) { - promisc = true; - } -/* Write unicast address to mcam entries or del from mcam */ -if (!promisc && netdev->priv_flags &IFF_UNICAST_FLT ) -__dev_uc_sync (netdev, otx2_add_macfilter, otx2_del_macfilter); - -mutex_lock (&pf->mbox.lock); - req =otx2_mbox_alloc_msg_nix_set_rx_mode (&pf->mbox); -if (!req) { -mutex_unlock (&pf->mbox.lock); -return ; - } - - req->mode =NIX_RX_MODE_UCAST ; - -if (promisc) - req->mode |=NIX_RX_MODE_PROMISC ; -if (netdev->flags & (IFF_ALLMULTI |IFF_MULTICAST )) - req->mode |=NIX_RX_MODE_ALLMULTI ; - - req->mode |=NIX_RX_MODE_USE_MCE ; - -otx2_sync_mbox_msg (&pf->mbox); -mutex_unlock (&pf->mbox.lock); +otx2_do_set_rx_mode (pf); } static int otx2_set_features(struct net_device *netdev,
@@ -2358,7 +2366,7 @@ static int otx2_wq_init(struct otx2_nic *pf)if (!pf->otx2_wq)return -ENOMEM ; -INIT_WORK (&pf->rx_mode_work, otx2_do_set_rx_mode); +INIT_WORK (&pf->rx_mode_work, otx2_rx_mode_wrk_handler);INIT_WORK (&pf->reset_task, otx2_reset_task);return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 221/917 media: stm32: Potential NULL pointer dereference in dcmi_irq_thread()
In reply to Greg Kroah-HartmanFrom: Dmitriy Ulitin <[email protected]>
[ Upstream commit 548fa43a58696450c15b8f5564e99589c5144664 ]
At the moment of enabling irq handling:
1922 ret = devm_request_threaded_irq(&pdev->dev, irq, dcmi_irq_callback,
1923 dcmi_irq_thread, IRQF_ONESHOT,
1924 dev_name(&pdev->dev), dcmi);
there is still uninitialized field sd_format of struct stm32_dcmi *dcmi. If an interrupt occurs in the interval between the installation of the interrupt handler and the initialization of this field, NULL pointer dereference happens.
This field is dereferenced in the handler function without any check:
457 if (dcmi->sd_format->fourcc == V4L2_PIX_FMT_JPEG &&
458 dcmi->misr & IT_FRAME) {
The patch moves interrupt handler installation after initialization of the sd_format field that happens in dcmi_graph_notify_complete() via dcmi_set_default_fmt().
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/platform/stm32/stm32-dcmi.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/media/platform/stm32/stm32-dcmi.c +11 -8
@@ -128,6 +128,7 @@ struct stm32_dcmi {int sequence;struct list_head buffers;struct dcmi_buf *active; +int irq;struct v4l2_device v4l2_dev;struct video_device *vdev;
@@ -1759,6 +1760,14 @@ static int dcmi_graph_notify_complete(struct v4l2_async_notifier *notifier)return ret; } + ret =devm_request_threaded_irq (dcmi->dev, dcmi->irq, dcmi_irq_callback, + dcmi_irq_thread,IRQF_ONESHOT , +dev_name (dcmi->dev), dcmi); +if (ret) { +dev_err (dcmi->dev,"Unable to request irq %d\n" , dcmi->irq); +return ret; + } +return 0 ; }
@@ -1914,6 +1923,8 @@ static int dcmi_probe(struct platform_device *pdev)if (irq <=0 )return irq ? irq : -ENXIO ; + dcmi->irq = irq; + dcmi->res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!dcmi->res) {dev_err (&pdev->dev,"Could not get resource\n" );
@@ -1926,14 +1937,6 @@ static int dcmi_probe(struct platform_device *pdev)return PTR_ERR (dcmi->regs); } - ret =devm_request_threaded_irq (&pdev->dev, irq, dcmi_irq_callback, - dcmi_irq_thread,IRQF_ONESHOT , -dev_name (&pdev->dev), dcmi); -if (ret) { -dev_err (&pdev->dev,"Unable to request irq %d\n" , irq); -return ret; - } - mclk =devm_clk_get (&pdev->dev,"mclk" );if (IS_ERR (mclk)) {if (PTR_ERR (mclk) != -EPROBE_DEFER )
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 201/917 crypto: aesni - check walk.nbytes instead of err
In reply to Greg Kroah-HartmanFrom: Shreyansh Chouhan <[email protected]>
[ Upstream commit a2d3cbc80d2527b435154ff0f89b56ef4b84370f ]
In the code for xts_crypt(), we check for the err value returned by skcipher_walk_virt() and return from the function if it is non zero. However, skcipher_walk_virt() can set walk.nbytes to 0, which would cause us to call kernel_fpu_begin(), and then skip the kernel_fpu_end() call.
This patch checks for the walk.nbytes value instead, and returns if walk.nbytes is 0. This prevents us from calling kernel_fpu_begin() in the first place and also covers the case of having a non zero err value returned from skcipher_walk_virt().
--- arch/x86/crypto/aesni-intel_glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/crypto/aesni-intel_glue.c +1 -1
@@ -866,7 +866,7 @@ static int xts_crypt(struct skcipher_request *req, bool encrypt) req = &subreq; err =skcipher_walk_virt (&walk, req, false); -if (err) +if (!walk.nbytes)return err; }else { tail =0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 203/917 x86: Increase exception stack sizes
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 7fae4c24a2b84a66c7be399727aca11e7a888462 ]
It turns out that a single page of stack is trivial to overflow with all the tracing gunk enabled. Raise the exception stacks to 2 pages, which is still half the interrupt stacks, which are at 4 pages.
--- arch/x86/include/asm/page_64_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/page_64_types.h +1 -1
@@ -15,7 +15,7 @@#define THREAD_SIZE_ORDER (2 + KASAN_STACK_ORDER)#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) -#define EXCEPTION_STACK_ORDER (0 + KASAN_STACK_ORDER) +#define EXCEPTION_STACK_ORDER (1 + KASAN_STACK_ORDER)#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)#define IRQ_STACK_ORDER (2 + KASAN_STACK_ORDER)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 204/917 mwifiex: Run SET_BSS_MODE when changing from P2P to STATION vif-type
In reply to Greg Kroah-HartmanFrom: Jonas Dreßler <[email protected]>
[ Upstream commit c2e9666cdffd347460a2b17988db4cfaf2a68fb9 ]
We currently handle changing from the P2P to the STATION virtual interface type slightly different than changing from P2P to ADHOC: When changing to STATION, we don't send the SET_BSS_MODE command. We do send that command on all other type-changes though, and it probably makes sense to send the command since after all we just changed our BSS_MODE. Looking at prior changes to this part of the code, it seems that this is simply a leftover from old refactorings.
Since sending the SET_BSS_MODE command is the only difference between mwifiex_change_vif_to_sta_adhoc() and the current code, we can now use mwifiex_change_vif_to_sta_adhoc() for both switching to ADHOC and STATION interface type.
This does not fix any particular bug and just "looked right", so there's a small chance it might be a regression.
--- .../net/wireless/marvell/mwifiex/cfg80211.c | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +4 -18
@@ -1229,29 +1229,15 @@ mwifiex_cfg80211_change_virtual_intf(struct wiphy *wiphy,break ;case NL80211_IFTYPE_P2P_CLIENT :case NL80211_IFTYPE_P2P_GO : +if (mwifiex_cfg80211_deinit_p2p (priv)) +return -EFAULT ; +switch (type) { -case NL80211_IFTYPE_STATION : -if (mwifiex_cfg80211_deinit_p2p (priv)) -return -EFAULT ; - priv->adapter->curr_iface_comb.p2p_intf--; - priv->adapter->curr_iface_comb.sta_intf++; - dev->ieee80211_ptr->iftype = type; -if (mwifiex_deinit_priv_params (priv)) -return -1 ; -if (mwifiex_init_new_priv_params (priv, dev, type)) -return -1 ; -if (mwifiex_sta_init_cmd (priv, false, false)) -return -1 ; -break ;case NL80211_IFTYPE_ADHOC : -if (mwifiex_cfg80211_deinit_p2p (priv)) -return -EFAULT ; +case NL80211_IFTYPE_STATION :return mwifiex_change_vif_to_sta_adhoc (dev, curr_iftype, type, params); -break ;case NL80211_IFTYPE_AP : -if (mwifiex_cfg80211_deinit_p2p (priv)) -return -EFAULT ;return mwifiex_change_vif_to_ap (dev, curr_iftype, type, params);case NL80211_IFTYPE_UNSPECIFIED :
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 215/917 ath11k: Change DMA_FROM_DEVICE to DMA_TO_DEVICE when map reinjected packets
In reply to Greg Kroah-HartmanFrom: Baochen Qiang <[email protected]>
[ Upstream commit 86a03dad0f5ad8182ed5fcf7bf3eec71cd96577c ]
For fragmented packets, ath11k reassembles each fragment as a normal packet and then reinjects it into HW ring. In this case, the DMA direction should be DMA_TO_DEVICE, not DMA_FROM_DEVICE, otherwise invalid payload will be reinjected to HW and then delivered to host. What is more, since arbitrary memory could be allocated to the frame, we don't know what kind of data is contained in the buffer reinjected. Thus, as a bad result, private info may be leaked.
Note that this issue is only found on Intel platform.
Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +2 -2
@@ -3310,7 +3310,7 @@ static int ath11k_dp_rx_h_defrag_reo_reinject(struct ath11k *ar, struct dp_rx_ti paddr =dma_map_single (ab->dev, defrag_skb->data, defrag_skb->len +skb_tailroom (defrag_skb), -DMA_FROM_DEVICE ); +DMA_TO_DEVICE );if (dma_mapping_error (ab->dev, paddr))return -ENOMEM ;
@@ -3375,7 +3375,7 @@ err_free_idr:spin_unlock_bh (&rx_refill_ring->idr_lock); err_unmap_dma:dma_unmap_single (ab->dev, paddr, defrag_skb->len +skb_tailroom (defrag_skb), -DMA_FROM_DEVICE ); +DMA_TO_DEVICE );return ret; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 234/917 brcmfmac: Add DMI nvram filename quirk for Cyberbook T116 tablet
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 49c3eb3036e6359c5c20fe76c611a2c0e0d4710e ]
The Cyberbook T116 tablet contains quite generic names in the sys_vendor and product_name DMI strings, without this patch brcmfmac will try to load:
"brcmfmac43455-sdio.Default string-Default string.txt" as nvram file which is way too generic.
The nvram file shipped on the factory Android image contains the exact same settings as those used on the AcePC T8 mini PC, so point the new DMI nvram filename quirk to the acepc-t8 nvram file.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c +10 -0
@@ -75,6 +75,16 @@ static const struct dmi_system_id dmi_platform_data[] = { }, .driver_data = (void *)&acepc_t8_data, }, + { +/* Cyberbook T116 rugged tablet */ + .matches = { +DMI_EXACT_MATCH (DMI_BOARD_VENDOR ,"Default string" ), +DMI_EXACT_MATCH (DMI_BOARD_NAME ,"Cherry Trail CR" ), + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "20170531"), + }, +/* The factory image nvram file is identical to the ACEPC T8 one */ + .driver_data = (void *)&acepc_t8_data, + }, {/* Match for the GPDwin which unfortunately uses somewhat * generic dmi strings, which is why we test for 4 strings.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 243/917 media: ipu3-imgu: imgu_fmt: Handle properly try
In reply to Greg Kroah-HartmanFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit 553481e38045f349bb9aa596d03bebd020020c9c ]
For a try_fmt call, the node noes not need to be enabled.
Fixes v4l2-compliance
fail: v4l2-test-formats.cpp(717): Video Output Multiplanar is valid, but
no TRY_FMT was implemented
test VIDIOC_TRY_FMT: FAIL
--- drivers/staging/media/ipu3/ipu3-v4l2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/ipu3/ipu3-v4l2.c +1 -1
@@ -696,7 +696,7 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node,/* CSS expects some format on OUT queue */ if (i !=IPU3_CSS_QUEUE_OUT && - !imgu_pipe->nodes[inode].enabled) { + !imgu_pipe->nodes[inode].enabled && !try) { fmts[i] =NULL ;continue ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 244/917 media: ipu3-imgu: VIDIOC_QUERYCAP: Fix bus_info
In reply to Greg Kroah-HartmanFrom: Ricardo Ribalda <[email protected]>
[ Upstream commit ea2b9a33711604e91f8c826f4dcb3c12baa1990a ]
bus_info field had a different value for the media entity and the video device.
Fixes v4l2-compliance:
v4l2-compliance.cpp(637): media bus_info 'PCI:0000:00:05.0' differs from
V4L2 bus_info 'PCI:viewfinder'
--- drivers/staging/media/ipu3/ipu3-v4l2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/media/ipu3/ipu3-v4l2.c +3 -2
@@ -592,11 +592,12 @@ static const struct imgu_fmt *find_format(struct v4l2_format *f, u32 type)static int imgu_vidioc_querycap (struct file *file,void *fh,struct v4l2_capability *cap) { -struct imgu_video_device *node =file_to_intel_imgu_node (file); +struct imgu_device *imgu =video_drvdata (file);strscpy (cap->driver,IMGU_NAME ,sizeof (cap->driver));strscpy (cap->card,IMGU_NAME ,sizeof (cap->card)); -snprintf (cap->bus_info,sizeof (cap->bus_info),"PCI:%s" , node->name); +snprintf (cap->bus_info,sizeof (cap->bus_info),"PCI:%s" , +pci_name (imgu->pci_dev));return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 245/917 media: usb: dvd-usb: fix uninit-value bug in dibusb_read_eeprom_byte()
In reply to Greg Kroah-HartmanFrom: Anant Thazhemadam <[email protected]>
[ Upstream commit 899a61a3305d49e8a712e9ab20d0db94bde5929f ]
In dibusb_read_eeprom_byte(), if dibusb_i2c_msg() fails, val gets assigned an value that's not properly initialized.
Using kzalloc() in place of kmalloc() for the buffer fixes this issue, as the val can now be set to 0 in the event dibusb_i2c_msg() fails.
--- drivers/media/usb/dvb-usb/dibusb-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/dvb-usb/dibusb-common.c +1 -1
@@ -223,7 +223,7 @@ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val)u8 *buf;int rc; - buf =kmalloc (2 ,GFP_KERNEL ); + buf =kzalloc (2 ,GFP_KERNEL );if (!buf)return -ENOMEM ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 246/917 net-sysfs: try not to restart the syscall if it will fail eventually
In reply to Greg Kroah-HartmanFrom: Antoine Tenart <[email protected]>
[ Upstream commit 146e5e733310379f51924111068f08a3af0db830 ]
Due to deadlocks in the networking subsystem spotted 12 years ago[1], a workaround was put in place[2] to avoid taking the rtnl lock when it was not available and restarting the syscall (back to VFS, letting userspace spin). The following construction is found a lot in the net sysfs and sysctl code:
if (!rtnl_trylock())
return restart_syscall();This can be problematic when multiple userspace threads use such interfaces in a short period, making them to spin a lot. This happens for example when adding and moving virtual interfaces: userspace programs listening on events, such as systemd-udevd and NetworkManager, do trigger actions reading files in sysfs. It gets worse when a lot of virtual interfaces are created concurrently, say when creating containers at boot time.
Returning early without hitting the above pattern when the syscall will fail eventually does make things better. While it is not a fix for the issue, it does ease things.
[1] https://lore.kernel.org/netdev/[email protected]/
https://lore.kernel.org/netdev/[email protected]/ and https://lore.kernel.org/netdev/20090226084924.16cb3e08@nehalam/
[2] Rightfully, those deadlocks are *hard* to solve.
--- net/core/net-sysfs.c | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
net/core/net-sysfs.c +55 -0
@@ -175,6 +175,14 @@ static int change_carrier(struct net_device *dev, unsigned long new_carrier)static ssize_t carrier_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t len) { +struct net_device *netdev =to_net_dev (dev); + +/* The check is also done in change_carrier; this helps returning early +* without hitting the trylock/restart in netdev_store. +*/ +if (!netdev->netdev_ops->ndo_change_carrier) +return -EOPNOTSUPP ; +return netdev_store (dev, attr, buf, len, change_carrier); }
@@ -196,6 +204,12 @@ static ssize_t speed_show(struct device *dev,struct net_device *netdev =to_net_dev (dev);int ret = -EINVAL ; +/* The check is also done in __ethtool_get_link_ksettings; this helps +* returning early without hitting the trylock/restart below. +*/ +if (!netdev->ethtool_ops->get_link_ksettings) +return ret; +if (!rtnl_trylock ())return restart_syscall ();
@@ -216,6 +230,12 @@ static ssize_t duplex_show(struct device *dev,struct net_device *netdev =to_net_dev (dev);int ret = -EINVAL ; +/* The check is also done in __ethtool_get_link_ksettings; this helps +* returning early without hitting the trylock/restart below. +*/ +if (!netdev->ethtool_ops->get_link_ksettings) +return ret; +if (!rtnl_trylock ())return restart_syscall ();
@@ -468,6 +488,14 @@ static ssize_t proto_down_store(struct device *dev,struct device_attribute *attr, const char *buf, size_t len) { + struct net_device *netdev = to_net_dev(dev); + +/* The check is also done in change_proto_down; this helps returning +* early without hitting the trylock/restart in netdev_store. +*/ +if (!netdev->netdev_ops->ndo_change_proto_down) +return -EOPNOTSUPP ; +return netdev_store (dev, attr, buf, len, change_proto_down); }NETDEVICE_SHOW_RW (proto_down, fmt_dec);
@@ -478,6 +506,12 @@ static ssize_t phys_port_id_show(struct device *dev,struct net_device *netdev =to_net_dev (dev);ssize_t ret = -EINVAL ; +/* The check is also done in dev_get_phys_port_id; this helps returning +* early without hitting the trylock/restart below. +*/ +if (!netdev->netdev_ops->ndo_get_phys_port_id) +return -EOPNOTSUPP ; +if (!rtnl_trylock ())return restart_syscall ();
@@ -500,6 +534,13 @@ static ssize_t phys_port_name_show(struct device *dev,struct net_device *netdev =to_net_dev (dev);ssize_t ret = -EINVAL ; +/* The checks are also done in dev_get_phys_port_name; this helps +* returning early without hitting the trylock/restart below. +*/ +if (!netdev->netdev_ops->ndo_get_phys_port_name && + !netdev->netdev_ops->ndo_get_devlink_port) +return -EOPNOTSUPP ; +if (!rtnl_trylock ())return restart_syscall ();
@@ -522,6 +563,14 @@ static ssize_t phys_switch_id_show(struct device *dev,struct net_device *netdev =to_net_dev (dev);ssize_t ret = -EINVAL ; +/* The checks are also done in dev_get_phys_port_name; this helps +* returning early without hitting the trylock/restart below. This works +* because recurse is false when calling dev_get_port_parent_id. +*/ +if (!netdev->netdev_ops->ndo_get_port_parent_id && + !netdev->netdev_ops->ndo_get_devlink_port) +return -EOPNOTSUPP ; +if (!rtnl_trylock ())return restart_syscall ();
@@ -1226,6 +1275,12 @@ static ssize_t tx_maxrate_store(struct netdev_queue *queue,if (!capable (CAP_NET_ADMIN ))return -EPERM ; +/* The check is also done later; this helps returning early without +* hitting the trylock/restart below. +*/ +if (!dev->netdev_ops->ndo_set_tx_maxrate) +return -EOPNOTSUPP ; + err =kstrtou32 (buf,10 , &rate);if (err <0 )return err;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 247/917 drm/amdkfd: rm BO resv on validation to avoid deadlock
In reply to Greg Kroah-HartmanFrom: Alex Sierra <[email protected]>
[ Upstream commit ec6abe831a843208e99a59adf108adba22166b3f ]
This fix the deadlock with the BO reservations during SVM_BO evictions while allocations in VRAM are concurrently performed. More specific, while the ttm waits for the fence to be signaled (ttm_bo_wait), it already has the BO reserved. In parallel, the restore worker might be running, prefetching memory to VRAM. This also requires to reserve the BO, but blocks the mmap semaphore first. The deadlock happens when the SVM_BO eviction worker kicks in and waits for the mmap semaphore held in restore worker. Preventing signal the fence back, causing the deadlock until the ttm times out.
We don't need to hold the BO reservation anymore during validation and mapping. Now the physical addresses are taken from hmm_range_fault. We also take migrate_mutex to prevent range migration while validate_and_map update GPU page table.
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1 -6
@@ -1307,7 +1307,7 @@ struct svm_validate_context {struct svm_range *prange;bool intr;unsigned long bitmap[MAX_GPU_INSTANCE ]; -struct ttm_validate_buffer tv[MAX_GPU_INSTANCE +1 ]; +struct ttm_validate_buffer tv[MAX_GPU_INSTANCE ];struct list_head validate_list;struct ww_acquire_ctx ticket; };
@@ -1334,11 +1334,6 @@ static int svm_range_reserve_bos(struct svm_validate_context *ctx) ctx->tv[gpuidx].num_shared =4 ;list_add (&ctx->tv[gpuidx].head, &ctx->validate_list); } -if (ctx->prange->svm_bo && ctx->prange->ttm_res) { - ctx->tv[MAX_GPU_INSTANCE ].bo = &ctx->prange->svm_bo->bo->tbo; - ctx->tv[MAX_GPU_INSTANCE ].num_shared =1 ; -list_add (&ctx->tv[MAX_GPU_INSTANCE ].head, &ctx->validate_list); - } r =ttm_eu_reserve_buffers (&ctx->ticket, &ctx->validate_list, ctx->intr,NULL );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 255/917 ACPI: scan: Release PM resources blocked by unused objects
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit c10383e8ddf4810b9a5c1595404c2724d925a0a6 ]
On some systems the ACPI namespace contains device objects that are not used in certain configurations of the system. If they start off in the D0 power state configuration, they will stay in it until the system reboots, because of the lack of any mechanism possibly causing their configuration to change. If that happens, they may prevent some power resources from being turned off or generally they may prevent the platform from getting into the deepest low-power states thus causing some energy to be wasted.
Address this issue by changing the configuration of unused ACPI device objects to the D3cold power state one after carrying out the ACPI-based enumeration of devices.
--- drivers/acpi/glue.c | 25 +++++++++++++++++++++++++ drivers/acpi/internal.h | 1 + drivers/acpi/scan.c | 6 ++++++ 3 files changed, 32 insertions(+)
drivers/acpi/glue.c +25 -0
@@ -340,3 +340,28 @@ void acpi_device_notify_remove(struct device *dev)acpi_unbind_one (dev); } + +int acpi_dev_turn_off_if_unused (struct device *dev,void *not_used) +{ +struct acpi_device *adev =to_acpi_device (dev); + +/* +* Skip device objects with device IDs, because they may be in use even +* if they are not companions of any physical device objects. +*/ +if (adev->pnp.type.hardware_id) +return 0 ; + +mutex_lock (&adev->physical_node_lock); + +/* +* Device objects without device IDs are not in use if they have no +* corresponding physical device objects. +*/ +if (list_empty (&adev->physical_node_list)) +acpi_device_set_power (adev,ACPI_STATE_D3_COLD ); + +mutex_unlock (&adev->physical_node_lock); + +return 0 ; +}
drivers/acpi/internal.h +1 -0
@@ -117,6 +117,7 @@ bool acpi_device_is_battery(struct acpi_device *adev);bool acpi_device_is_first_physical_node (struct acpi_device *adev,const struct device *dev);int acpi_bus_register_early_device (int type); +int acpi_dev_turn_off_if_unused (struct device *dev,void *not_used);/* -------------------------------------------------------------------------- Device Matching and Notification
drivers/acpi/scan.c +6 -0
@@ -2559,6 +2559,12 @@ int __init acpi_scan_init(void) } } +/* +* Make sure that power management resources are not blocked by ACPI +* device objects with no users. +*/ +bus_for_each_dev (&acpi_bus_type,NULL ,NULL , acpi_dev_turn_off_if_unused); +acpi_turn_off_unused_power_resources (); acpi_scan_initialized = true;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 256/917 drm/amd/display: fix null pointer deref when plugging in display
In reply to Greg Kroah-HartmanFrom: Aurabindo Pillai <[email protected]>
[ Upstream commit 1f3b22e4eb162e0b1d423106a47484943a22a309 ]
[Why&How]
When system boots in headless mode, connecting a 4k display creates a null pointer dereference due to hubp for a certain plane being null. Add a condition to check for null hubp before dereferencing it.
--- drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +2 -1
@@ -1002,7 +1002,8 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc,/* turning off DPG */ pipe_ctx->plane_res.hubp->funcs->set_blank (pipe_ctx->plane_res.hubp, false);for (mpcc_pipe = pipe_ctx->bottom_pipe; mpcc_pipe; mpcc_pipe = mpcc_pipe->bottom_pipe) - mpcc_pipe->plane_res.hubp->funcs->set_blank (mpcc_pipe->plane_res.hubp, false); +if (mpcc_pipe->plane_res.hubp) + mpcc_pipe->plane_res.hubp->funcs->set_blank (mpcc_pipe->plane_res.hubp, false); stream_res->opp->funcs->opp_set_disp_pattern_generator (stream_res->opp, test_pattern, color_space, color_depth, solid_color, width, height, offset);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 264/917 floppy: fix calling platform_device_unregister() on invalid drives
In reply to Greg Kroah-HartmanFrom: Luis Chamberlain <[email protected]>
[ Upstream commit 662167e59d2f3c15a44a88088fc6c1a67c8a3650 ]
platform_device_unregister() should only be called when a respective platform_device_register() is called. However the floppy driver currently allows failures when registring a drive and a bail out could easily cause an invalid call to platform_device_unregister() where it was not intended.
Fix this by adding a bool to keep track of when the platform device was registered for a drive.
This does not fix any known panic / bug. This issue was found through code inspection while preparing the driver to use the up and coming support for device_add_disk() error handling.
Quoted 1 line
From what I can tell from code inspection, chances of this
ever happening should be insanely small, perhaps OOM.
--- drivers/block/floppy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/block/floppy.c +7 -2
@@ -4478,6 +4478,7 @@ static const struct blk_mq_ops floppy_mq_ops = { };static struct platform_device floppy_device[N_DRIVE ]; +static bool registered[N_DRIVE ];static bool floppy_available (int drive) {
@@ -4693,6 +4694,8 @@ static int __init do_floppy_init(void)if (err) goto out_remove_drives; + registered[drive] = true; +device_add_disk (&floppy_device[drive].dev, disks[drive][0 ],NULL ); }
@@ -4703,7 +4706,8 @@ out_remove_drives:while (drive--) {if (floppy_available (drive)) {del_gendisk (disks[drive][0 ]); -platform_device_unregister (&floppy_device[drive]); +if (registered[drive]) +platform_device_unregister (&floppy_device[drive]); } } out_release_dma:
@@ -4946,7 +4950,8 @@ static void __exit floppy_module_exit(void)if (disks[drive][i])del_gendisk (disks[drive][i]); } -platform_device_unregister (&floppy_device[drive]); +if (registered[drive]) +platform_device_unregister (&floppy_device[drive]); }for (i =0 ; i <ARRAY_SIZE (floppy_type); i++) {if (disks[drive][i])
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 265/917 md: update superblock after changing rdev flags in state_store
In reply to Greg Kroah-HartmanFrom: Xiao Ni <[email protected]>
[ Upstream commit 8b9e2291e355a0eafdd5b1e21a94a6659f24b351 ]
When the in memory flag is changed, we need to persist the change in the rdev superblock flags. This is needed for "writemostly" and "failfast".
--- drivers/md/md.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/md/md.c +10 -1
@@ -2976,7 +2976,11 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)* -write_error - clears WriteErrorSeen * {,-}failfast - set/clear FailFast */ + +struct mddev *mddev = rdev->mddev;int err = -EINVAL ; +bool need_update_sb = false; +if (cmd_match (buf,"faulty" ) && rdev->mddev->pers) {md_error (rdev->mddev, rdev);if (test_bit (Faulty, &rdev->flags))
@@ -2991,7 +2995,6 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)if (rdev->raid_disk >=0 ) err = -EBUSY ;else { -struct mddev *mddev = rdev->mddev; err =0 ;if (mddev_is_clustered (mddev)) err = md_cluster_ops->remove_disk (mddev, rdev);
@@ -3008,10 +3011,12 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len) }else if (cmd_match (buf,"writemostly" )) {set_bit (WriteMostly, &rdev->flags);mddev_create_serial_pool (rdev->mddev, rdev, false); + need_update_sb = true; err =0 ; }else if (cmd_match (buf,"-writemostly" )) {mddev_destroy_serial_pool (rdev->mddev, rdev, false);clear_bit (WriteMostly, &rdev->flags); + need_update_sb = true; err =0 ; }else if (cmd_match (buf,"blocked" )) {set_bit (Blocked, &rdev->flags);
@@ -3037,9 +3042,11 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len) err =0 ; }else if (cmd_match (buf,"failfast" )) {set_bit (FailFast, &rdev->flags); + need_update_sb = true; err =0 ; }else if (cmd_match (buf,"-failfast" )) {clear_bit (FailFast, &rdev->flags); + need_update_sb = true; err =0 ; }else if (cmd_match (buf,"-insync" ) && rdev->raid_disk >=0 && !test_bit (Journal, &rdev->flags)) {
@@ -3118,6 +3125,8 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)clear_bit (ExternalBbl, &rdev->flags); err =0 ; } +if (need_update_sb) +md_update_sb (mddev,1 );if (!err)sysfs_notify_dirent_safe (rdev->sysfs_state);return err ? err : len;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 238/917 kselftests/sched: cleanup the child processes
In reply to Greg Kroah-HartmanFrom: Li Zhijian <[email protected]>
[ Upstream commit 1c36432b278cecf1499f21fae19836e614954309 ]
Previously, 'make -C sched run_tests' will block forever when it occurs something wrong where the *selftests framework* is waiting for its child processes to exit.
[root@iaas-rpma sched]# ./cs_prctl_test
## Create a thread/process/process group hiearchy
Not a core sched system
tid=74985, / tgid=74985 / pgid=74985: ffffffffffffffff Not a core sched system
tid=74986, / tgid=74986 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74988, / tgid=74986 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74989, / tgid=74986 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74990, / tgid=74986 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74987, / tgid=74987 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74991, / tgid=74987 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74992, / tgid=74987 / pgid=74985: ffffffffffffffff
Not a core sched system
tid=74993, / tgid=74987 / pgid=74985: ffffffffffffffffNot a core sched system
(268) FAILED: get_cs_cookie(0) == 0
## Set a cookie on entire process group
-1 = prctl(62, 1, 0, 2, 0)core_sched create failed -- PGID: Invalid argument (cs_prctl_test.c:272) -
[root@iaas-rpma sched]# ps
PID TTY TIME CMD
4605 pts/2 00:00:00 bash 74986 pts/2 00:00:00 cs_prctl_test 74987 pts/2 00:00:00 cs_prctl_test 74999 pts/2 00:00:00 ps
--- tools/testing/selftests/sched/cs_prctl_test.c | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-)
tools/testing/selftests/sched/cs_prctl_test.c +18 -10
@@ -62,6 +62,17 @@ enum pid_type {PIDTYPE_PID = 0, PIDTYPE_TGID, PIDTYPE_PGID};const int THREAD_CLONE_FLAGS =CLONE_THREAD |CLONE_SIGHAND |CLONE_FS |CLONE_VM |CLONE_FILES ; +struct child_args { +int num_threads; +int pfd[2 ]; +int cpid; +int thr_tids[MAX_THREADS ]; +}; + +static struct child_args procs[MAX_PROCESSES ]; +static int num_processes =2 ; +static int need_cleanup =0 ; +static int _prctl (int option,unsigned long arg2,unsigned long arg3,unsigned long arg4,unsigned long arg5) {
@@ -78,8 +89,14 @@ static int _prctl(int option, unsigned long arg2, unsigned long arg3, unsigned l#define handle_error (msg) __handle_error(__FILE__, __LINE__, msg)static void __handle_error (char *fn,int ln,char *msg) { +int pidx;printf ("(%s:%d) - " , fn, ln);perror (msg); +if (need_cleanup) { +for (pidx =0 ; pidx < num_processes; ++pidx) +kill (procs[pidx].cpid,15 ); + need_cleanup =0 ; + }exit (EXIT_FAILURE ); }
@@ -106,13 +123,6 @@ static unsigned long get_cs_cookie(int pid)return cookie; } -struct child_args { -int num_threads; -int pfd[2 ]; -int cpid; -int thr_tids[MAX_THREADS ]; -}; -static int child_func_thread (void __attribute__((unused))*arg) {while (1 )
@@ -212,10 +222,7 @@ void _validate(int line, int val, char *msg)int main (int argc,char *argv[]) { -struct child_args procs[MAX_PROCESSES ]; -int keypress =0 ; -int num_processes =2 ;int num_threads =3 ;int delay =0 ;int res =0 ;
@@ -262,6 +269,7 @@ int main(int argc, char *argv[])printf ("\n## Create a thread/process/process group hiearchy\n" );create_processes (num_processes, num_threads, procs); + need_cleanup =1 ;disp_processes (num_processes, procs);validate (get_cs_cookie (0 ) ==0 );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 266/917 memstick: r592: Fix a UAF bug when removing the driver
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 738216c1953e802aa9f930c5d15b8f9092c847ff ]
In r592_remove(), the driver will free dma after freeing the host, which may cause a UAF bug.
The following log reveals it:
[ 45.361796 ] BUG: KASAN: use-after-free in r592_remove+0x269/0x350 [r592] [ 45.364286 ] Call Trace: [ 45.364472 ] dump_stack_lvl+0xa8/0xd1 [ 45.364751 ] print_address_description+0x87/0x3b0 [ 45.365137 ] kasan_report+0x172/0x1c0 [ 45.365415 ] ? r592_remove+0x269/0x350 [r592] [ 45.365834 ] ? r592_remove+0x269/0x350 [r592] [ 45.366168 ] __asan_report_load8_noabort+0x14/0x20 [ 45.366531 ] r592_remove+0x269/0x350 [r592] [ 45.378785 ] [ 45.378903 ] Allocated by task 4674: [ 45.379162 ] ____kasan_kmalloc+0xb5/0xe0 [ 45.379455 ] __kasan_kmalloc+0x9/0x10 [ 45.379730 ] __kmalloc+0x150/0x280 [ 45.379984 ] memstick_alloc_host+0x2a/0x190 [ 45.380664 ] [ 45.380781 ] Freed by task 5509: [ 45.381014 ] kasan_set_track+0x3d/0x70 [ 45.381293 ] kasan_set_free_info+0x23/0x40 [ 45.381635 ] ____kasan_slab_free+0x10b/0x140 [ 45.381950 ] __kasan_slab_free+0x11/0x20 [ 45.382241 ] slab_free_freelist_hook+0x81/0x150 [ 45.382575 ] kfree+0x13e/0x290 [ 45.382805 ] memstick_free+0x1c/0x20 [ 45.383070 ] device_release+0x9c/0x1d0 [ 45.383349 ] kobject_put+0x2ef/0x4c0 [ 45.383616 ] put_device+0x1f/0x30 [ 45.383865 ] memstick_free_host+0x24/0x30 [ 45.384162 ] r592_remove+0x242/0x350 [r592] [ 45.384473 ] pci_device_remove+0xa9/0x250
--- drivers/memstick/host/r592.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/memstick/host/r592.c +4 -4
@@ -838,15 +838,15 @@ static void r592_remove(struct pci_dev *pdev) }memstick_remove_host (dev->host); +if (dev->dummy_dma_page) +dma_free_coherent (&pdev->dev,PAGE_SIZE , dev->dummy_dma_page, + dev->dummy_dma_page_physical_address); +free_irq (dev->irq, dev);iounmap (dev->mmio);pci_release_regions (pdev);pci_disable_device (pdev);memstick_free_host (dev->host); - -if (dev->dummy_dma_page) -dma_free_coherent (&pdev->dev,PAGE_SIZE , dev->dummy_dma_page, - dev->dummy_dma_page_physical_address); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 281/917 nvme: drop scan_lock and always kick requeue list when removing namespaces
In reply to Greg Kroah-HartmanFrom: Hannes Reinecke <[email protected]>
[ Upstream commit 2b81a5f015199f3d585ce710190a9e87714d3c1e ]
When reading the partition table on initial scan hits an I/O error the I/O will hang with the scan_mutex held:
[<0>] do_read_cache_page+0x49b/0x790 [<0>] read_part_sector+0x39/0xe0 [<0>] read_lba+0xf9/0x1d0 [<0>] efi_partition+0xf1/0x7f0 [<0>] bdev_disk_changed+0x1ee/0x550 [<0>] blkdev_get_whole+0x81/0x90 [<0>] blkdev_get_by_dev+0x128/0x2e0 [<0>] device_add_disk+0x377/0x3c0 [<0>] nvme_mpath_set_live+0x130/0x1b0 [nvme_core] [<0>] nvme_mpath_add_disk+0x150/0x160 [nvme_core] [<0>] nvme_alloc_ns+0x417/0x950 [nvme_core] [<0>] nvme_validate_or_alloc_ns+0xe9/0x1e0 [nvme_core] [<0>] nvme_scan_work+0x168/0x310 [nvme_core] [<0>] process_one_work+0x231/0x420
and trying to delete the controller will deadlock as it tries to grab the scan mutex:
[<0>] nvme_mpath_clear_ctrl_paths+0x25/0x80 [nvme_core] [<0>] nvme_remove_namespaces+0x31/0xf0 [nvme_core] [<0>] nvme_do_delete_ctrl+0x4b/0x80 [nvme_core]
As we're now properly ordering the namespace list there is no need to hold the scan_mutex in nvme_mpath_clear_ctrl_paths() anymore. And we always need to kick the requeue list as the path will be marked as unusable and I/O will be requeued _without_ a current path.
--- drivers/nvme/host/multipath.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/nvme/host/multipath.c +4 -5
@@ -138,13 +138,12 @@ void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl) {struct nvme_ns *ns; -mutex_lock (&ctrl->scan_lock);down_read (&ctrl->namespaces_rwsem); -list_for_each_entry (ns, &ctrl->namespaces, list) -if (nvme_mpath_clear_current_path (ns)) -kblockd_schedule_work (&ns->head->requeue_work); +list_for_each_entry (ns, &ctrl->namespaces, list) { +nvme_mpath_clear_current_path (ns); +kblockd_schedule_work (&ns->head->requeue_work); + }up_read (&ctrl->namespaces_rwsem); -mutex_unlock (&ctrl->scan_lock); }void nvme_mpath_revalidate_paths (struct nvme_ns *ns)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 282/917 samples/bpf: Fix application of sizeof to pointer
In reply to Greg Kroah-HartmanFrom: David Yang <[email protected]>
[ Upstream commit b599015f044df53e93ad0a2957b615bc1a26bf73 ]
The coccinelle check report:
"./samples/bpf/xdp_redirect_cpu_user.c:397:32-38:
ERROR: application of sizeof to pointer"
Using the "strlen" to fix it.
--- samples/bpf/xdp_redirect_cpu_user.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
samples/bpf/xdp_redirect_cpu_user.c +2 -4
@@ -325,7 +325,6 @@ int main(int argc, char **argv)int add_cpu =-1 ;int ifindex =-1 ;int *cpu, i, opt; -char *ifname;__u32 qsize;int n_cpus;
@@ -393,9 +392,8 @@ int main(int argc, char **argv)fprintf (stderr,"-d/--dev name too long\n" ); goto end_cpu; } - ifname = (char *)&ifname_buf; -safe_strncpy (ifname, optarg,sizeof (ifname)); - ifindex =if_nametoindex (ifname); +safe_strncpy (ifname_buf, optarg,strlen (ifname_buf)); + ifindex =if_nametoindex (ifname_buf);if (!ifindex) ifindex =strtoul (optarg,NULL ,0 );if (!ifindex) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 288/917 smackfs: use __GFP_NOFAIL for smk_cipso_doi()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit f91488ee15bd3cac467e2d6a361fc2d34d1052ae ]
syzbot is reporting kernel panic at smk_cipso_doi() due to memory allocation fault injection [1]. The reason for need to use panic() was not explained. But since no fix was proposed for 18 months, for now let's use __GFP_NOFAIL for utilizing syzbot resource on other bugs.
--- security/smack/smackfs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
security/smack/smackfs.c +1 -3
@@ -693,9 +693,7 @@ static void smk_cipso_doi(void)printk (KERN_WARNING "%s:%d remove rc = %d\n" , __func__, __LINE__, rc); - doip =kmalloc (sizeof (struct cipso_v4_doi ),GFP_KERNEL ); -if (doip ==NULL ) -panic ("smack: Failed to initialize cipso DOI.\n" ); + doip =kmalloc (sizeof (struct cipso_v4_doi ),GFP_KERNEL | __GFP_NOFAIL); doip->map.std =NULL ; doip->doi = smk_cipso_doi_value; doip->type =CIPSO_V4_MAP_PASS ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 293/917 gfs2: Cancel remote delete work asynchronously
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit 486408d690e130c3adacf816754b97558d715f46 ]
In gfs2_inode_lookup and gfs2_create_inode, we're calling gfs2_cancel_delete_work which currently cancels any remote delete work (delete_work_func) synchronously. This means that if the work is currently running, it will wait for it to finish. We're doing this to pevent a previous instance of an inode from having any influence on the next instance.
However, delete_work_func uses gfs2_inode_lookup internally, and we can end up in a deadlock when delete_work_func gets interrupted at the wrong time. For example,
(1) An inode's iopen glock has delete work queued, but the inode itself has been evicted from the inode cache.
(2) The delete work is preempted before reaching gfs2_inode_lookup.
(3) Another process recreates the inode (gfs2_create_inode). It tries to cancel any outstanding delete work, which blocks waiting for the ongoing delete work to finish.
(4) The delete work calls gfs2_inode_lookup, which blocks waiting for gfs2_create_inode to instantiate and unlock the new inode => deadlock.
It turns out that when the delete work notices that its inode has been re-instantiated, it will do nothing. This means that it's safe to cancel the delete work asynchronously. This prevents the kind of deadlock described above.
--- fs/gfs2/glock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/glock.c +1 -1
@@ -1919,7 +1919,7 @@ bool gfs2_queue_delete_work(struct gfs2_glock *gl, unsigned long delay)void gfs2_cancel_delete_work (struct gfs2_glock *gl) { -if (cancel_delayed_work_sync (&gl->gl_delete)) { +if (cancel_delayed_work (&gl->gl_delete)) {clear_bit (GLF_PENDING_DELETE , &gl->gl_flags);gfs2_glock_put (gl); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 294/917 gfs2: Fix glock_hash_walk bugs
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit 7427f3bb49d81525b7dd1d0f7c5f6bbc752e6f0e ]
So far, glock_hash_walk took a reference on each glock it iterated over, and it was the examiner's responsibility to drop those references. Dropping the final reference to a glock can sleep and the examiners are called in a RCU critical section with spin locks held, so examiners that didn't need the extra reference had to drop it asynchronously via gfs2_glock_queue_put or similar. This wasn't done correctly in thaw_glock which did call gfs2_glock_put, and not at all in dump_glock_func.
Change glock_hash_walk to not take glock references at all. That way, the examiners that don't need them won't have to bother with slow asynchronous puts, and the examiners that do need references can take them themselves.
--- fs/gfs2/glock.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
fs/gfs2/glock.c +12 -10
@@ -1893,10 +1893,10 @@ static void glock_hash_walk(glock_examiner examiner, const struct gfs2_sbd *sdp)do {rhashtable_walk_start (&iter); -while ((gl =rhashtable_walk_next (&iter)) && !IS_ERR (gl)) -if (gl->gl_name.ln_sbd == sdp && -lockref_get_not_dead (&gl->gl_lockref)) +while ((gl =rhashtable_walk_next (&iter)) && !IS_ERR (gl)) { +if (gl->gl_name.ln_sbd == sdp)examiner (gl); + }rhashtable_walk_stop (&iter); }while (cond_resched (), gl ==ERR_PTR (-EAGAIN ));
@@ -1938,7 +1938,6 @@ static void flush_delete_work(struct gfs2_glock *gl) &gl->gl_delete, 0); } } -gfs2_glock_queue_work (gl,0 ); }void gfs2_flush_delete_work (struct gfs2_sbd *sdp)
@@ -1955,10 +1954,10 @@ void gfs2_flush_delete_work(struct gfs2_sbd *sdp)static void thaw_glock (struct gfs2_glock *gl) { -if (!test_and_clear_bit (GLF_FROZEN , &gl->gl_flags)) { -gfs2_glock_put (gl); +if (!test_and_clear_bit (GLF_FROZEN , &gl->gl_flags)) +return ; +if (!lockref_get_not_dead (&gl->gl_lockref))return ; - }set_bit (GLF_REPLY_PENDING , &gl->gl_flags);gfs2_glock_queue_work (gl,0 ); }
@@ -1974,9 +1973,12 @@ static void clear_glock(struct gfs2_glock *gl)gfs2_glock_remove_from_lru (gl);spin_lock (&gl->gl_lockref.lock); -if (gl->gl_state !=LM_ST_UNLOCKED ) -handle_callback (gl,LM_ST_UNLOCKED ,0 , false); -__gfs2_glock_queue_work (gl,0 ); +if (!__lockref_is_dead (&gl->gl_lockref)) { + gl->gl_lockref.count++; +if (gl->gl_state !=LM_ST_UNLOCKED ) +handle_callback (gl,LM_ST_UNLOCKED ,0 , false); +__gfs2_glock_queue_work (gl,0 ); + }spin_unlock (&gl->gl_lockref.lock); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 295/917 ARM: 9136/1: ARMv7-M uses BE-8, not BE-32
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 345dac33f58894a56d17b92a41be10e16585ceff ]
When configuring the kernel for big-endian, we set either BE-8 or BE-32 based on the CPU architecture level. Until linux-4.4, we did not have any ARMv7-M platform allowing big-endian builds, but now i.MX/Vybrid is in that category, adn we get a build error because of this:
arch/arm/kernel/module-plts.c: In function 'get_module_plt':arch/arm/kernel/module-plts.c:60:46: error: implicit declaration of function '__opcode_to_mem_thumb32' [-Werror=implicit-function-declaration]
This comes down to picking the wrong default, ARMv7-M uses BE8 like ARMv7-A does. Changing the default gets the kernel to compile and presumably works.
https://lore.kernel.org/all/[email protected]/
--- arch/arm/mm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/Kconfig +1 -1
@@ -750,7 +750,7 @@ config CPU_BIG_ENDIAN config CPU_ENDIAN_BE8 bool depends on CPU_BIG_ENDIAN - default CPU_V6 || CPU_V6K || CPU_V7 + default CPU_V6 || CPU_V6K || CPU_V7 || CPU_V7M help Support for the BE-8 (big-endian) mode on ARMv6 and ARMv7 processors.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 303/917 btrfs: do not take the uuid_mutex in btrfs_rm_device
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit 8ef9dc0f14ba6124c62547a4fdc59b163d8b864e ]
We got the following lockdep splat while running fstests (specifically btrfs/003 and btrfs/020 in a row) with the new rc. This was uncovered by 87579e9b7d8d ("loop: use worker per cgroup instead of kworker") which converted loop to using workqueues, which comes with lockdep annotations that don't exist with kworkers. The lockdep splat is as follows:
WARNING: possible circular locking dependency detected 5.14.0-rc2-custom+ #34 Not tainted
------------------------------------------------------
losetup/156417 is trying to acquire lock:
ffff9c7645b02d38 ((wq_completion)loop0){+.+.}-{0:0}, at: flush_workqueue+0x84/0x600
but task is already holding lock:
ffff9c7647395468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x41/0x650 [loop]
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #5 (&lo->lo_mutex){+.+.}-{3:3}:
__mutex_lock+0xba/0x7c0 lo_open+0x28/0x60 [loop] blkdev_get_whole+0x28/0xf0 blkdev_get_by_dev.part.0+0x168/0x3c0 blkdev_open+0xd2/0xe0 do_dentry_open+0x163/0x3a0 path_openat+0x74d/0xa40 do_filp_open+0x9c/0x140 do_sys_openat2+0xb1/0x170 __x64_sys_openat+0x54/0x90 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
-> #4 (&disk->open_mutex){+.+.}-{3:3}:
__mutex_lock+0xba/0x7c0 blkdev_get_by_dev.part.0+0xd1/0x3c0 blkdev_get_by_path+0xc0/0xd0 btrfs_scan_one_device+0x52/0x1f0 [btrfs] btrfs_control_ioctl+0xac/0x170 [btrfs] __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
-> #3 (uuid_mutex){+.+.}-{3:3}:
__mutex_lock+0xba/0x7c0 btrfs_rm_device+0x48/0x6a0 [btrfs] btrfs_ioctl+0x2d1c/0x3110 [btrfs] __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
-> #2 (sb_writers#11){.+.+}-{0:0}:
lo_write_bvec+0x112/0x290 [loop] loop_process_work+0x25f/0xcb0 [loop] process_one_work+0x28f/0x5d0 worker_thread+0x55/0x3c0 kthread+0x140/0x170 ret_from_fork+0x22/0x30
-> #1 ((work_completion)(&lo->rootcg_work)){+.+.}-{0:0}:
process_one_work+0x266/0x5d0 worker_thread+0x55/0x3c0 kthread+0x140/0x170 ret_from_fork+0x22/0x30
-> #0 ((wq_completion)loop0){+.+.}-{0:0}:
__lock_acquire+0x1130/0x1dc0 lock_acquire+0xf5/0x320 flush_workqueue+0xae/0x600 drain_workqueue+0xa0/0x110 destroy_workqueue+0x36/0x250 __loop_clr_fd+0x9a/0x650 [loop] lo_ioctl+0x29d/0x780 [loop] block_ioctl+0x3f/0x50 __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
other info that might help us debug this:
Chain exists of:
(wq_completion)loop0 --> &disk->open_mutex --> &lo->lo_mutex
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&lo->lo_mutex);
lock(&disk->open_mutex);
lock(&lo->lo_mutex);
lock((wq_completion)loop0); *** DEADLOCK ***
1 lock held by losetup/156417:
#0: ffff9c7647395468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x41/0x650 [loop]
stack backtrace: CPU: 8 PID: 156417 Comm: losetup Not tainted 5.14.0-rc2-custom+ #34 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 Call Trace: dump_stack_lvl+0x57/0x72 check_noncircular+0x10a/0x120 __lock_acquire+0x1130/0x1dc0 lock_acquire+0xf5/0x320 ? flush_workqueue+0x84/0x600 flush_workqueue+0xae/0x600 ? flush_workqueue+0x84/0x600 drain_workqueue+0xa0/0x110 destroy_workqueue+0x36/0x250 __loop_clr_fd+0x9a/0x650 [loop] lo_ioctl+0x29d/0x780 [loop] ? __lock_acquire+0x3a0/0x1dc0 ? update_dl_rq_load_avg+0x152/0x360 ? lock_is_held_type+0xa5/0x120 ? find_held_lock.constprop.0+0x2b/0x80 block_ioctl+0x3f/0x50 __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f645884de6b
Usually the uuid_mutex exists to protect the fs_devices that map together all of the devices that match a specific uuid. In rm_device we're messing with the uuid of a device, so it makes sense to protect that here.
However in doing that it pulls in a whole host of lockdep dependencies, as we call mnt_may_write() on the sb before we grab the uuid_mutex, thus we end up with the dependency chain under the uuid_mutex being added under the normal sb write dependency chain, which causes problems with loop devices.
We don't need the uuid mutex here however. If we call btrfs_scan_one_device() before we scratch the super block we will find the fs_devices and not find the device itself and return EBUSY because the fs_devices is open. If we call it after the scratch happens it will not appear to be a valid btrfs file system.
We do not need to worry about other fs_devices modifying operations here because we're protected by the exclusive operations locking.
So drop the uuid_mutex here in order to fix the lockdep splat.
A more detailed explanation from the discussion:
We are worried about rm and scan racing with each other, before this change we'll zero the device out under the UUID mutex so when scan does run it'll make sure that it can go through the whole device scan thing without rm messing with us.
We aren't worried if the scratch happens first, because the result is we don't think this is a btrfs device and we bail out.
The only case we are concerned with is we scratch _after_ scan is able to read the superblock and gets a seemingly valid super block, so lets consider this case.
Scan will call device_list_add() with the device we're removing. We'll call find_fsid_with_metadata_uuid() and get our fs_devices for this UUID. At this point we lock the fs_devices->device_list_mutex. This is what protects us in this case, but we have two cases here.
1. We aren't to the device removal part of the RM. We found our device, and device name matches our path, we go down and we set total_devices to our super number of devices, which doesn't affect anything because we haven't done the remove yet.
2. We are past the device removal part, which is protected by the device_list_mutex. Scan doesn't find the device, it goes down and does the
if (fs_devices->opened)
return -EBUSY;
check and we bail out.
Nothing about this situation is ideal, but the lockdep splat is real, and the fix is safe, tho admittedly a bit scary looking.
--- fs/btrfs/volumes.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/volumes.c +5 -5
@@ -2083,8 +2083,11 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,u64 num_devices;int ret =0 ; -mutex_lock (&uuid_mutex); - +/* +* The device list in fs_devices is accessed without locks (neither +* uuid_mutex nor device_list_mutex) as it won't change on a mounted +* filesystem and another device rm cannot run. +*/ num_devices =btrfs_num_devices (fs_info); ret =btrfs_check_raid_min_devices (fs_info, num_devices -1 );
@@ -2128,11 +2131,9 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,mutex_unlock (&fs_info->chunk_mutex); } -mutex_unlock (&uuid_mutex); ret =btrfs_shrink_device (device,0 );if (!ret)btrfs_reada_remove_dev (device); -mutex_lock (&uuid_mutex);if (ret) goto error_undo;
@@ -2219,7 +2220,6 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path, } out: -mutex_unlock (&uuid_mutex);return ret; error_undo:
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 316/917 erofs: dont trigger WARN() when decompression fails
In reply to Greg Kroah-HartmanFrom: Gao Xiang <[email protected]>
[ Upstream commit a0961f351d82d43ab0b845304caa235dfe249ae9 ]
syzbot reported a WARNING [1] due to corrupted compressed data.
As Dmitry said, "If this is not a kernel bug, then the code should not use WARN. WARN if for kernel bugs and is recognized as such by all testing systems and humans."
[1] https://lore.kernel.org/r/[email protected]
--- fs/erofs/decompressor.c | 1 - 1 file changed, 1 deletion(-)
fs/erofs/decompressor.c +0 -1
@@ -233,7 +233,6 @@ static int z_erofs_lz4_decompress(struct z_erofs_decompress_req *rq, u8 *out)erofs_err (rq->sb,"failed to decompress %d in[%u, %u] out[%u]" , ret, rq->inputsize, inputmargin, rq->outputsize); -WARN_ON (1 );print_hex_dump (KERN_DEBUG ,"[ in]: " ,DUMP_PREFIX_OFFSET ,16 ,1 , src + inputmargin, rq->inputsize, true); print_hex_dump(KERN_DEBUG, "[out]: ", DUMP_PREFIX_OFFSET,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 317/917 parisc/unwind: fix unwinder when CONFIG_64BIT is enabled
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 8e0ba125c2bf1030af3267058019ba86da96863f ]
With 64 bit kernels unwind_special() is not working because it compares the pc to the address of the function descriptor. Add a helper function that compares pc with the dereferenced address. This fixes all of the backtraces on my c8000. Without this changes, a lot of backtraces are missing in kdb or the show-all-tasks command from /proc/sysrq-trigger.
--- arch/parisc/kernel/unwind.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
arch/parisc/kernel/unwind.c +14 -7
@@ -21,6 +21,8 @@#include <asm/ptrace.h> #include <asm/unwind.h> +#include <asm/switch_to.h> +#include <asm/sections.h> /* #define DEBUG 1 */ #ifdef DEBUG
@@ -203,6 +205,11 @@ int __init unwind_init(void)return 0 ; } +static bool pc_is_kernel_fn (unsigned long pc,void *fn) +{ +return (unsigned long )dereference_kernel_function_descriptor (fn) == pc; +} +static int unwind_special (struct unwind_frame_info *info,unsigned long pc,int frame_size) {/*
@@ -221,7 +228,7 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, intextern void *const _call_on_stack;#endif /* CONFIG_IRQSTACKS */ -if (pc == (unsigned long ) &handle_interruption) { +if (pc_is_kernel_fn (pc, handle_interruption)) {struct pt_regs *regs = (struct pt_regs *)(info->sp - frame_size -PT_SZ_ALGN );dbg ("Unwinding through handle_interruption()\n" ); info->prev_sp = regs->gr[30 ];
@@ -229,13 +236,13 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, intreturn 1 ; } -if (pc == (unsigned long ) &ret_from_kernel_thread || - pc == (unsigned long ) &syscall_exit) { +if (pc_is_kernel_fn (pc, ret_from_kernel_thread) || +pc_is_kernel_fn (pc, syscall_exit)) { info->prev_sp = info->prev_ip =0 ;return 1 ; } -if (pc == (unsigned long ) &intr_return) { +if (pc_is_kernel_fn (pc, intr_return)) {struct pt_regs *regs;dbg ("Found intr_return()\n" );
@@ -246,20 +253,20 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, intreturn 1 ; } -if (pc == (unsigned long ) &_switch_to_ret) { +if (pc_is_kernel_fn (pc, _switch_to) || +pc_is_kernel_fn (pc, _switch_to_ret)) { info->prev_sp = info->sp -CALLEE_SAVE_FRAME_SIZE ; info->prev_ip = *(unsigned long *)(info->prev_sp -RP_OFFSET );return 1 ; }#ifdef CONFIG_IRQSTACKS -if (pc == (unsigned long ) &_call_on_stack) { +if (pc_is_kernel_fn (pc, _call_on_stack)) { info->prev_sp = *(unsigned long *)(info->sp -FRAME_SIZE -REG_SZ ); info->prev_ip = *(unsigned long *)(info->sp -FRAME_SIZE -RP_OFFSET );return 1 ; }#endif -return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 321/917 fbdev/efifb: Release PCI devices runtime PM ref during FB destroy
In reply to Greg Kroah-HartmanFrom: Imre Deak <[email protected]>
[ Upstream commit 55285e21f04517939480966164a33898c34b2af2 ]
Atm the EFI FB platform driver gets a runtime PM reference for the associated GFX PCI device during probing the EFI FB platform device and releases it only when the platform device gets unbound.
When fbcon switches to the FB provided by the PCI device's driver (for instance i915/drmfb), the EFI FB will get only unregistered without the EFI FB platform device getting unbound, keeping the runtime PM reference acquired during the platform device probing. This reference will prevent the PCI driver from runtime suspending the device.
Fix this by releasing the RPM reference from the EFI FB's destroy hook, called when the FB gets unregistered.
While at it assert that pm_runtime_get_sync() didn't fail.
v2:
- Move pm_runtime_get_sync() before register_framebuffer() to avoid its race wrt. efifb_destroy()->pm_runtime_put(). (Daniel)
- Assert that pm_runtime_get_sync() didn't fail.
- Clarify commit message wrt. platform/PCI device/driver and driver removal vs. device unbinding.
--- drivers/video/fbdev/efifb.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/video/fbdev/efifb.c +14 -7
@@ -47,6 +47,8 @@ static bool use_bgrt = true;static bool request_mem_succeeded = false;static u64 mem_flags =EFI_MEMORY_WC |EFI_MEMORY_UC ; +static struct pci_dev *efifb_pci_dev;/* dev with BAR covering the efifb */ +static struct fb_var_screeninfo efifb_defined = { .activate =FB_ACTIVATE_NOW , .height =-1 ,
@@ -243,6 +245,9 @@ static inline void efifb_show_boot_graphics(struct fb_info *info) {}static void efifb_destroy (struct fb_info *info) { +if (efifb_pci_dev) +pm_runtime_put (&efifb_pci_dev->dev); +if (info->screen_base) {if (mem_flags & (EFI_MEMORY_UC |EFI_MEMORY_WC ))iounmap (info->screen_base);
@@ -333,7 +338,6 @@ ATTRIBUTE_GROUPS(efifb);static bool pci_dev_disabled;/* FB base matches BAR of a disabled device */ -static struct pci_dev *efifb_pci_dev;/* dev with BAR covering the efifb */ static struct resource *bar_resource;static u64 bar_offset;
@@ -569,17 +573,22 @@ static int efifb_probe(struct platform_device *dev)pr_err ("efifb: cannot allocate colormap\n" ); goto err_groups; } + +if (efifb_pci_dev) +WARN_ON (pm_runtime_get_sync (&efifb_pci_dev->dev) <0 ); + err =register_framebuffer (info);if (err <0 ) {pr_err ("efifb: cannot register framebuffer\n" ); - goto err_fb_dealoc; + goto err_put_rpm_ref; }fb_info (info,"%s frame buffer device\n" , info->fix.id); -if (efifb_pci_dev) -pm_runtime_get_sync (&efifb_pci_dev->dev);return 0 ; -err_fb_dealoc: +err_put_rpm_ref: +if (efifb_pci_dev) +pm_runtime_put (&efifb_pci_dev->dev); +fb_dealloc_cmap (&info->cmap); err_groups:sysfs_remove_groups (&dev->dev.kobj, efifb_groups);
@@ -603,8 +612,6 @@ static int efifb_remove(struct platform_device *pdev)unregister_framebuffer (info);sysfs_remove_groups (&pdev->dev.kobj, efifb_groups);framebuffer_release (info); -if (efifb_pci_dev) -pm_runtime_put (&efifb_pci_dev->dev);return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 332/917 rcu: Fix existing exp request check in sync_sched_exp_online_cleanup()
In reply to Greg Kroah-HartmanFrom: Neeraj Upadhyay <[email protected]>
[ Upstream commit f0b2b2df5423fb369ac762c77900bc7765496d58 ]
The sync_sched_exp_online_cleanup() checks to see if RCU needs an expedited quiescent state from the incoming CPU, sending it an IPI if so. Before sending IPI, it checks whether expedited qs need has been already requested for the incoming CPU, by checking rcu_data.cpu_no_qs.b.exp for the current cpu, on which sync_sched_exp_online_cleanup() is running. This works for the case where incoming CPU is same as self. However, for the case where incoming CPU is different from self, expedited request won't get marked, which can potentially delay reporting of expedited quiescent state for the incoming CPU.
--- kernel/rcu/tree_exp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_exp.h +1 -1
@@ -760,7 +760,7 @@ static void sync_sched_exp_online_cleanup(int cpu) my_cpu =get_cpu ();/* Quiescent state either not needed or already requested, leave. */ if (!(READ_ONCE (rnp->expmask) & rdp->grpmask) || -__this_cpu_read (rcu_data.cpu_no_qs.b.exp)) { + rdp->cpu_no_qs.b.exp) {put_cpu ();return ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 306/917 wcn36xx: Fix packet drop on resume
In reply to Greg Kroah-HartmanFrom: Loic Poulain <[email protected]>
[ Upstream commit df0697801d8aa2eebfe7f0b7388879639f8fe7cc ]
If the system is resumed because of an incoming packet, the wcn36xx RX interrupts is fired before actual resuming of the wireless/mac80211 stack, causing any received packets to be simply dropped. E.g. a ping request causes a system resume, but is dropped and so never forwarded to the IP stack.
This change fixes that, disabling DMA interrupts on suspend to no pass packets until mac80211 is resumed and ready to handle them.
Note that it's not incompatible with RX irq wake.
--- drivers/net/wireless/ath/wcn36xx/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/wireless/ath/wcn36xx/main.c +11 -0
@@ -1115,6 +1115,13 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) goto out; ret =wcn36xx_smd_wlan_host_suspend_ind (wcn); } + +/* Disable IRQ, we don't want to handle any packet before mac80211 is +* resumed and ready to receive packets. +*/ +disable_irq (wcn->tx_irq); +disable_irq (wcn->rx_irq); + out:mutex_unlock (&wcn->conf_mutex);return ret;
@@ -1137,6 +1144,10 @@ static int wcn36xx_resume(struct ieee80211_hw *hw)wcn36xx_smd_ipv6_ns_offload (wcn, vif, false);wcn36xx_smd_arp_offload (wcn, vif, false); } + +enable_irq (wcn->tx_irq); +enable_irq (wcn->rx_irq); +mutex_unlock (&wcn->conf_mutex);return 0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 307/917 Revert "wcn36xx: Enable firmware link monitoring"
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit 43ea9bd84f27d06482cc823d9749cc9dd2993bc8 ]
Firmware link offload monitoring can be made to work in 3/4 cases by switching on firmware feature bit WLANACTIVE_OFFLOAD
- Secure power-save on
- Secure power-save off
- Open power-save on
However, with an open AP if we switch off power-saving - thus never entering Beacon Mode Power Save - BMPS, firmware never forwards loss of beacon upwards.
We had hoped that WLANACTIVE_OFFLOAD and some fixes for sequence numbers would unblock this but, it hasn't and further investigation is required.
Its possible to have a complete set of Secure power-save on/off and Open power-save on/off provided we use Linux' link monitoring mechanism.
While we debug the Open AP failure we need to fix upstream.
This reverts commit c973fdad79f6eaf247d48b5fc77733e989eb01e1.
--- drivers/net/wireless/ath/wcn36xx/main.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/ath/wcn36xx/main.c +0 -1
@@ -1341,7 +1341,6 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)ieee80211_hw_set (wcn->hw,HAS_RATE_CONTROL );ieee80211_hw_set (wcn->hw,SINGLE_SCAN_ON_ALL_BANDS );ieee80211_hw_set (wcn->hw,REPORTS_TX_ACK_STATUS ); -ieee80211_hw_set (wcn->hw,CONNECTION_MONITOR ); wcn->hw->wiphy->interface_modes =BIT (NL80211_IFTYPE_STATION ) | BIT(NL80211_IFTYPE_AP) |
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 318/917 parisc/kgdb: add kgdb_roundup() to make kgdb work with idle polling
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 66e29fcda1824f0427966fbee2bd2c85bf362c82 ]
With idle polling, IPIs are not sent when a CPU idle, but queued and run later from do_idle(). The default kgdb_call_nmi_hook() implementation gets the pointer to struct pt_regs from get_irq_reqs(), which doesn't work in that case because it was not called from the IPI interrupt handler. Fix it by defining our own kgdb_roundup() function which sents an IPI_ENTER_KGDB. When that IPI is received on the target CPU kgdb_nmicallback() is called.
--- arch/parisc/kernel/smp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
arch/parisc/kernel/smp.c +17 -2
@@ -29,6 +29,7 @@#include <linux/bitops.h> #include <linux/ftrace.h> #include <linux/cpu.h> +#include <linux/kgdb.h> #include <linux/atomic.h> #include <asm/current.h>
@@ -69,7 +70,10 @@ enum ipi_message_type {IPI_CALL_FUNC ,IPI_CPU_START ,IPI_CPU_STOP , - IPI_CPU_TEST +IPI_CPU_TEST , +#ifdef CONFIG_KGDB + IPI_ENTER_KGDB, +#endif };
@@ -167,7 +171,12 @@ ipi_interrupt(int irq, void *dev_id)case IPI_CPU_TEST :smp_debug (100 ,KERN_DEBUG "CPU%d is alive!\n" , this_cpu);break ; - +#ifdef CONFIG_KGDB +case IPI_ENTER_KGDB : +smp_debug (100 ,KERN_DEBUG "CPU%d ENTER_KGDB\n" , this_cpu); +kgdb_nmicallback (raw_smp_processor_id (),get_irq_regs ()); +break ; +#endif default :printk (KERN_CRIT "Unknown IPI num on CPU%d: %lu\n" , this_cpu, which);
@@ -226,6 +235,12 @@ send_IPI_allbutself(enum ipi_message_type op) } } +#ifdef CONFIG_KGDB +void kgdb_roundup_cpus (void ) +{ +send_IPI_allbutself (IPI_ENTER_KGDB ); +} +#endif inline void smp_send_stop (void ) {send_IPI_allbutself (IPI_CPU_STOP ); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 322/917 drm/bridge: anx7625: Propagate errors from sp_tx_rst_aux()
In reply to Greg Kroah-HartmanFrom: Robert Foss <[email protected]>
[ Upstream commit 7f16d0f3b8e2d13f940e944cd17044ca8eeb8b32 ]
The return value of sp_tx_rst_aux() is not propagated, which means both compiler warnings and potential errors not being handled.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +8 -4
@@ -720,7 +720,7 @@ static int edid_read(struct anx7625_data *ctx, ret =sp_tx_aux_rd (ctx,0xf1 );if (ret) { -sp_tx_rst_aux (ctx); + ret =sp_tx_rst_aux (ctx);DRM_DEV_DEBUG_DRIVER (dev,"edid read fail, reset!\n" ); }else { ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client,
@@ -735,7 +735,7 @@ static int edid_read(struct anx7625_data *ctx,if (cnt >EDID_TRY_CNT )return -EIO ; -return 0 ; +return ret; } static int segments_edid_read(struct anx7625_data *ctx,
@@ -785,7 +785,7 @@ static int segments_edid_read(struct anx7625_data *ctx,if (cnt >EDID_TRY_CNT )return -EIO ; -return 0 ; +return ret; } static int sp_tx_edid_read(struct anx7625_data *ctx,
@@ -887,7 +887,11 @@ static int sp_tx_edid_read(struct anx7625_data *ctx, }/* Reset aux channel */ -sp_tx_rst_aux (ctx); + ret =sp_tx_rst_aux (ctx); +if (ret <0 ) { +DRM_DEV_ERROR (dev,"Failed to reset aux channel!\n" ); +return ret; + }return (blocks_num +1 ); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 324/917 perf/x86/intel/uncore: Fix Intel SPR IIO event constraints
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
[ Upstream commit 67c5d44384f8dc57e1c1b3040423cfce99b578cd ]
SPR IIO events have the exact same event constraints as ICX, so add the constraints.
--- arch/x86/events/intel/uncore_snbep.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore_snbep.c +1 -0
@@ -5661,6 +5661,7 @@ static struct intel_uncore_type spr_uncore_iio = { .event_mask_ext = SNR_IIO_PMON_RAW_EVENT_MASK_EXT, .format_group = &snr_uncore_iio_format_group, .attr_update = uncore_alias_groups, + .constraints = icx_uncore_iio_constraints, };static struct attribute *spr_uncore_raw_formats_attr[] = {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 325/917 perf/x86/intel/uncore: Fix Intel SPR M2PCIE event constraints
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
[ Upstream commit f01d7d558e1855d4aa8e927b86111846536dd476 ]
Similar to the ICX M2PCIE events, some of the SPR M2PCIE events also have constraints. Add the constraints for SPR M2PCIE.
--- arch/x86/events/intel/uncore_snbep.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/events/intel/uncore_snbep.c +7 -0
@@ -5690,9 +5690,16 @@ static struct intel_uncore_type spr_uncore_irp = { }; +static struct event_constraint spr_uncore_m2pcie_constraints[] = { +UNCORE_EVENT_CONSTRAINT (0x14 ,0x3 ), +UNCORE_EVENT_CONSTRAINT (0x2d ,0x3 ), +EVENT_CONSTRAINT_END +}; +static struct intel_uncore_type spr_uncore_m2pcie = {SPR_UNCORE_COMMON_FORMAT (), .name ="m2pcie" , + .constraints = spr_uncore_m2pcie_constraints, };static struct intel_uncore_type spr_uncore_pcu = {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 326/917 perf/x86/intel/uncore: Fix Intel SPR M3UPI event constraints
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
[ Upstream commit 4034fb207e302cc0b1f304084d379640c1fb1436 ]
SPR M3UPI have the exact same event constraints as ICX, so add the constraints.
--- arch/x86/events/intel/uncore_snbep.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore_snbep.c +1 -0
@@ -5776,6 +5776,7 @@ static struct intel_uncore_type spr_uncore_upi = {static struct intel_uncore_type spr_uncore_m3upi = {SPR_UNCORE_PCI_COMMON_FORMAT (), .name ="m3upi" , + .constraints = icx_uncore_m3upi_constraints, };static struct intel_uncore_type spr_uncore_mdf = {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 327/917 drm/bridge: it66121: Initialize {device,vendor}_ids
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
[ Upstream commit 3a5f3d61de657bc1c2b53b77d065c5526f982e10 ]
These two arrays are populated with data read from the I2C device through regmap_read(), and the data is then compared with hardcoded vendor/product ID values of supported chips.
However, the return value of regmap_read() was never checked. This is fine, as long as the two arrays are zero-initialized, so that we don't compare the vendor/product IDs against whatever garbage is left on the stack.
Address this issue by zero-initializing these two arrays.
--- drivers/gpu/drm/bridge/ite-it66121.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/ite-it66121.c +1 -1
@@ -889,7 +889,7 @@ unlock:static int it66121_probe (struct i2c_client *client,const struct i2c_device_id *id) { -u32 vendor_ids[2 ], device_ids[2 ], revision_id; +u32 revision_id, vendor_ids[2 ] = {0 }, device_ids[2 ] = {0 };struct device_node *ep;int ret;struct it66121_ctx *ctx;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 328/917 drm/bridge: it66121: Wait for next bridge to be probed
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
[ Upstream commit 8b03e3fc79189b17d31a82f5e175698802a11e87 ]
If run before the next bridge is initialized, of_drm_find_bridge() will give us a NULL pointer.
If that's the case, return -EPROBE_DEFER; we may have more luck next time.
--- drivers/gpu/drm/bridge/ite-it66121.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/bridge/ite-it66121.c +3 -0
@@ -924,6 +924,9 @@ static int it66121_probe(struct i2c_client *client, ctx->next_bridge =of_drm_find_bridge (ep);of_node_put (ep); +if (!ctx->next_bridge) +return -EPROBE_DEFER ; +i2c_set_clientdata (client, ctx);mutex_init (&ctx->lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 329/917 Bluetooth: fix init and cleanup of sco_conn.timeout_work
In reply to Greg Kroah-HartmanFrom: Desmond Cheong Zhi Xi <[email protected]>
[ Upstream commit 49d8a5606428ca0962d09050a5af81461ff90fbb ]
Before freeing struct sco_conn, all delayed timeout work should be cancelled. Otherwise, sco_sock_timeout could potentially use the sco_conn after it has been freed.
Additionally, sco_conn.timeout_work should be initialized when the connection is allocated, not when the channel is added. This is because an sco_conn can create channels with multiple sockets over its lifetime, which happens if sockets are released but the connection isn't deleted.
--- net/bluetooth/sco.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
net/bluetooth/sco.c +4 -5
@@ -133,6 +133,7 @@ static struct sco_conn *sco_conn_add(struct hci_conn *hcon)return NULL ;spin_lock_init (&conn->lock); +INIT_DELAYED_WORK (&conn->timeout_work, sco_sock_timeout); hcon->sco_data = conn; conn->hcon = hcon;
@@ -197,11 +198,11 @@ static void sco_conn_del(struct hci_conn *hcon, int err)sco_chan_del (sk, err);release_sock (sk);sock_put (sk); - -/* Ensure no more work items will run before freeing conn. */ -cancel_delayed_work_sync (&conn->timeout_work); } +/* Ensure no more work items will run before freeing conn. */ +cancel_delayed_work_sync (&conn->timeout_work); + hcon->sco_data =NULL ;kfree (conn); }
@@ -214,8 +215,6 @@ static void __sco_chan_add(struct sco_conn *conn, struct sock *sk,sco_pi (sk)->conn = conn; conn->sk = sk; -INIT_DELAYED_WORK (&conn->timeout_work, sco_sock_timeout); -if (parent)bt_accept_enqueue (parent, sk, true); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 330/917 libbpf: Dont crash on object files with no symbol tables
In reply to Greg Kroah-HartmanFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 03e601f48b2da6fb44d0f7b86957a8f6bacfb347 ]
If libbpf encounters an ELF file that has been stripped of its symbol table, it will crash in bpf_object__add_programs() when trying to dereference the obj->efile.symbols pointer.
Fix this by erroring out of bpf_object__elf_collect() if it is not able able to find the symbol table.
v2:
- Move check into bpf_object__elf_collect() and add nice error message
--- tools/lib/bpf/libbpf.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/lib/bpf/libbpf.c +6 -0
@@ -2993,6 +2993,12 @@ static int bpf_object__elf_collect(struct bpf_object *obj) } } +if (!obj->efile.symbols) { +pr_warn ("elf: couldn't find symbol table in %s, stripped object file?\n" , + obj->path); +return -ENOENT ; + } + scn =NULL ;while ((scn =elf_nextscn (elf, scn)) !=NULL ) { idx++;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 331/917 Bluetooth: hci_uart: fix GPF in h5_recv
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 2fc7acb69fa3573d4bf7a90c323296d840daf330 ]
Syzbot hit general protection fault in h5_recv(). The problem was in missing NULL check.
hu->serdev can be NULL and we cannot blindly pass &serdev->dev somewhere, since it can cause GPF.
--- drivers/bluetooth/hci_h5.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/bluetooth/hci_h5.c +5 -3
@@ -587,9 +587,11 @@ static int h5_recv(struct hci_uart *hu, const void *data, int count) count -= processed; } -pm_runtime_get (&hu->serdev->dev); -pm_runtime_mark_last_busy (&hu->serdev->dev); -pm_runtime_put_autosuspend (&hu->serdev->dev); +if (hu->serdev) { +pm_runtime_get (&hu->serdev->dev); +pm_runtime_mark_last_busy (&hu->serdev->dev); +pm_runtime_put_autosuspend (&hu->serdev->dev); + }return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 333/917 MIPS: lantiq: dma: fix burst length for DEU
In reply to Greg Kroah-HartmanFrom: Aleksander Jan Bajkowski <[email protected]>
[ Upstream commit 5ad74d39c51dd41b3c819f4f5396655f0629b4fd ]
The current definition of 2W burst length is invalid. This patch fixes it. Current downstream DEU driver doesn't use DMA. An incorrect burst length value doesn't cause any errors. This patch also adds other burst length values.
--- arch/mips/lantiq/xway/dma.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/mips/lantiq/xway/dma.c +7 -2
@@ -41,7 +41,11 @@#define DMA_IRQ_ACK 0x7e/* IRQ status register */ #define DMA_POLL BIT(31)/* turn on channel polling */ #define DMA_CLK_DIV4 BIT(6)/* polling clock divider */ -#define DMA_2W_BURST BIT(1)/* 2 word burst length */ +#define DMA_PCTRL_2W_BURST 0x1/* 2 word burst length */ +#define DMA_PCTRL_4W_BURST 0x2/* 4 word burst length */ +#define DMA_PCTRL_8W_BURST 0x3/* 8 word burst length */ +#define DMA_TX_BURST_SHIFT 4/* tx burst shift */ +#define DMA_RX_BURST_SHIFT 2/* rx burst shift */ #define DMA_ETOP_ENDIANNESS (0xf << 8)/* endianness swap etop channels */ #define DMA_WEIGHT (BIT(17) | BIT(16))/* default channel wheight */
@@ -192,7 +196,8 @@ ltq_dma_init_port(int p)break ;case DMA_PORT_DEU : -ltq_dma_w32 ((DMA_2W_BURST <<4 ) | (DMA_2W_BURST <<2 ), +ltq_dma_w32 ((DMA_PCTRL_2W_BURST <<DMA_TX_BURST_SHIFT ) | + (DMA_PCTRL_2W_BURST <<DMA_RX_BURST_SHIFT ),LTQ_DMA_PCTRL );break ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 334/917 x86/xen: Mark cpu_bringup_and_idle() as dead_end_function
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 9af9dcf11bda3e2c0e24c1acaacb8685ad974e93 ]
The asm_cpu_bringup_and_idle() function is required to push the return value on the stack in order to make ORC happy, but the only reason objtool doesn't complain is because of a happy accident.
The thing is that asm_cpu_bringup_and_idle() doesn't return, so validate_branch() never terminates and falls through to the next function, which in the normal case is the hypercall_page. And that, as it happens, is 4095 NOPs and a RET.
Make asm_cpu_bringup_and_idle() terminate on it's own, by making the function it calls as a dead-end. This way we no longer rely on what code happens to come after.
--- tools/objtool/check.c | 1 + 1 file changed, 1 insertion(+)
tools/objtool/check.c +1 -0
@@ -173,6 +173,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,"rewind_stack_do_exit" ,"kunit_try_catch_throw" ,"xen_start_kernel" , + "cpu_bringup_and_idle", };if (!func)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 335/917 objtool: Handle __sanitize_cov*() tail calls
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit f56dae88a81fded66adf2bea9922d1d98d1da14f ]
Turns out the compilers also generate tail calls to __sanitize_cov*(), make sure to also patch those out in noinstr code.
--- tools/objtool/arch/x86/decode.c | 20 ++++ tools/objtool/check.c | 158 ++++++++++++++------------- tools/objtool/include/objtool/arch.h | 1 + 3 files changed, 105 insertions(+), 74 deletions(-)
tools/objtool/arch/x86/decode.c +20 -0
@@ -659,6 +659,26 @@ const char *arch_nop_insn(int len)return nops[len-1 ]; } +#define BYTE_RET 0xC3 + +const char *arch_ret_insn (int len) +{ +static const char ret[5 ][5 ] = { + {BYTE_RET }, + {BYTE_RET ,BYTES_NOP1 }, + {BYTE_RET ,BYTES_NOP2 }, + {BYTE_RET ,BYTES_NOP3 }, + {BYTE_RET ,BYTES_NOP4 }, + }; + +if (len <1 || len >5 ) { +WARN ("invalid RET size: %d\n" , len); +return NULL ; + } + +return ret[len-1 ]; +} +/* asm/alternative.h ? */ #define ALTINSTR_FLAG_INV (1 << 15)
tools/objtool/check.c +84 -74
213 lines not on this page · raw message
tools/objtool/include/objtool/arch.h +1 -0
@@ -82,6 +82,7 @@ unsigned long arch_jump_destination(struct instruction *insn);unsigned long arch_dest_reloc_offset (int addend);const char *arch_nop_insn (int len); +const char *arch_ret_insn (int len);int arch_decode_hint_reg (struct instruction *insn,u8 sp_reg);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 336/917 net/mlx5: Publish and unpublish all devlink parameters at once
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit e9310aed8e6a5003abb2aa6b9229d2fb9ceb9e85 ]
The devlink parameters were published in two steps despite being static and known in advance.
First step was to use devlink_params_publish() which iterated over all known up to that point parameters and sent notification messages. In second step, the call was devlink_param_publish() that looped over same parameters list and sent notification for new parameters.
In order to simplify the API, move devlink_params_publish() to be called when all parameters were already added and save the need to iterate over parameters list again.
As a side effect, this change fixes the error unwind flow in which parameters were not marked as unpublished.
--- drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +2 -8
@@ -625,7 +625,6 @@ static int mlx5_devlink_eth_param_register(struct devlink *devlink)devlink_param_driverinit_value_set (devlink,DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH , value); -devlink_param_publish (devlink, &enable_eth_param);return 0 ; }
@@ -636,7 +635,6 @@ static void mlx5_devlink_eth_param_unregister(struct devlink *devlink)if (!mlx5_eth_supported (dev))return ; -devlink_param_unpublish (devlink, &enable_eth_param);devlink_param_unregister (devlink, &enable_eth_param); }
@@ -672,7 +670,6 @@ static int mlx5_devlink_rdma_param_register(struct devlink *devlink)devlink_param_driverinit_value_set (devlink,DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA , value); -devlink_param_publish (devlink, &enable_rdma_param);return 0 ; }
@@ -681,7 +678,6 @@ static void mlx5_devlink_rdma_param_unregister(struct devlink *devlink)if (!IS_ENABLED (CONFIG_MLX5_INFINIBAND ))return ; -devlink_param_unpublish (devlink, &enable_rdma_param);devlink_param_unregister (devlink, &enable_rdma_param); }
@@ -706,7 +702,6 @@ static int mlx5_devlink_vnet_param_register(struct devlink *devlink)devlink_param_driverinit_value_set (devlink,DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET , value); -devlink_param_publish (devlink, &enable_rdma_param);return 0 ; }
@@ -717,7 +712,6 @@ static void mlx5_devlink_vnet_param_unregister(struct devlink *devlink)if (!mlx5_vnet_supported (dev))return ; -devlink_param_unpublish (devlink, &enable_vnet_param);devlink_param_unregister (devlink, &enable_vnet_param); }
@@ -808,7 +802,6 @@ int mlx5_devlink_register(struct devlink *devlink)if (err) goto params_reg_err;mlx5_devlink_set_params_init_values (devlink); -devlink_params_publish (devlink); err =mlx5_devlink_auxdev_params_register (devlink);if (err)
@@ -818,6 +811,7 @@ int mlx5_devlink_register(struct devlink *devlink)if (err) goto traps_reg_err; +devlink_params_publish (devlink);return 0 ; traps_reg_err:
@@ -832,9 +826,9 @@ params_reg_err:void mlx5_devlink_unregister (struct devlink *devlink) { +devlink_params_unpublish (devlink);mlx5_devlink_traps_unregister (devlink);mlx5_devlink_auxdev_params_unregister (devlink); -devlink_params_unpublish (devlink);devlink_params_unregister (devlink, mlx5_devlink_params,ARRAY_SIZE (mlx5_devlink_params));devlink_unregister (devlink);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 337/917 drm/v3d: fix wait for TMU write combiner flush
In reply to Greg Kroah-HartmanFrom: Iago Toral Quiroga <[email protected]>
[ Upstream commit e4f868191138975f2fdf2f37c11318b47db4acc9 ]
The hardware sets the TMUWCF bit back to 0 when the TMU write combiner flush completes so we should be checking for that instead of the L2TFLS bit.
v2 (Melissa Wen):
- Add Signed-off-by and Fixes tags.
- Change the error message for the timeout to be more clear.
Fixes spurious Vulkan CTS failures in:
dEQP-VK.binding_model.descriptorset_random.*
--- drivers/gpu/drm/v3d/v3d_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/v3d/v3d_gem.c +2 -2
@@ -197,8 +197,8 @@ v3d_clean_caches(struct v3d_dev *v3d)V3D_CORE_WRITE (core,V3D_CTL_L2TCACTL ,V3D_L2TCACTL_TMUWCF );if (wait_for (!(V3D_CORE_READ (core,V3D_CTL_L2TCACTL ) & -V3D_L2TCACTL_L2TFLS ),100 )) { -DRM_ERROR ("Timeout waiting for L1T write combiner flush\n" ); +V3D_L2TCACTL_TMUWCF ),100 )) { +DRM_ERROR ("Timeout waiting for TMU write combiner flush\n" ); }mutex_lock (&v3d->cache_clean_lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 319/917 netfilter: conntrack: set on IPS_ASSURED if flows enters internal stream state
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit b7b1d02fc43925a4d569ec221715db2dfa1ce4f5 ]
The internal stream state sets the timeout to 120 seconds 2 seconds after the creation of the flow, attach this internal stream state to the IPS_ASSURED flag for consistent event reporting.
Before this patch:
[NEW] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 [UNREPLIED] src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED] [DESTROY] udp 17 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED]
Note IPS_ASSURED for the flow not yet in the internal stream state.
after this update:
[NEW] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 [UNREPLIED] src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 120 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED] [DESTROY] udp 17 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED]
Before this patch, short-lived UDP flows never entered IPS_ASSURED, so they were already candidate flow to be deleted by early_drop under stress.
Before this patch, IPS_ASSURED is set on regardless the internal stream state, attach this internal stream state to IPS_ASSURED.
packet #1 (original direction) enters NEW state
packet #2 (reply direction) enters ESTABLISHED state, sets on IPS_SEEN_REPLY paclet #3 (any direction) sets on IPS_ASSURED (if 2 seconds since the
creation has passed by).
--- net/netfilter/nf_conntrack_proto_udp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_proto_udp.c +5 -2
@@ -104,10 +104,13 @@ int nf_conntrack_udp_packet(struct nf_conn *ct,*/ if (test_bit (IPS_SEEN_REPLY_BIT , &ct->status)) {unsigned long extra = timeouts[UDP_CT_UNREPLIED ]; +bool stream = false;/* Still active after two seconds? Extend timeout. */ -if (time_after (jiffies, ct->proto.udp.stream_ts)) +if (time_after (jiffies, ct->proto.udp.stream_ts)) { extra = timeouts[UDP_CT_REPLIED ]; + stream = true; + }nf_ct_refresh_acct (ct, ctinfo, skb, extra);
@@ -116,7 +119,7 @@ int nf_conntrack_udp_packet(struct nf_conn *ct,return NF_ACCEPT ;/* Also, more likely to be important, and not a probe */ -if (!test_and_set_bit (IPS_ASSURED_BIT , &ct->status)) +if (stream && !test_and_set_bit (IPS_ASSURED_BIT , &ct->status))nf_conntrack_event_cache (IPCT_ASSURED , ct); }else {nf_ct_refresh_acct (ct, ctinfo, skb, timeouts[UDP_CT_UNREPLIED ]);
Signature · 1 line
2.33.0