···175175case the Linux IRQ numbers cannot be dynamically assigned and the legacy176176mapping should be used.177177178178-As the name implies, the *_legacy() functions are deprecated and only178178+As the name implies, the \*_legacy() functions are deprecated and only179179exist to ease the support of ancient platforms. No new users should be180180-added.180180+added. Same goes for the \*_simple() functions when their use results181181+in the legacy behaviour.181182182183The legacy map assumes a contiguous range of IRQ numbers has already183184been allocated for the controller and that the IRQ number can be
···851851- 0x88A8 traffic will not be received unless VLAN stripping is disabled with852852 the following command::853853854854- # ethool -K <ethX> rxvlan off854854+ # ethtool -K <ethX> rxvlan off855855856856- 0x88A8/0x8100 double VLANs cannot be used with 0x8100 or 0x8100/0x8100 VLANS857857 configured on the same port. 0x88a8/0x8100 traffic will not be received if
+13-22
MAINTAINERS
···977977S: Maintained978978F: drivers/platform/x86/amd-pmc.*979979980980-AMD POWERPLAY980980+AMD POWERPLAY AND SWSMU981981M: Evan Quan <evan.quan@amd.com>982982L: amd-gfx@lists.freedesktop.org983983S: Supported984984T: git https://gitlab.freedesktop.org/agd5f/linux.git985985-F: drivers/gpu/drm/amd/pm/powerplay/985985+F: drivers/gpu/drm/amd/pm/986986987987AMD PTDMA DRIVER988988M: Sanjay R Mehta <sanju.mehta@amd.com>···28042804F: arch/arm/mach-pxa/vpac270.c2805280528062806ARM/VT8500 ARM ARCHITECTURE28072807-M: Tony Prisk <linux@prisktech.co.nz>28082807L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)28092809-S: Maintained28082808+S: Orphan28102809F: Documentation/devicetree/bindings/i2c/i2c-wmt.txt28112810F: arch/arm/mach-vt8500/28122811F: drivers/clocksource/timer-vt8500.c···1325413255F: drivers/scsi/nsp32*13255132561325613257NIOS2 ARCHITECTURE1325713257-M: Ley Foon Tan <ley.foon.tan@intel.com>1325813258+M: Dinh Nguyen <dinguyen@kernel.org>1325813259S: Maintained1325913259-T: git git://git.kernel.org/pub/scm/linux/kernel/git/lftan/nios2.git1326013260+T: git git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux.git1326013261F: arch/nios2/13261132621326213263NITRO ENCLAVES (NE)···1665016651S: Supported1665116652F: drivers/char/pcmcia/scr24x_cs.c16652166531665316653-SCSI CDROM DRIVER1665416654-M: Jens Axboe <axboe@kernel.dk>1665516655-L: linux-scsi@vger.kernel.org1665616656-S: Maintained1665716657-W: http://www.kernel.dk1665816658-F: drivers/scsi/sr*1665916659-1666016654SCSI RDMA PROTOCOL (SRP) INITIATOR1666116655M: Bart Van Assche <bvanassche@acm.org>1666216656L: linux-rdma@vger.kernel.org···16948169561694916957SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS1695016958M: Karsten Graul <kgraul@linux.ibm.com>1695116951-M: Guvenc Gulce <guvenc@linux.ibm.com>1695216959L: linux-s390@vger.kernel.org1695316960S: Supported1695416961W: http://www.ibm.com/developerworks/linux/linux390/···1796017969F: arch/x86/boot/video*17961179701796217971SWIOTLB SUBSYSTEM1796317963-M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>1797217972+M: Christoph Hellwig <hch@infradead.org>1796417973L: iommu@lists.linux-foundation.org1796517974S: Supported1796617966-T: git git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb.git1797517975+W: http://git.infradead.org/users/hch/dma-mapping.git1797617976+T: git git://git.infradead.org/users/hch/dma-mapping.git1796717977F: arch/*/kernel/pci-swiotlb.c1796817978F: include/linux/swiotlb.h1796917979F: kernel/dma/swiotlb.c···1928119289F: drivers/usb/misc/chaoskey.c19282192901928319291USB CYPRESS C67X00 DRIVER1928419284-M: Peter Korsgaard <jacmet@sunsite.dk>1928519292L: linux-usb@vger.kernel.org1928619286-S: Maintained1929319293+S: Orphan1928719294F: drivers/usb/c67x00/19288192951928919296USB DAVICOM DM9601 DRIVER1929019290-M: Peter Korsgaard <jacmet@sunsite.dk>1929719297+M: Peter Korsgaard <peter@korsgaard.com>1929119298L: netdev@vger.kernel.org1929219299S: Maintained1929319300W: http://www.linux-usb.org/usbnet···2046620475F: tools/lib/bpf/xsk*20467204762046820477XEN BLOCK SUBSYSTEM2046920469-M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>2047020478M: Roger Pau Monné <roger.pau@citrix.com>2047120479L: xen-devel@lists.xenproject.org (moderated for non-subscribers)2047220480S: Supported···2051320523F: drivers/net/xen-netback/*20514205242051520525XEN PCI SUBSYSTEM2051620516-M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>2052620526+M: Juergen Gross <jgross@suse.com>2051720527L: xen-devel@lists.xenproject.org (moderated for non-subscribers)2051820528S: Supported2051920529F: arch/x86/pci/*xen*···2053620546F: sound/xen/*20537205472053820548XEN SWIOTLB SUBSYSTEM2053920539-M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>2054920549+M: Juergen Gross <jgross@suse.com>2055020550+M: Stefano Stabellini <sstabellini@kernel.org>2054020551L: xen-devel@lists.xenproject.org (moderated for non-subscribers)2054120552L: iommu@lists.linux-foundation.org2054220553S: Supported
···525525#define EXPORT_SYMBOL_NOKASAN(name) EXPORT_SYMBOL(name)526526#endif527527528528+#ifdef CONFIG_KASAN_HW_TAGS529529+#define EXPORT_SYMBOL_NOHWKASAN(name)530530+#else531531+#define EXPORT_SYMBOL_NOHWKASAN(name) EXPORT_SYMBOL_NOKASAN(name)532532+#endif528533 /*529534 * Emit a 64-bit absolute little endian symbol reference in a way that530535 * ensures that it will be resolved at build time, even when building a
+6
arch/arm64/include/asm/mte.h
···9999100100static inline void mte_check_tfsr_entry(void)101101{102102+ if (!system_supports_mte())103103+ return;104104+102105 mte_check_tfsr_el1();103106}104107105108static inline void mte_check_tfsr_exit(void)106109{110110+ if (!system_supports_mte())111111+ return;112112+107113 /*108114 * The asynchronous faults are sync'ed automatically with109115 * TFSR_EL1 on kernel entry but for exit an explicit dsb()
···273273 return __pgprot(PROT_DEVICE_nGnRnE);274274}275275276276-static void __iomem *__acpi_os_ioremap(acpi_physical_address phys,277277- acpi_size size, bool memory)276276+void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)278277{279278 efi_memory_desc_t *md, *region = NULL;280279 pgprot_t prot;···299300 * It is fine for AML to remap regions that are not represented in the300301 * EFI memory map at all, as it only describes normal memory, and MMIO301302 * regions that require a virtual mapping to make them accessible to302302- * the EFI runtime services. Determine the region default303303- * attributes by checking the requested memory semantics.303303+ * the EFI runtime services.304304 */305305- prot = memory ? __pgprot(PROT_NORMAL_NC) :306306- __pgprot(PROT_DEVICE_nGnRnE);305305+ prot = __pgprot(PROT_DEVICE_nGnRnE);307306 if (region) {308307 switch (region->type) {309308 case EFI_LOADER_CODE:···359362 }360363 }361364 return __ioremap(phys, size, prot);362362-}363363-364364-void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)365365-{366366- return __acpi_os_ioremap(phys, size, false);367367-}368368-369369-void __iomem *acpi_os_memmap(acpi_physical_address phys, acpi_size size)370370-{371371- return __acpi_os_ioremap(phys, size, true);372365}373366374367/*
+6-2
arch/arm64/kernel/cpufeature.c
···15261526 /*15271527 * For reasons that aren't entirely clear, enabling KPTI on Cavium15281528 * ThunderX leads to apparent I-cache corruption of kernel text, which15291529- * ends as well as you might imagine. Don't even try.15291529+ * ends as well as you might imagine. Don't even try. We cannot rely15301530+ * on the cpus_have_*cap() helpers here to detect the CPU erratum15311531+ * because cpucap detection order may change. However, since we know15321532+ * affected CPUs are always in a homogeneous configuration, it is15331533+ * safe to rely on this_cpu_has_cap() here.15301534 */15311531- if (cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_27456)) {15351535+ if (this_cpu_has_cap(ARM64_WORKAROUND_CAVIUM_27456)) {15321536 str = "ARM64_WORKAROUND_CAVIUM_27456";15331537 __kpti_forced = -1;15341538 }
+4-6
arch/arm64/kernel/mte.c
···142142#ifdef CONFIG_KASAN_HW_TAGS143143void mte_check_tfsr_el1(void)144144{145145- u64 tfsr_el1;146146-147147- if (!system_supports_mte())148148- return;149149-150150- tfsr_el1 = read_sysreg_s(SYS_TFSR_EL1);145145+ u64 tfsr_el1 = read_sysreg_s(SYS_TFSR_EL1);151146152147 if (unlikely(tfsr_el1 & SYS_TFSR_EL1_TF1)) {153148 /*···194199195200void mte_thread_switch(struct task_struct *next)196201{202202+ if (!system_supports_mte())203203+ return;204204+197205 mte_update_sctlr_user(next);198206199207 /*
+1-3
arch/arm64/kernel/signal.c
···940940 if (thread_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL))941941 do_signal(regs);942942943943- if (thread_flags & _TIF_NOTIFY_RESUME) {943943+ if (thread_flags & _TIF_NOTIFY_RESUME)944944 tracehook_notify_resume(regs);945945- rseq_handle_notify_resume(NULL, regs);946946- }947945948946 if (thread_flags & _TIF_FOREIGN_FPSTATE)949947 fpsimd_restore_current_state();
···34343535static inline pmd_t *pud_pgtable(pud_t pud)3636{3737- return (pmd_t *)pud_val(pud);3737+ return (pmd_t *)(unsigned long)pud_val(pud);3838}39394040/* only used by the stubbed out hugetlb gup code, should never be called */
+2
arch/sparc/lib/iomap.c
···1919EXPORT_SYMBOL(ioport_map);2020EXPORT_SYMBOL(ioport_unmap);21212222+#ifdef CONFIG_PCI2223void pci_iounmap(struct pci_dev *dev, void __iomem * addr)2324{2425 /* nothing to do */2526}2627EXPORT_SYMBOL(pci_iounmap);2828+#endif
···22#ifndef _ASM_X86_PKEYS_H33#define _ASM_X86_PKEYS_H4455-#define ARCH_DEFAULT_PKEY 066-75/*86 * If more than 16 keys are ever supported, a thorough audit97 * will be necessary to ensure that the types that store key
···33#define _ASM_X86_SWIOTLB_XEN_H4455#ifdef CONFIG_SWIOTLB_XEN66-extern int xen_swiotlb;76extern int __init pci_xen_swiotlb_detect(void);88-extern void __init pci_xen_swiotlb_init(void);97extern int pci_xen_swiotlb_init_late(void);108#else1111-#define xen_swiotlb (0)1212-static inline int __init pci_xen_swiotlb_detect(void) { return 0; }1313-static inline void __init pci_xen_swiotlb_init(void) { }99+#define pci_xen_swiotlb_detect NULL1410static inline int pci_xen_swiotlb_init_late(void) { return -ENXIO; }1511#endif1612
+14-12
arch/x86/kernel/setup.c
···830830831831 x86_init.oem.arch_setup();832832833833+ /*834834+ * Do some memory reservations *before* memory is added to memblock, so835835+ * memblock allocations won't overwrite it.836836+ *837837+ * After this point, everything still needed from the boot loader or838838+ * firmware or kernel text should be early reserved or marked not RAM in839839+ * e820. All other memory is free game.840840+ *841841+ * This call needs to happen before e820__memory_setup() which calls the842842+ * xen_memory_setup() on Xen dom0 which relies on the fact that those843843+ * early reservations have happened already.844844+ */845845+ early_reserve_memory();846846+833847 iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1;834848 e820__memory_setup();835849 parse_setup_data();···889875 x86_configure_nx();890876891877 parse_early_param();892892-893893- /*894894- * Do some memory reservations *before* memory is added to895895- * memblock, so memblock allocations won't overwrite it.896896- * Do it after early param, so we could get (unlikely) panic from897897- * serial.898898- *899899- * After this point everything still needed from the boot loader or900900- * firmware or kernel text should be early reserved or marked not901901- * RAM in e820. All other memory is free game.902902- */903903- early_reserve_memory();904878905879#ifdef CONFIG_MEMORY_HOTPLUG906880 /*
+2-2
arch/x86/lib/insn.c
···3737 ((insn)->next_byte + sizeof(t) + n <= (insn)->end_kaddr)38383939#define __get_next(t, insn) \4040- ({ t r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); leXX_to_cpu(t, r); })4040+ ({ t r; memcpy(&r, insn->next_byte, sizeof(t)); insn->next_byte += sizeof(t); leXX_to_cpu(t, r); })41414242#define __peek_nbyte_next(t, insn, n) \4343- ({ t r = *(t*)((insn)->next_byte + n); leXX_to_cpu(t, r); })4343+ ({ t r; memcpy(&r, (insn)->next_byte + n, sizeof(t)); leXX_to_cpu(t, r); })44444545#define get_next(t, insn) \4646 ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
+18-8
arch/x86/mm/fault.c
···710710711711static noinline void712712kernelmode_fixup_or_oops(struct pt_regs *regs, unsigned long error_code,713713- unsigned long address, int signal, int si_code)713713+ unsigned long address, int signal, int si_code,714714+ u32 pkey)714715{715716 WARN_ON_ONCE(user_mode(regs));716717···736735737736 set_signal_archinfo(address, error_code);738737739739- /* XXX: hwpoison faults will set the wrong code. */740740- force_sig_fault(signal, si_code, (void __user *)address);738738+ if (si_code == SEGV_PKUERR) {739739+ force_sig_pkuerr((void __user *)address, pkey);740740+ } else {741741+ /* XXX: hwpoison faults will set the wrong code. */742742+ force_sig_fault(signal, si_code, (void __user *)address);743743+ }741744 }742745743746 /*···803798 struct task_struct *tsk = current;804799805800 if (!user_mode(regs)) {806806- kernelmode_fixup_or_oops(regs, error_code, address, pkey, si_code);801801+ kernelmode_fixup_or_oops(regs, error_code, address,802802+ SIGSEGV, si_code, pkey);807803 return;808804 }809805···936930{937931 /* Kernel mode? Handle exceptions or die: */938932 if (!user_mode(regs)) {939939- kernelmode_fixup_or_oops(regs, error_code, address, SIGBUS, BUS_ADRERR);933933+ kernelmode_fixup_or_oops(regs, error_code, address,934934+ SIGBUS, BUS_ADRERR, ARCH_DEFAULT_PKEY);940935 return;941936 }942937···14031396 */14041397 if (!user_mode(regs))14051398 kernelmode_fixup_or_oops(regs, error_code, address,14061406- SIGBUS, BUS_ADRERR);13991399+ SIGBUS, BUS_ADRERR,14001400+ ARCH_DEFAULT_PKEY);14071401 return;14081402 }14091403···14241416 return;1425141714261418 if (fatal_signal_pending(current) && !user_mode(regs)) {14271427- kernelmode_fixup_or_oops(regs, error_code, address, 0, 0);14191419+ kernelmode_fixup_or_oops(regs, error_code, address,14201420+ 0, 0, ARCH_DEFAULT_PKEY);14281421 return;14291422 }14301423···14331424 /* Kernel mode? Handle exceptions or die: */14341425 if (!user_mode(regs)) {14351426 kernelmode_fixup_or_oops(regs, error_code, address,14361436- SIGSEGV, SEGV_MAPERR);14271427+ SIGSEGV, SEGV_MAPERR,14281428+ ARCH_DEFAULT_PKEY);14371429 return;14381430 }14391431
+9-6
arch/x86/xen/enlighten_pv.c
···755755 preempt_enable();756756}757757758758-static void xen_convert_trap_info(const struct desc_ptr *desc,759759- struct trap_info *traps)758758+static unsigned xen_convert_trap_info(const struct desc_ptr *desc,759759+ struct trap_info *traps, bool full)760760{761761 unsigned in, out, count;762762···766766 for (in = out = 0; in < count; in++) {767767 gate_desc *entry = (gate_desc *)(desc->address) + in;768768769769- if (cvt_gate_to_trap(in, entry, &traps[out]))769769+ if (cvt_gate_to_trap(in, entry, &traps[out]) || full)770770 out++;771771 }772772- traps[out].address = 0;772772+773773+ return out;773774}774775775776void xen_copy_trap_info(struct trap_info *traps)776777{777778 const struct desc_ptr *desc = this_cpu_ptr(&idt_desc);778779779779- xen_convert_trap_info(desc, traps);780780+ xen_convert_trap_info(desc, traps, true);780781}781782782783/* Load a new IDT into Xen. In principle this can be per-CPU, so we···787786{788787 static DEFINE_SPINLOCK(lock);789788 static struct trap_info traps[257];789789+ unsigned out;790790791791 trace_xen_cpu_load_idt(desc);792792···795793796794 memcpy(this_cpu_ptr(&idt_desc), desc, sizeof(idt_desc));797795798798- xen_convert_trap_info(desc, traps);796796+ out = xen_convert_trap_info(desc, traps, false);797797+ memset(&traps[out], 0, sizeof(traps[0]));799798800799 xen_mc_flush();801800 if (HYPERVISOR_set_trap_table(traps))
+2-2
arch/x86/xen/pci-swiotlb-xen.c
···1818#endif1919#include <linux/export.h>20202121-int xen_swiotlb __read_mostly;2121+static int xen_swiotlb __read_mostly;22222323/*2424 * pci_xen_swiotlb_detect - set xen_swiotlb to 1 if necessary···5656 return xen_swiotlb;5757}58585959-void __init pci_xen_swiotlb_init(void)5959+static void __init pci_xen_swiotlb_init(void)6060{6161 if (xen_swiotlb) {6262 xen_swiotlb_init_early();
-4
arch/x86/xen/smp_pv.c
···290290291291 gdt = get_cpu_gdt_rw(cpu);292292293293- memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));294294-295293 /*296294 * Bring up the CPU in cpu_bringup_and_idle() with the stack297295 * pointing just below where pt_regs would be if it were a normal···305307 ctxt->user_regs.esp = (unsigned long)task_pt_regs(idle);306308307309 xen_copy_trap_info(ctxt->trap_ctxt);308308-309309- ctxt->ldt_ents = 0;310310311311 BUG_ON((unsigned long)gdt & ~PAGE_MASK);312312
+1-1
block/bio.c
···14661466 if (!bio_integrity_endio(bio))14671467 return;1468146814691469- if (bio->bi_bdev)14691469+ if (bio->bi_bdev && bio_flagged(bio, BIO_TRACKED))14701470 rq_qos_done_bio(bio->bi_bdev->bd_disk->queue, bio);1471147114721472 if (bio->bi_bdev && bio_flagged(bio, BIO_TRACE_COMPLETION)) {
···1414#include <linux/task_io_accounting_ops.h>1515#include <linux/falloc.h>1616#include <linux/suspend.h>1717+#include <linux/fs.h>1718#include "blk.h"18191920static struct inode *bdev_file_inode(struct file *file)···554553static long blkdev_fallocate(struct file *file, int mode, loff_t start,555554 loff_t len)556555{557557- struct block_device *bdev = I_BDEV(bdev_file_inode(file));556556+ struct inode *inode = bdev_file_inode(file);557557+ struct block_device *bdev = I_BDEV(inode);558558 loff_t end = start + len - 1;559559 loff_t isize;560560 int error;···582580 if ((start | len) & (bdev_logical_block_size(bdev) - 1))583581 return -EINVAL;584582583583+ filemap_invalidate_lock(inode->i_mapping);584584+585585 /* Invalidate the page cache, including dirty pages. */586586 error = truncate_bdev_range(bdev, file->f_mode, start, end);587587 if (error)588588- return error;588588+ goto fail;589589590590 switch (mode) {591591 case FALLOC_FL_ZERO_RANGE:···604600 GFP_KERNEL, 0);605601 break;606602 default:607607- return -EOPNOTSUPP;603603+ error = -EOPNOTSUPP;608604 }609609- if (error)610610- return error;611605612612- /*613613- * Invalidate the page cache again; if someone wandered in and dirtied614614- * a page, we just discard it - userspace has no way of knowing whether615615- * the write happened before or after discard completing...616616- */617617- return truncate_bdev_range(bdev, file->f_mode, start, end);606606+ fail:607607+ filemap_invalidate_unlock(inode->i_mapping);608608+ return error;618609}619610620611const struct file_operations def_blk_fops = {
+7-16
drivers/acpi/osl.c
···284284#define should_use_kmap(pfn) page_is_ram(pfn)285285#endif286286287287-static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz,288288- bool memory)287287+static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz)289288{290289 unsigned long pfn;291290···294295 return NULL;295296 return (void __iomem __force *)kmap(pfn_to_page(pfn));296297 } else297297- return memory ? acpi_os_memmap(pg_off, pg_sz) :298298- acpi_os_ioremap(pg_off, pg_sz);298298+ return acpi_os_ioremap(pg_off, pg_sz);299299}300300301301static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)···309311}310312311313/**312312- * __acpi_os_map_iomem - Get a virtual address for a given physical address range.314314+ * acpi_os_map_iomem - Get a virtual address for a given physical address range.313315 * @phys: Start of the physical address range to map.314316 * @size: Size of the physical address range to map.315315- * @memory: true if remapping memory, false if IO316317 *317318 * Look up the given physical address range in the list of existing ACPI memory318319 * mappings. If found, get a reference to it and return a pointer to it (its···321324 * During early init (when acpi_permanent_mmap has not been set yet) this322325 * routine simply calls __acpi_map_table() to get the job done.323326 */324324-static void __iomem __ref325325-*__acpi_os_map_iomem(acpi_physical_address phys, acpi_size size, bool memory)327327+void __iomem __ref328328+*acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)326329{327330 struct acpi_ioremap *map;328331 void __iomem *virt;···353356354357 pg_off = round_down(phys, PAGE_SIZE);355358 pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;356356- virt = acpi_map(phys, size, memory);359359+ virt = acpi_map(phys, size);357360 if (!virt) {358361 mutex_unlock(&acpi_ioremap_lock);359362 kfree(map);···372375 mutex_unlock(&acpi_ioremap_lock);373376 return map->virt + (phys - map->phys);374377}375375-376376-void __iomem *__ref377377-acpi_os_map_iomem(acpi_physical_address phys, acpi_size size)378378-{379379- return __acpi_os_map_iomem(phys, size, false);380380-}381378EXPORT_SYMBOL_GPL(acpi_os_map_iomem);382379383380void *__ref acpi_os_map_memory(acpi_physical_address phys, acpi_size size)384381{385385- return (void *)__acpi_os_map_iomem(phys, size, true);382382+ return (void *)acpi_os_map_iomem(phys, size);386383}387384EXPORT_SYMBOL_GPL(acpi_os_map_memory);388385
+46-12
drivers/android/binder.c
···18521852}1853185318541854static void binder_transaction_buffer_release(struct binder_proc *proc,18551855+ struct binder_thread *thread,18551856 struct binder_buffer *buffer,18561857 binder_size_t failed_at,18571858 bool is_failure)···20122011 &proc->alloc, &fd, buffer,20132012 offset, sizeof(fd));20142013 WARN_ON(err);20152015- if (!err)20142014+ if (!err) {20162015 binder_deferred_fd_close(fd);20162016+ /*20172017+ * Need to make sure the thread goes20182018+ * back to userspace to complete the20192019+ * deferred close20202020+ */20212021+ if (thread)20222022+ thread->looper_need_return = true;20232023+ }20172024 }20182025 } break;20192026 default:···30473038 if (reply) {30483039 binder_enqueue_thread_work(thread, tcomplete);30493040 binder_inner_proc_lock(target_proc);30503050- if (target_thread->is_dead || target_proc->is_frozen) {30513051- return_error = target_thread->is_dead ?30523052- BR_DEAD_REPLY : BR_FROZEN_REPLY;30413041+ if (target_thread->is_dead) {30423042+ return_error = BR_DEAD_REPLY;30533043 binder_inner_proc_unlock(target_proc);30543044 goto err_dead_proc_or_thread;30553045 }···31133105err_copy_data_failed:31143106 binder_free_txn_fixups(t);31153107 trace_binder_transaction_failed_buffer_release(t->buffer);31163116- binder_transaction_buffer_release(target_proc, t->buffer,31083108+ binder_transaction_buffer_release(target_proc, NULL, t->buffer,31173109 buffer_offset, true);31183110 if (target_node)31193111 binder_dec_node_tmpref(target_node);···31923184 * Cleanup buffer and free it.31933185 */31943186static void31953195-binder_free_buf(struct binder_proc *proc, struct binder_buffer *buffer)31873187+binder_free_buf(struct binder_proc *proc,31883188+ struct binder_thread *thread,31893189+ struct binder_buffer *buffer)31963190{31973191 binder_inner_proc_lock(proc);31983192 if (buffer->transaction) {···32223212 binder_node_inner_unlock(buf_node);32233213 }32243214 trace_binder_transaction_buffer_release(buffer);32253225- binder_transaction_buffer_release(proc, buffer, 0, false);32153215+ binder_transaction_buffer_release(proc, thread, buffer, 0, false);32263216 binder_alloc_free_buf(&proc->alloc, buffer);32273217}32283218···34243414 proc->pid, thread->pid, (u64)data_ptr,34253415 buffer->debug_id,34263416 buffer->transaction ? "active" : "finished");34273427- binder_free_buf(proc, buffer);34173417+ binder_free_buf(proc, thread, buffer);34283418 break;34293419 }34303420···41174107 buffer->transaction = NULL;41184108 binder_cleanup_transaction(t, "fd fixups failed",41194109 BR_FAILED_REPLY);41204120- binder_free_buf(proc, buffer);41104110+ binder_free_buf(proc, thread, buffer);41214111 binder_debug(BINDER_DEBUG_FAILED_TRANSACTION,41224112 "%d:%d %stransaction %d fd fixups failed %d/%d, line %d\n",41234113 proc->pid, thread->pid,···46584648 return 0;46594649}4660465046514651+static bool binder_txns_pending_ilocked(struct binder_proc *proc)46524652+{46534653+ struct rb_node *n;46544654+ struct binder_thread *thread;46554655+46564656+ if (proc->outstanding_txns > 0)46574657+ return true;46584658+46594659+ for (n = rb_first(&proc->threads); n; n = rb_next(n)) {46604660+ thread = rb_entry(n, struct binder_thread, rb_node);46614661+ if (thread->transaction_stack)46624662+ return true;46634663+ }46644664+ return false;46654665+}46664666+46614667static int binder_ioctl_freeze(struct binder_freeze_info *info,46624668 struct binder_proc *target_proc)46634669{···47054679 (!target_proc->outstanding_txns),47064680 msecs_to_jiffies(info->timeout_ms));4707468147084708- if (!ret && target_proc->outstanding_txns)47094709- ret = -EAGAIN;46824682+ /* Check pending transactions that wait for reply */46834683+ if (ret >= 0) {46844684+ binder_inner_proc_lock(target_proc);46854685+ if (binder_txns_pending_ilocked(target_proc))46864686+ ret = -EAGAIN;46874687+ binder_inner_proc_unlock(target_proc);46884688+ }4710468947114690 if (ret < 0) {47124691 binder_inner_proc_lock(target_proc);···47274696{47284697 struct binder_proc *target_proc;47294698 bool found = false;46994699+ __u32 txns_pending;4730470047314701 info->sync_recv = 0;47324702 info->async_recv = 0;···47374705 if (target_proc->pid == info->pid) {47384706 found = true;47394707 binder_inner_proc_lock(target_proc);47404740- info->sync_recv |= target_proc->sync_recv;47084708+ txns_pending = binder_txns_pending_ilocked(target_proc);47094709+ info->sync_recv |= target_proc->sync_recv |47104710+ (txns_pending << 1);47414711 info->async_recv |= target_proc->async_recv;47424712 binder_inner_proc_unlock(target_proc);47434713 }
+2
drivers/android/binder_internal.h
···378378 * binder transactions379379 * (protected by @inner_lock)380380 * @sync_recv: process received sync transactions since last frozen381381+ * bit 0: received sync transaction after being frozen382382+ * bit 1: new pending sync transaction during freezing381383 * (protected by @inner_lock)382384 * @async_recv: process received async transactions since last frozen383385 * (protected by @inner_lock)
···313313314314 ret = gpio_set_debounce_timeout(desc, agpio->debounce_timeout);315315 if (ret)316316- gpiochip_free_own_desc(desc);316316+ dev_warn(chip->parent,317317+ "Failed to set debounce-timeout for pin 0x%04X, err %d\n",318318+ pin, ret);317319318318- return ret ? ERR_PTR(ret) : desc;320320+ return desc;319321}320322321323static bool acpi_gpio_in_ignore_list(const char *controller_in, int pin_in)
···805805 */806806void intel_dmc_ucode_fini(struct drm_i915_private *dev_priv)807807{808808+ int id;809809+808810 if (!HAS_DMC(dev_priv))809811 return;810812811813 intel_dmc_ucode_suspend(dev_priv);812814 drm_WARN_ON(&dev_priv->drm, dev_priv->dmc.wakeref);813815814814- kfree(dev_priv->dmc.dmc_info[DMC_FW_MAIN].payload);816816+ for (id = 0; id < DMC_FW_MAX; id++)817817+ kfree(dev_priv->dmc.dmc_info[id].payload);815818}
+5-4
drivers/gpu/drm/i915/gem/i915_gem_ttm.c
···356356{357357 struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);358358359359- if (likely(obj)) {360360- /* This releases all gem object bindings to the backend. */359359+ if (likely(obj))361360 i915_ttm_free_cached_io_st(obj);362362- __i915_gem_free_object(obj);363363- }364361}365362366363static struct intel_memory_region *···872875{873876 struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo);874877878878+ /* This releases all gem object bindings to the backend. */879879+ __i915_gem_free_object(obj);880880+875881 i915_gem_object_release_memory_region(obj);876882 mutex_destroy(&obj->ttm.get_io_page.lock);883883+877884 if (obj->ttm.created)878885 call_rcu(&obj->rcu, __i915_gem_free_object_rcu);879886}
···4501450145024502 if (err) {45034503 if (i > 0)45044504- its_vpe_irq_domain_free(domain, virq, i - 1);45044504+ its_vpe_irq_domain_free(domain, virq, i);4505450545064506 its_lpi_free(bitmap, base, nr_ids);45074507 its_free_prop_table(vprop_page);
+51-1
drivers/irqchip/irq-gic.c
···107107108108#endif109109110110+static DEFINE_STATIC_KEY_FALSE(needs_rmw_access);111111+110112/*111113 * The GIC mapping of CPU interfaces does not necessarily match112114 * the logical CPU numbering. Let's use a mapping as returned···776774#endif777775778776#ifdef CONFIG_SMP777777+static void rmw_writeb(u8 bval, void __iomem *addr)778778+{779779+ static DEFINE_RAW_SPINLOCK(rmw_lock);780780+ unsigned long offset = (unsigned long)addr & 3UL;781781+ unsigned long shift = offset * 8;782782+ unsigned long flags;783783+ u32 val;784784+785785+ raw_spin_lock_irqsave(&rmw_lock, flags);786786+787787+ addr -= offset;788788+ val = readl_relaxed(addr);789789+ val &= ~GENMASK(shift + 7, shift);790790+ val |= bval << shift;791791+ writel_relaxed(val, addr);792792+793793+ raw_spin_unlock_irqrestore(&rmw_lock, flags);794794+}795795+779796static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,780797 bool force)781798{···809788 if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids)810789 return -EINVAL;811790812812- writeb_relaxed(gic_cpu_map[cpu], reg);791791+ if (static_branch_unlikely(&needs_rmw_access))792792+ rmw_writeb(gic_cpu_map[cpu], reg);793793+ else794794+ writeb_relaxed(gic_cpu_map[cpu], reg);813795 irq_data_update_effective_affinity(d, cpumask_of(cpu));814796815797 return IRQ_SET_MASK_OK_DONE;···13991375 return true;14001376}1401137713781378+static bool gic_enable_rmw_access(void *data)13791379+{13801380+ /*13811381+ * The EMEV2 class of machines has a broken interconnect, and13821382+ * locks up on accesses that are less than 32bit. So far, only13831383+ * the affinity setting requires it.13841384+ */13851385+ if (of_machine_is_compatible("renesas,emev2")) {13861386+ static_branch_enable(&needs_rmw_access);13871387+ return true;13881388+ }13891389+13901390+ return false;13911391+}13921392+13931393+static const struct gic_quirk gic_quirks[] = {13941394+ {13951395+ .desc = "broken byte access",13961396+ .compatible = "arm,pl390",13971397+ .init = gic_enable_rmw_access,13981398+ },13991399+ { },14001400+};14011401+14021402static int gic_of_setup(struct gic_chip_data *gic, struct device_node *node)14031403{14041404 if (!gic || !node)···1438139014391391 if (of_property_read_u32(node, "cpu-offset", &gic->percpu_offset))14401392 gic->percpu_offset = 0;13931393+13941394+ gic_enable_of_quirks(node, gic_quirks, gic);1441139514421396 return 0;14431397
+3-3
drivers/irqchip/irq-mbigen.c
···2525/* The maximum IRQ pin number of mbigen chip(start from 0) */2626#define MAXIMUM_IRQ_PIN_NUM 140727272828-/**2828+/*2929 * In mbigen vector register3030 * bit[21:12]: event id value3131 * bit[11:0]: device id···3939/* offset of vector register in mbigen node */4040#define REG_MBIGEN_VEC_OFFSET 0x20041414242-/**4242+/*4343 * offset of clear register in mbigen node4444 * This register is used to clear the status4545 * of interrupt4646 */4747#define REG_MBIGEN_CLEAR_OFFSET 0xa00048484949-/**4949+/*5050 * offset of interrupt type register5151 * This register is used to configure interrupt5252 * trigger type
···57005700 disk->flags |= GENHD_FL_EXT_DEVT;57015701 disk->events |= DISK_EVENT_MEDIA_CHANGE;57025702 mddev->gendisk = disk;57035703- /* As soon as we call add_disk(), another thread could get57045704- * through to md_open, so make sure it doesn't get too far57055705- */57065706- mutex_lock(&mddev->open_mutex);57075703 add_disk(disk);5708570457095705 error = kobject_add(&mddev->kobj, &disk_to_dev(disk)->kobj, "%s", "md");···57145718 if (mddev->kobj.sd &&57155719 sysfs_create_group(&mddev->kobj, &md_bitmap_group))57165720 pr_debug("pointless warning\n");57175717- mutex_unlock(&mddev->open_mutex);57185721 abort:57195722 mutex_unlock(&disks_mutex);57205723 if (!error && mddev->kobj.sd) {
···405405static void cs_handle_tdr(struct hl_device *hdev, struct hl_cs *cs)406406{407407 bool next_entry_found = false;408408- struct hl_cs *next;408408+ struct hl_cs *next, *first_cs;409409410410 if (!cs_needs_timeout(cs))411411 return;···415415 /* We need to handle tdr only once for the complete staged submission.416416 * Hence, we choose the CS that reaches this function first which is417417 * the CS marked as 'staged_last'.418418+ * In case single staged cs was submitted which has both first and last419419+ * indications, then "cs_find_first" below will return NULL, since we420420+ * removed the cs node from the list before getting here,421421+ * in such cases just continue with the cs to cancel it's TDR work.418422 */419419- if (cs->staged_cs && cs->staged_last)420420- cs = hl_staged_cs_find_first(hdev, cs->staged_sequence);423423+ if (cs->staged_cs && cs->staged_last) {424424+ first_cs = hl_staged_cs_find_first(hdev, cs->staged_sequence);425425+ if (first_cs)426426+ cs = first_cs;427427+ }421428422429 spin_unlock(&hdev->cs_mirror_lock);423430···12951288 if (rc)12961289 goto free_cs_object;1297129012911291+ /* If this is a staged submission we must return the staged sequence12921292+ * rather than the internal CS sequence12931293+ */12941294+ if (cs->staged_cs)12951295+ *cs_seq = cs->staged_sequence;12961296+12981297 /* Validate ALL the CS chunks before submitting the CS */12991298 for (i = 0 ; i < num_chunks ; i++) {13001299 struct hl_cs_chunk *chunk = &cs_chunk_array[i];···20011988 goto free_cs_chunk_array;20021989 }2003199019911991+ if (!hdev->nic_ports_mask) {19921992+ atomic64_inc(&ctx->cs_counters.validation_drop_cnt);19931993+ atomic64_inc(&cntr->validation_drop_cnt);19941994+ dev_err(hdev->dev,19951995+ "Collective operations not supported when NIC ports are disabled");19961996+ rc = -EINVAL;19971997+ goto free_cs_chunk_array;19981998+ }19991999+20042000 collective_engine_id = chunk->collective_engine_id;20052001 }20062002···20482026 spin_unlock(&ctx->sig_mgr.lock);2049202720502028 if (!handle_found) {20512051- dev_err(hdev->dev, "Cannot find encapsulated signals handle for seq 0x%llx\n",20292029+ /* treat as signal CS already finished */20302030+ dev_dbg(hdev->dev, "Cannot find encapsulated signals handle for seq 0x%llx\n",20522031 signal_seq);20532053- rc = -EINVAL;20322032+ rc = 0;20542033 goto free_cs_chunk_array;20552034 }20562035···26362613 * completed after the poll function.26372614 */26382615 if (!mcs_data.completion_bitmap) {26392639- dev_err(hdev->dev, "Multi-CS got completion on wait but no CS completed\n");26162616+ dev_warn_ratelimited(hdev->dev,26172617+ "Multi-CS got completion on wait but no CS completed\n");26402618 rc = -EFAULT;26412619 }26422620 }···27642740 else27652741 interrupt = &hdev->user_interrupt[interrupt_offset];2766274227432743+ /* Add pending user interrupt to relevant list for the interrupt27442744+ * handler to monitor27452745+ */27462746+ spin_lock_irqsave(&interrupt->wait_list_lock, flags);27472747+ list_add_tail(&pend->wait_list_node, &interrupt->wait_list_head);27482748+ spin_unlock_irqrestore(&interrupt->wait_list_lock, flags);27492749+27502750+ /* We check for completion value as interrupt could have been received27512751+ * before we added the node to the wait list27522752+ */27672753 if (copy_from_user(&completion_value, u64_to_user_ptr(user_address), 4)) {27682754 dev_err(hdev->dev, "Failed to copy completion value from user\n");27692755 rc = -EFAULT;27702770- goto free_fence;27562756+ goto remove_pending_user_interrupt;27712757 }2772275827732759 if (completion_value >= target_value)···27862752 *status = CS_WAIT_STATUS_BUSY;2787275327882754 if (!timeout_us || (*status == CS_WAIT_STATUS_COMPLETED))27892789- goto free_fence;27902790-27912791- /* Add pending user interrupt to relevant list for the interrupt27922792- * handler to monitor27932793- */27942794- spin_lock_irqsave(&interrupt->wait_list_lock, flags);27952795- list_add_tail(&pend->wait_list_node, &interrupt->wait_list_head);27962796- spin_unlock_irqrestore(&interrupt->wait_list_lock, flags);27552755+ goto remove_pending_user_interrupt;2797275627982757wait_again:27992758 /* Wait for interrupt handler to signal completion */···27972770 * If comparison fails, keep waiting until timeout expires27982771 */27992772 if (completion_rc > 0) {27732773+ spin_lock_irqsave(&interrupt->wait_list_lock, flags);27742774+ /* reinit_completion must be called before we check for user27752775+ * completion value, otherwise, if interrupt is received after27762776+ * the comparison and before the next wait_for_completion,27772777+ * we will reach timeout and fail27782778+ */27792779+ reinit_completion(&pend->fence.completion);27802780+ spin_unlock_irqrestore(&interrupt->wait_list_lock, flags);27812781+28002782 if (copy_from_user(&completion_value, u64_to_user_ptr(user_address), 4)) {28012783 dev_err(hdev->dev, "Failed to copy completion value from user\n");28022784 rc = -EFAULT;···28162780 if (completion_value >= target_value) {28172781 *status = CS_WAIT_STATUS_COMPLETED;28182782 } else {28192819- spin_lock_irqsave(&interrupt->wait_list_lock, flags);28202820- reinit_completion(&pend->fence.completion);28212783 timeout = completion_rc;28222822-28232823- spin_unlock_irqrestore(&interrupt->wait_list_lock, flags);28242784 goto wait_again;28252785 }28262786 } else if (completion_rc == -ERESTARTSYS) {···28342802 list_del(&pend->wait_list_node);28352803 spin_unlock_irqrestore(&interrupt->wait_list_lock, flags);2836280428372837-free_fence:28382805 kfree(pend);28392806 hl_ctx_put(ctx);28402807
+7-2
drivers/misc/habanalabs/common/hw_queue.c
···437437 struct hl_cs_compl *cs_cmpl)438438{439439 struct hl_cs_encaps_sig_handle *handle = cs->encaps_sig_hdl;440440+ u32 offset = 0;440441441442 cs_cmpl->hw_sob = handle->hw_sob;442443···447446 * set offset 1 for example he mean to wait only for the first448447 * signal only, which will be pre_sob_val, and if he set offset 2449448 * then the value required is (pre_sob_val + 1) and so on...449449+ * if user set wait offset to 0, then treat it as legacy wait cs,450450+ * wait for the next signal.450451 */451451- cs_cmpl->sob_val = handle->pre_sob_val +452452- (job->encaps_sig_wait_offset - 1);452452+ if (job->encaps_sig_wait_offset)453453+ offset = job->encaps_sig_wait_offset - 1;454454+455455+ cs_cmpl->sob_val = handle->pre_sob_val + offset;453456}454457455458static int init_wait_cs(struct hl_device *hdev, struct hl_cs *cs,
···6868 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);6969 unsigned int port, count = 0;70707171- for (port = 0; port < ARRAY_SIZE(priv->port_sts); port++) {7171+ for (port = 0; port < ds->num_ports; port++) {7272 if (dsa_is_cpu_port(ds, port))7373 continue;7474 if (priv->port_sts[port].enabled)···15121512{15131513 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);1514151415151515+ if (!priv)15161516+ return 0;15171517+15151518 priv->wol_ports_mask = 0;15161519 /* Disable interrupts */15171520 bcm_sf2_intr_disable(priv);···15261523 if (priv->type == BCM7278_DEVICE_ID)15271524 reset_control_assert(priv->rcdev);1528152515261526+ platform_set_drvdata(pdev, NULL);15271527+15291528 return 0;15301529}1531153015321531static void bcm_sf2_sw_shutdown(struct platform_device *pdev)15331532{15341533 struct bcm_sf2_priv *priv = platform_get_drvdata(pdev);15341534+15351535+ if (!priv)15361536+ return;1535153715361538 /* For a kernel about to be kexec'd we want to keep the GPHY on for a15371539 * successful MDIO bus scan to occur. If we did turn off the GPHY···15461538 */15471539 if (priv->hw_params.num_gphy == 1)15481540 bcm_sf2_gphy_enable_set(priv->dev->ds, true);15411541+15421542+ dsa_switch_shutdown(priv->dev->ds);15431543+15441544+ platform_set_drvdata(pdev, NULL);15491545}1550154615511547#ifdef CONFIG_PM_SLEEP
···11// SPDX-License-Identifier: GPL-2.022-/* Copyright 2019-2021 NXP Semiconductors22+/* Copyright 2019-2021 NXP33 *44 * This is an umbrella module for all network switches that are55 * register-compatible with Ocelot and that perform I/O to their host CPU
···413413 if (deep) {414414 /* Reinitialize Nic/Vecs objects */415415 aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol);416416-417417- ret = aq_nic_init(nic);418418- if (ret)419419- goto err_exit;420416 }421417422418 if (netif_running(nic->ndev)) {419419+ ret = aq_nic_init(nic);420420+ if (ret)421421+ goto err_exit;422422+423423 ret = aq_nic_start(nic);424424 if (ret)425425 goto err_exit;
+2
drivers/net/ethernet/broadcom/bgmac-bcma.c
···129129 bcma_set_drvdata(core, bgmac);130130131131 err = of_get_mac_address(bgmac->dev->of_node, bgmac->net_dev->dev_addr);132132+ if (err == -EPROBE_DEFER)133133+ return err;132134133135 /* If no MAC address assigned via device tree, check SPROM */134136 if (err) {
+4-4
drivers/net/ethernet/broadcom/bnxt/bnxt.c
···391391 * netif_tx_queue_stopped().392392 */393393 smp_mb();394394- if (bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh) {394394+ if (bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh) {395395 netif_tx_wake_queue(txq);396396 return false;397397 }···764764 smp_mb();765765766766 if (unlikely(netif_tx_queue_stopped(txq)) &&767767- bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh &&767767+ bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh &&768768 READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING)769769 netif_tx_wake_queue(txq);770770}···24162416 if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) {24172417 tx_pkts++;24182418 /* return full budget so NAPI will complete. */24192419- if (unlikely(tx_pkts > bp->tx_wake_thresh)) {24192419+ if (unlikely(tx_pkts >= bp->tx_wake_thresh)) {24202420 rx_pkts = budget;24212421 raw_cons = NEXT_RAW_CMP(raw_cons);24222422 if (budget)···36403640 u16 i;3641364136423642 bp->tx_wake_thresh = max_t(int, bp->tx_ring_size / 2,36433643- MAX_SKB_FRAGS + 1);36433643+ BNXT_MIN_TX_DESC_CNT);3644364436453645 for (i = 0; i < bp->tx_nr_rings; i++) {36463646 struct bnxt_tx_ring_info *txr = &bp->tx_ring[i];
+5
drivers/net/ethernet/broadcom/bnxt/bnxt.h
···629629#define BNXT_MAX_RX_JUM_DESC_CNT (RX_DESC_CNT * MAX_RX_AGG_PAGES - 1)630630#define BNXT_MAX_TX_DESC_CNT (TX_DESC_CNT * MAX_TX_PAGES - 1)631631632632+/* Minimum TX BDs for a TX packet with MAX_SKB_FRAGS + 1. We need one extra633633+ * BD because the first TX BD is always a long BD.634634+ */635635+#define BNXT_MIN_TX_DESC_CNT (MAX_SKB_FRAGS + 2)636636+632637#define RX_RING(x) (((x) & ~(RX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4))633638#define RX_IDX(x) ((x) & (RX_DESC_CNT - 1))634639
+1-1
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
···798798799799 if ((ering->rx_pending > BNXT_MAX_RX_DESC_CNT) ||800800 (ering->tx_pending > BNXT_MAX_TX_DESC_CNT) ||801801- (ering->tx_pending <= MAX_SKB_FRAGS))801801+ (ering->tx_pending < BNXT_MIN_TX_DESC_CNT))802802 return -EINVAL;803803804804 if (netif_running(dev))
+2-5
drivers/net/ethernet/freescale/enetc/enetc.c
···419419420420static void enetc_rx_net_dim(struct enetc_int_vector *v)421421{422422- struct dim_sample dim_sample;422422+ struct dim_sample dim_sample = {};423423424424 v->comp_cnt++;425425···18791879static int enetc_setup_irqs(struct enetc_ndev_priv *priv)18801880{18811881 struct pci_dev *pdev = priv->si->pdev;18821882- cpumask_t cpu_mask;18831882 int i, j, err;1884188318851884 for (i = 0; i < priv->bdr_int_num; i++) {···1907190819081909 enetc_wr(hw, ENETC_SIMSITRV(idx), entry);19091910 }19101910- cpumask_clear(&cpu_mask);19111911- cpumask_set_cpu(i % num_online_cpus(), &cpu_mask);19121912- irq_set_affinity_hint(irq, &cpu_mask);19111911+ irq_set_affinity_hint(irq, get_cpu_mask(i % num_online_cpus()));19131912 }1914191319151914 return 0;
+1-1
drivers/net/ethernet/freescale/enetc/enetc_ierb.c
···11// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)22-/* Copyright 2021 NXP Semiconductors22+/* Copyright 2021 NXP33 *44 * The Integrated Endpoint Register Block (IERB) is configured by pre-boot55 * software and is supposed to be to ENETC what a NVRAM is to a 'real' PCIe
···581581 ret = hclge_cmd_send(&hdev->hw, &desc, 1);582582 if (ret) {583583 dev_err(&hdev->pdev->dev,584584- "vf%u, qs%u failed to set tx_rate:%d, ret=%d\n",584584+ "vport%u, qs%u failed to set tx_rate:%d, ret=%d\n",585585 vport->vport_id, shap_cfg_cmd->qs_id,586586 max_tx_rate, ret);587587 return ret;
···816816 return 0;817817}818818819819+static int hclgevf_parse_rss_hfunc(struct hclgevf_dev *hdev, const u8 hfunc,820820+ u8 *hash_algo)821821+{822822+ switch (hfunc) {823823+ case ETH_RSS_HASH_TOP:824824+ *hash_algo = HCLGEVF_RSS_HASH_ALGO_TOEPLITZ;825825+ return 0;826826+ case ETH_RSS_HASH_XOR:827827+ *hash_algo = HCLGEVF_RSS_HASH_ALGO_SIMPLE;828828+ return 0;829829+ case ETH_RSS_HASH_NO_CHANGE:830830+ *hash_algo = hdev->rss_cfg.hash_algo;831831+ return 0;832832+ default:833833+ return -EINVAL;834834+ }835835+}836836+819837static int hclgevf_set_rss(struct hnae3_handle *handle, const u32 *indir,820838 const u8 *key, const u8 hfunc)821839{822840 struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);823841 struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg;842842+ u8 hash_algo;824843 int ret, i;825844826845 if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) {846846+ ret = hclgevf_parse_rss_hfunc(hdev, hfunc, &hash_algo);847847+ if (ret)848848+ return ret;849849+827850 /* Set the RSS Hash Key if specififed by the user */828851 if (key) {829829- switch (hfunc) {830830- case ETH_RSS_HASH_TOP:831831- rss_cfg->hash_algo =832832- HCLGEVF_RSS_HASH_ALGO_TOEPLITZ;833833- break;834834- case ETH_RSS_HASH_XOR:835835- rss_cfg->hash_algo =836836- HCLGEVF_RSS_HASH_ALGO_SIMPLE;837837- break;838838- case ETH_RSS_HASH_NO_CHANGE:839839- break;840840- default:841841- return -EINVAL;842842- }843843-844844- ret = hclgevf_set_rss_algo_key(hdev, rss_cfg->hash_algo,845845- key);846846- if (ret)852852+ ret = hclgevf_set_rss_algo_key(hdev, hash_algo, key);853853+ if (ret) {854854+ dev_err(&hdev->pdev->dev,855855+ "invalid hfunc type %u\n", hfunc);847856 return ret;857857+ }848858849859 /* Update the shadow RSS key with user specified qids */850860 memcpy(rss_cfg->rss_hash_key, key,851861 HCLGEVF_RSS_KEY_SIZE);862862+ } else {863863+ ret = hclgevf_set_rss_algo_key(hdev, hash_algo,864864+ rss_cfg->rss_hash_key);865865+ if (ret)866866+ return ret;852867 }868868+ rss_cfg->hash_algo = hash_algo;853869 }854870855871 /* update the shadow RSS table with user specified qids */
+1
drivers/net/ethernet/intel/Kconfig
···335335 tristate "Intel(R) Ethernet Controller I225-LM/I225-V support"336336 default n337337 depends on PCI338338+ depends on PTP_1588_CLOCK_OPTIONAL338339 help339340 This driver supports Intel(R) Ethernet Controller I225-LM/I225-V340341 family of adapters.
+3
drivers/net/ethernet/mediatek/mtk_ppe_offload.c
···186186 int hash;187187 int i;188188189189+ if (rhashtable_lookup(ð->flow_table, &f->cookie, mtk_flow_ht_params))190190+ return -EEXIST;191191+189192 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_META)) {190193 struct flow_match_meta match;191194
+32-18
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
···372372 int nhoff = skb_network_offset(skb);373373 int ret = 0;374374375375+ if (skb->encapsulation)376376+ return -EPROTONOSUPPORT;377377+375378 if (skb->protocol != htons(ETH_P_IP))376379 return -EPROTONOSUPPORT;377380···12721269 if (!netif_carrier_ok(dev)) {12731270 if (!mlx4_en_QUERY_PORT(mdev, priv->port)) {12741271 if (priv->port_state.link_state) {12751275- priv->last_link_state = MLX4_DEV_EVENT_PORT_UP;12761272 netif_carrier_on(dev);12771273 en_dbg(LINK, priv, "Link Up\n");12781274 }···15591557 mutex_unlock(&mdev->state_lock);15601558}1561155915621562-static void mlx4_en_linkstate(struct work_struct *work)15601560+static void mlx4_en_linkstate(struct mlx4_en_priv *priv)15611561+{15621562+ struct mlx4_en_port_state *port_state = &priv->port_state;15631563+ struct mlx4_en_dev *mdev = priv->mdev;15641564+ struct net_device *dev = priv->dev;15651565+ bool up;15661566+15671567+ if (mlx4_en_QUERY_PORT(mdev, priv->port))15681568+ port_state->link_state = MLX4_PORT_STATE_DEV_EVENT_PORT_DOWN;15691569+15701570+ up = port_state->link_state == MLX4_PORT_STATE_DEV_EVENT_PORT_UP;15711571+ if (up == netif_carrier_ok(dev))15721572+ netif_carrier_event(dev);15731573+ if (!up) {15741574+ en_info(priv, "Link Down\n");15751575+ netif_carrier_off(dev);15761576+ } else {15771577+ en_info(priv, "Link Up\n");15781578+ netif_carrier_on(dev);15791579+ }15801580+}15811581+15821582+static void mlx4_en_linkstate_work(struct work_struct *work)15631583{15641584 struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,15651585 linkstate_task);15661586 struct mlx4_en_dev *mdev = priv->mdev;15671567- int linkstate = priv->link_state;1568158715691588 mutex_lock(&mdev->state_lock);15701570- /* If observable port state changed set carrier state and15711571- * report to system log */15721572- if (priv->last_link_state != linkstate) {15731573- if (linkstate == MLX4_DEV_EVENT_PORT_DOWN) {15741574- en_info(priv, "Link Down\n");15751575- netif_carrier_off(priv->dev);15761576- } else {15771577- en_info(priv, "Link Up\n");15781578- netif_carrier_on(priv->dev);15791579- }15801580- }15811581- priv->last_link_state = linkstate;15891589+ mlx4_en_linkstate(priv);15821590 mutex_unlock(&mdev->state_lock);15831591}15841592···20912079 mlx4_en_clear_stats(dev);2092208020932081 err = mlx4_en_start_port(dev);20942094- if (err)20822082+ if (err) {20952083 en_err(priv, "Failed starting port:%d\n", priv->port);20962096-20842084+ goto out;20852085+ }20862086+ mlx4_en_linkstate(priv);20972087out:20982088 mutex_unlock(&mdev->state_lock);20992089 return err;···31823168 spin_lock_init(&priv->stats_lock);31833169 INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode);31843170 INIT_WORK(&priv->restart_task, mlx4_en_restart);31853185- INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate);31713171+ INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate_work);31863172 INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats);31873173 INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task);31883174#ifdef CONFIG_RFS_ACCEL
···12971297 prev_weight = weight;1298129812991299 while (weight) {13001300+ /* If the HW device is during recovery, all resources are13011301+ * immediately reset without receiving a per-cid indication13021302+ * from HW. In this case we don't expect the cid_map to be13031303+ * cleared.13041304+ */13051305+ if (p_hwfn->cdev->recov_in_prog)13061306+ return 0;13071307+13001308 msleep(QED_IWARP_MAX_CID_CLEAN_TIME);1301130913021310 weight = bitmap_weight(bmap->bitmap, bmap->max_count);
+8
drivers/net/ethernet/qlogic/qed/qed_roce.c
···7777 * Beyond the added delay we clear the bitmap anyway.7878 */7979 while (bitmap_weight(rcid_map->bitmap, rcid_map->max_count)) {8080+ /* If the HW device is during recovery, all resources are8181+ * immediately reset without receiving a per-cid indication8282+ * from HW. In this case we don't expect the cid bitmap to be8383+ * cleared.8484+ */8585+ if (p_hwfn->cdev->recov_in_prog)8686+ return;8787+8088 msleep(100);8189 if (wait_count++ > 20) {8290 DP_NOTICE(p_hwfn, "cid bitmap wait timed out\n");
···499499 * the header's copy failed, and they are500500 * sharing a slot, send an error501501 */502502- if (i == 0 && sharedslot)502502+ if (i == 0 && !first_shinfo && sharedslot)503503 xenvif_idx_release(queue, pending_idx,504504 XEN_NETIF_RSP_ERROR);505505 else
···24872487 */24882488 if (ctrl->ctrl.queue_count > 1) {24892489 nvme_stop_queues(&ctrl->ctrl);24902490+ nvme_sync_io_queues(&ctrl->ctrl);24902491 blk_mq_tagset_busy_iter(&ctrl->tag_set,24912492 nvme_fc_terminate_exchange, &ctrl->ctrl);24922493 blk_mq_tagset_wait_completed_request(&ctrl->tag_set);···25112510 * clean up the admin queue. Same thing as above.25122511 */25132512 blk_mq_quiesce_queue(ctrl->ctrl.admin_q);25132513+ blk_sync_queue(ctrl->ctrl.admin_q);25142514 blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,25152515 nvme_fc_terminate_exchange, &ctrl->ctrl);25162516 blk_mq_tagset_wait_completed_request(&ctrl->admin_tag_set);···29532951 if (ctrl->ctrl.queue_count == 1)29542952 return 0;2955295329542954+ if (prior_ioq_cnt != nr_io_queues) {29552955+ dev_info(ctrl->ctrl.device,29562956+ "reconnect: revising io queue count from %d to %d\n",29572957+ prior_ioq_cnt, nr_io_queues);29582958+ blk_mq_update_nr_hw_queues(&ctrl->tag_set, nr_io_queues);29592959+ }29602960+29562961 ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1);29572962 if (ret)29582963 goto out_free_io_queues;···29672958 ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1);29682959 if (ret)29692960 goto out_delete_hw_queues;29702970-29712971- if (prior_ioq_cnt != nr_io_queues) {29722972- dev_info(ctrl->ctrl.device,29732973- "reconnect: revising io queue count from %d to %d\n",29742974- prior_ioq_cnt, nr_io_queues);29752975- nvme_wait_freeze(&ctrl->ctrl);29762976- blk_mq_update_nr_hw_queues(&ctrl->tag_set, nr_io_queues);29772977- nvme_unfreeze(&ctrl->ctrl);29782978- }2979296129802962 return 0;29812963
+10-3
drivers/nvme/host/tcp.c
···620620 cpu_to_le32(data->hdr.hlen + hdgst + req->pdu_len + ddgst);621621 data->ttag = pdu->ttag;622622 data->command_id = nvme_cid(rq);623623- data->data_offset = cpu_to_le32(req->data_sent);623623+ data->data_offset = pdu->r2t_offset;624624 data->data_length = cpu_to_le32(req->pdu_len);625625 return 0;626626}···953953 nvme_tcp_ddgst_update(queue->snd_hash, page,954954 offset, ret);955955956956- /* fully successful last write*/956956+ /*957957+ * update the request iterator except for the last payload send958958+ * in the request where we don't want to modify it as we may959959+ * compete with the RX path completing the request.960960+ */961961+ if (req->data_sent + ret < req->data_len)962962+ nvme_tcp_advance_req(req, ret);963963+964964+ /* fully successful last send in current PDU */957965 if (last && ret == len) {958966 if (queue->data_digest) {959967 nvme_tcp_ddgst_final(queue->snd_hash,···973965 }974966 return 1;975967 }976976- nvme_tcp_advance_req(req, ret);977968 }978969 return -EAGAIN;979970}
+1
drivers/nvmem/Kconfig
···109109110110config NVMEM_NINTENDO_OTP111111 tristate "Nintendo Wii and Wii U OTP Support"112112+ depends on WII || COMPILE_TEST112113 help113114 This is a driver exposing the OTP of a Nintendo Wii or Wii U console.114115
+1-1
drivers/pci/Kconfig
···110110111111config XEN_PCIDEV_FRONTEND112112 tristate "Xen PCI Frontend"113113- depends on X86 && XEN113113+ depends on XEN_PV114114 select PCI_XEN115115 select XEN_XENBUS_FRONTEND116116 default y
···166166167167config DELL_WMI_PRIVACY168168 bool "Dell WMI Hardware Privacy Support"169169- depends on DELL_WMI170170- depends on LEDS_TRIGGER_AUDIO169169+ depends on LEDS_TRIGGER_AUDIO = y || DELL_WMI = LEDS_TRIGGER_AUDIO171170 help172171 This option adds integration with the "Dell Hardware Privacy"173172 feature of Dell laptops to the dell-wmi driver.
+1
drivers/platform/x86/gigabyte-wmi.c
···144144 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE"),145145 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE V2"),146146 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 GAMING X V2"),147147+ DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550I AORUS PRO AX"),147148 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550M AORUS PRO-P"),148149 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550M DS3H"),149150 DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("Z390 I AORUS PRO WIFI-CF"),
+22-5
drivers/platform/x86/intel/hid.c
···118118 { }119119};120120121121+/*122122+ * Some devices, even non convertible ones, can send incorrect SW_TABLET_MODE123123+ * reports. Accept such reports only from devices in this list.124124+ */125125+static const struct dmi_system_id dmi_auto_add_switch[] = {126126+ {127127+ .matches = {128128+ DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "31" /* Convertible */),129129+ },130130+ },131131+ {132132+ .matches = {133133+ DMI_EXACT_MATCH(DMI_CHASSIS_TYPE, "32" /* Detachable */),134134+ },135135+ },136136+ {} /* Array terminator */137137+};138138+121139struct intel_hid_priv {122140 struct input_dev *input_dev;123141 struct input_dev *array;124142 struct input_dev *switches;125143 bool wakeup_mode;126126- bool dual_accel;144144+ bool auto_add_switch;127145};128146129147#define HID_EVENT_FILTER_UUID "eeec56b3-4442-408f-a792-4edd4d758054"···470452 * Some convertible have unreliable VGBS return which could cause incorrect471453 * SW_TABLET_MODE report, in these cases we enable support when receiving472454 * the first event instead of during driver setup.473473- *474474- * See dual_accel_detect.h for more info on the dual_accel check.475455 */476476- if (!priv->switches && !priv->dual_accel && (event == 0xcc || event == 0xcd)) {456456+ if (!priv->switches && priv->auto_add_switch && (event == 0xcc || event == 0xcd)) {477457 dev_info(&device->dev, "switch event received, enable switches supports\n");478458 err = intel_hid_switches_setup(device);479459 if (err)···612596 return -ENOMEM;613597 dev_set_drvdata(&device->dev, priv);614598615615- priv->dual_accel = dual_accel_detect();599599+ /* See dual_accel_detect.h for more info on the dual_accel check. */600600+ priv->auto_add_switch = dmi_check_system(dmi_auto_add_switch) && !dual_accel_detect();616601617602 err = intel_hid_input_setup(device);618603 if (err) {
+1-2
drivers/platform/x86/intel/punit_ipc.c
···88 * which provide mailbox interface for power management usage.99 */10101111-#include <linux/acpi.h>1211#include <linux/bitops.h>1312#include <linux/delay.h>1413#include <linux/device.h>···318319 .remove = intel_punit_ipc_remove,319320 .driver = {320321 .name = "intel_punit_ipc",321321- .acpi_match_table = ACPI_PTR(punit_ipc_acpi_ids),322322+ .acpi_match_table = punit_ipc_acpi_ids,322323 },323324};324325
+1-1
drivers/platform/x86/lg-laptop.c
···655655 goto out_platform_registered;656656 }657657 product = dmi_get_system_info(DMI_PRODUCT_NAME);658658- if (strlen(product) > 4)658658+ if (product && strlen(product) > 4)659659 switch (product[4]) {660660 case '5':661661 case '6':
···174174 depends on I2C && MTD175175 depends on SERIAL_8250176176 depends on !S390177177+ depends on COMMON_CLK177178 select NET_DEVLINK178179 help179180 This driver adds support for an OpenCompute time card.
···7777/**7878 * ccwgroup_set_offline() - disable a ccwgroup device7979 * @gdev: target ccwgroup device8080+ * @call_gdrv: Call the registered gdrv set_offline function8081 *8182 * This function attempts to put the ccwgroup device into the offline state.8283 * Returns:8384 * %0 on success and a negative error value on failure.8485 */8585-int ccwgroup_set_offline(struct ccwgroup_device *gdev)8686+int ccwgroup_set_offline(struct ccwgroup_device *gdev, bool call_gdrv)8687{8788 struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);8889 int ret = -EINVAL;···9291 return -EAGAIN;9392 if (gdev->state == CCWGROUP_OFFLINE)9493 goto out;9494+ if (!call_gdrv) {9595+ ret = 0;9696+ goto offline;9797+ }9598 if (gdrv->set_offline)9699 ret = gdrv->set_offline(gdev);97100 if (ret)98101 goto out;99102103103+offline:100104 gdev->state = CCWGROUP_OFFLINE;101105out:102106 atomic_set(&gdev->onoff, 0);···130124 if (value == 1)131125 ret = ccwgroup_set_online(gdev);132126 else if (value == 0)133133- ret = ccwgroup_set_offline(gdev);127127+ ret = ccwgroup_set_offline(gdev, true);134128 else135129 ret = -EINVAL;136130out:
···7070static int qeth_qdio_establish(struct qeth_card *);7171static void qeth_free_qdio_queues(struct qeth_card *card);72727373-static void qeth_close_dev_handler(struct work_struct *work)7474-{7575- struct qeth_card *card;7676-7777- card = container_of(work, struct qeth_card, close_dev_work);7878- QETH_CARD_TEXT(card, 2, "cldevhdl");7979- ccwgroup_set_offline(card->gdev);8080-}8181-8273static const char *qeth_get_cardname(struct qeth_card *card)8374{8475 if (IS_VM_NIC(card)) {···192201 list_for_each_entry_safe(pool_entry, tmp,193202 &card->qdio.in_buf_pool.entry_list, list)194203 list_del(&pool_entry->list);204204+205205+ if (!queue)206206+ return;195207196208 for (i = 0; i < ARRAY_SIZE(queue->bufs); i++)197209 queue->bufs[i].pool_entry = NULL;···786792 case IPA_CMD_STOPLAN:787793 if (cmd->hdr.return_code == IPA_RC_VEPA_TO_VEB_TRANSITION) {788794 dev_err(&card->gdev->dev,789789- "Interface %s is down because the adjacent port is no longer in reflective relay mode\n",795795+ "Adjacent port of interface %s is no longer in reflective relay mode, trigger recovery\n",790796 netdev_name(card->dev));791791- schedule_work(&card->close_dev_work);797797+ /* Set offline, then probably fail to set online: */798798+ qeth_schedule_recovery(card);792799 } else {800800+ /* stay online for subsequent STARTLAN */793801 dev_warn(&card->gdev->dev,794802 "The link for interface %s on CHPID 0x%X failed\n",795803 netdev_name(card->dev), card->info.chpid);···15331537 INIT_LIST_HEAD(&card->ipato.entries);15341538 qeth_init_qdio_info(card);15351539 INIT_DELAYED_WORK(&card->buffer_reclaim_work, qeth_buffer_reclaim_work);15361536- INIT_WORK(&card->close_dev_work, qeth_close_dev_handler);15371540 hash_init(card->rx_mode_addrs);15381541 hash_init(card->local_addrs4);15391542 hash_init(card->local_addrs6);···55145519 dev_info(&card->gdev->dev,55155520 "Device successfully recovered!\n");55165521 } else {55175517- ccwgroup_set_offline(card->gdev);55225522+ qeth_set_offline(card, disc, true);55235523+ ccwgroup_set_offline(card->gdev, false);55185524 dev_warn(&card->gdev->dev,55195525 "The qeth device driver failed to recover an error on the device\n");55205526 }
-1
drivers/s390/net/qeth_l2_main.c
···23072307 if (gdev->state == CCWGROUP_ONLINE)23082308 qeth_set_offline(card, card->discipline, false);2309230923102310- cancel_work_sync(&card->close_dev_work);23112310 if (card->dev->reg_state == NETREG_REGISTERED) {23122311 priv = netdev_priv(card->dev);23132312 if (priv->brport_features & BR_LEARNING_SYNC) {
-1
drivers/s390/net/qeth_l3_main.c
···19691969 if (cgdev->state == CCWGROUP_ONLINE)19701970 qeth_set_offline(card, card->discipline, false);1971197119721972- cancel_work_sync(&card->close_dev_work);19731972 if (card->dev->reg_state == NETREG_REGISTERED)19741973 unregister_netdev(card->dev);19751974
-11
drivers/scsi/arm/Kconfig
···1010 This enables support for the Acorn SCSI card (aka30). If you have an1111 Acorn system with one of these, say Y. If unsure, say N.12121313-config SCSI_ACORNSCSI_TAGGED_QUEUE1414- bool "Support SCSI 2 Tagged queueing"1515- depends on SCSI_ACORNSCSI_31616- help1717- Say Y here to enable tagged queuing support on the Acorn SCSI card.1818-1919- This is a feature of SCSI-2 which improves performance: the host2020- adapter can send several SCSI commands to a device's queue even if2121- previous commands haven't finished yet. Some SCSI devices don't2222- implement this properly, so the safe answer is N.2323-2413config SCSI_ACORNSCSI_SYNC2514 bool "Support SCSI 2 Synchronous Transfers"2615 depends on SCSI_ACORNSCSI_3
+22-81
drivers/scsi/arm/acornscsi.c
···5252 * You can tell if you have a device that supports tagged queueing my5353 * cating (eg) /proc/scsi/acornscsi/0 and see if the SCSI revision is reported5454 * as '2 TAG'.5555- *5656- * Also note that CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE is normally set in the config5757- * scripts, but disabled here. Once debugged, remove the #undef, otherwise to debug,5858- * comment out the undef.5955 */6060-#undef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE5656+6157/*6258 * SCSI-II Synchronous transfer support.6359 *···167171 unsigned int result);168172static int acornscsi_reconnect_finish(AS_Host *host);169173static void acornscsi_dma_cleanup(AS_Host *host);170170-static void acornscsi_abortcmd(AS_Host *host, unsigned char tag);174174+static void acornscsi_abortcmd(AS_Host *host);171175172176/* ====================================================================================173177 * Miscellaneous···737741#endif738742739743 if (from_queue) {740740-#ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE741741- /*742742- * tagged queueing - allocate a new tag to this command743743- */744744- if (SCpnt->device->simple_tags) {745745- SCpnt->device->current_tag += 1;746746- if (SCpnt->device->current_tag == 0)747747- SCpnt->device->current_tag = 1;748748- SCpnt->tag = SCpnt->device->current_tag;749749- } else750750-#endif751744 set_bit(SCpnt->device->id * 8 +752745 (u8)(SCpnt->device->lun & 0x07), host->busyluns);753746···11771192 * the device recognises the attention.11781193 */11791194 if (dmac_read(host, DMAC_STATUS) & STATUS_RQ0) {11801180- acornscsi_abortcmd(host, host->SCpnt->tag);11951195+ acornscsi_abortcmd(host);1181119611821197 dmac_write(host, DMAC_TXCNTLO, 0);11831198 dmac_write(host, DMAC_TXCNTHI, 0);···15451560 acornscsi_sbic_issuecmd(host, CMND_ASSERTATN);1546156115471562 switch (host->scsi.last_message) {15481548-#ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE15491549- case HEAD_OF_QUEUE_TAG:15501550- case ORDERED_QUEUE_TAG:15511551- case SIMPLE_QUEUE_TAG:15521552- /*15531553- * ANSI standard says: (Section SCSI-2 Rev. 10c Sect 5.6.17)15541554- * If a target does not implement tagged queuing and a queue tag15551555- * message is received, it shall respond with a MESSAGE REJECT15561556- * message and accept the I/O process as if it were untagged.15571557- */15581558- printk(KERN_NOTICE "scsi%d.%c: disabling tagged queueing\n",15591559- host->host->host_no, acornscsi_target(host));15601560- host->SCpnt->device->simple_tags = 0;15611561- set_bit(host->SCpnt->device->id * 8 +15621562- (u8)(host->SCpnt->device->lun & 0x7), host->busyluns);15631563- break;15641564-#endif15651563 case EXTENDED_MESSAGE | (EXTENDED_SDTR << 8):15661564 /*15671565 * Target can't handle synchronous transfers···16551687#if 016561688 /* does the device need the current command aborted */16571689 if (cmd_aborted) {16581658- acornscsi_abortcmd(host->SCpnt->tag);16901690+ acornscsi_abortcmd(host);16591691 return;16601692 }16611693#endif1662169416631663-#ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE16641664- if (host->SCpnt->tag) {16651665- unsigned int tag_type;16661666-16671667- if (host->SCpnt->cmnd[0] == REQUEST_SENSE ||16681668- host->SCpnt->cmnd[0] == TEST_UNIT_READY ||16691669- host->SCpnt->cmnd[0] == INQUIRY)16701670- tag_type = HEAD_OF_QUEUE_TAG;16711671- else16721672- tag_type = SIMPLE_QUEUE_TAG;16731673- msgqueue_addmsg(&host->scsi.msgs, 2, tag_type, host->SCpnt->tag);16741674- }16751675-#endif1676169516771696#ifdef CONFIG_SCSI_ACORNSCSI_SYNC16781697 if (host->device[host->SCpnt->device->id].sync_state == SYNC_NEGOCIATE) {···17531798 "to reconnect with\n",17541799 host->host->host_no, '0' + target);17551800 acornscsi_dumplog(host, target);17561756- acornscsi_abortcmd(host, 0);18011801+ acornscsi_abortcmd(host);17571802 if (host->SCpnt) {17581803 queue_add_cmd_tail(&host->queues.disconnected, host->SCpnt);17591804 host->SCpnt = NULL;···17761821 host->scsi.disconnectable = 0;17771822 if (host->SCpnt->device->id == host->scsi.reconnected.target &&17781823 host->SCpnt->device->lun == host->scsi.reconnected.lun &&17791779- host->SCpnt->tag == host->scsi.reconnected.tag) {18241824+ scsi_cmd_to_tag(host->SCpnt) == host->scsi.reconnected.tag) {17801825#if (DEBUG & (DEBUG_QUEUES|DEBUG_DISCON))17811826 DBG(host->SCpnt, printk("scsi%d.%c: reconnected",17821827 host->host->host_no, acornscsi_target(host)));···18031848 }1804184918051850 if (!host->SCpnt)18061806- acornscsi_abortcmd(host, host->scsi.reconnected.tag);18511851+ acornscsi_abortcmd(host);18071852 else {18081853 /*18091854 * Restore data pointer from SAVED pointers.···18441889 * Function: void acornscsi_abortcmd(AS_host *host, unsigned char tag)18451890 * Purpose : abort a currently executing command18461891 * Params : host - host with connected command to abort18471847- * tag - tag to abort18481892 */18491893static18501850-void acornscsi_abortcmd(AS_Host *host, unsigned char tag)18941894+void acornscsi_abortcmd(AS_Host *host)18511895{18521896 host->scsi.phase = PHASE_ABORTED;18531897 sbic_arm_write(host, SBIC_CMND, CMND_ASSERTATN);1854189818551899 msgqueue_flush(&host->scsi.msgs);18561856-#ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE18571857- if (tag)18581858- msgqueue_addmsg(&host->scsi.msgs, 2, ABORT_TAG, tag);18591859- else18601860-#endif18611861- msgqueue_addmsg(&host->scsi.msgs, 1, ABORT);19001900+ msgqueue_addmsg(&host->scsi.msgs, 1, ABORT);18621901}1863190218641903/* ==========================================================================================···19421993 printk(KERN_ERR "scsi%d.%c: PHASE_CONNECTING, SSR %02X?\n",19431994 host->host->host_no, acornscsi_target(host), ssr);19441995 acornscsi_dumplog(host, host->SCpnt ? host->SCpnt->device->id : 8);19451945- acornscsi_abortcmd(host, host->SCpnt->tag);19961996+ acornscsi_abortcmd(host);19461997 }19471998 return INTR_PROCESSING;19481999···19782029 printk(KERN_ERR "scsi%d.%c: PHASE_CONNECTED, SSR %02X?\n",19792030 host->host->host_no, acornscsi_target(host), ssr);19802031 acornscsi_dumplog(host, host->SCpnt ? host->SCpnt->device->id : 8);19811981- acornscsi_abortcmd(host, host->SCpnt->tag);20322032+ acornscsi_abortcmd(host);19822033 }19832034 return INTR_PROCESSING;19842035···20242075 case 0x18: /* -> PHASE_DATAOUT */20252076 /* COMMAND -> DATA OUT */20262077 if (host->scsi.SCp.sent_command != host->SCpnt->cmd_len)20272027- acornscsi_abortcmd(host, host->SCpnt->tag);20782078+ acornscsi_abortcmd(host);20282079 acornscsi_dma_setup(host, DMA_OUT);20292080 if (!acornscsi_starttransfer(host))20302030- acornscsi_abortcmd(host, host->SCpnt->tag);20812081+ acornscsi_abortcmd(host);20312082 host->scsi.phase = PHASE_DATAOUT;20322083 return INTR_IDLE;2033208420342085 case 0x19: /* -> PHASE_DATAIN */20352086 /* COMMAND -> DATA IN */20362087 if (host->scsi.SCp.sent_command != host->SCpnt->cmd_len)20372037- acornscsi_abortcmd(host, host->SCpnt->tag);20882088+ acornscsi_abortcmd(host);20382089 acornscsi_dma_setup(host, DMA_IN);20392090 if (!acornscsi_starttransfer(host))20402040- acornscsi_abortcmd(host, host->SCpnt->tag);20912091+ acornscsi_abortcmd(host);20412092 host->scsi.phase = PHASE_DATAIN;20422093 return INTR_IDLE;20432094···21052156 /* MESSAGE IN -> DATA OUT */21062157 acornscsi_dma_setup(host, DMA_OUT);21072158 if (!acornscsi_starttransfer(host))21082108- acornscsi_abortcmd(host, host->SCpnt->tag);21592159+ acornscsi_abortcmd(host);21092160 host->scsi.phase = PHASE_DATAOUT;21102161 return INTR_IDLE;21112162···21142165 /* MESSAGE IN -> DATA IN */21152166 acornscsi_dma_setup(host, DMA_IN);21162167 if (!acornscsi_starttransfer(host))21172117- acornscsi_abortcmd(host, host->SCpnt->tag);21682168+ acornscsi_abortcmd(host);21182169 host->scsi.phase = PHASE_DATAIN;21192170 return INTR_IDLE;21202171···21552206 switch (ssr) {21562207 case 0x19: /* -> PHASE_DATAIN */21572208 case 0x89: /* -> PHASE_DATAIN */21582158- acornscsi_abortcmd(host, host->SCpnt->tag);22092209+ acornscsi_abortcmd(host);21592210 return INTR_IDLE;2160221121612212 case 0x1b: /* -> PHASE_STATUSIN */···22042255 switch (ssr) {22052256 case 0x18: /* -> PHASE_DATAOUT */22062257 case 0x88: /* -> PHASE_DATAOUT */22072207- acornscsi_abortcmd(host, host->SCpnt->tag);22582258+ acornscsi_abortcmd(host);22082259 return INTR_IDLE;2209226022102261 case 0x1b: /* -> PHASE_STATUSIN */···24312482 SCpnt->scsi_done = done;24322483 SCpnt->host_scribble = NULL;24332484 SCpnt->result = 0;24342434- SCpnt->tag = 0;24352485 SCpnt->SCp.phase = (int)acornscsi_datadirection(SCpnt->cmnd[0]);24362486 SCpnt->SCp.sent_command = 0;24372487 SCpnt->SCp.scsi_xferred = 0;···25292581 break;2530258225312583 default:25322532- acornscsi_abortcmd(host, host->SCpnt->tag);25842584+ acornscsi_abortcmd(host);25332585 res = res_snooze;25342586 }25352587 local_irq_restore(flags);···26952747#ifdef CONFIG_SCSI_ACORNSCSI_SYNC26962748 " SYNC"26972749#endif26982698-#ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE26992699- " TAG"27002700-#endif27012750#if (DEBUG & DEBUG_NO_WRITE)27022751 " NOWRITE (" __stringify(NO_WRITE) ")"27032752#endif···27142769 seq_printf(m, "AcornSCSI driver v%d.%d.%d"27152770#ifdef CONFIG_SCSI_ACORNSCSI_SYNC27162771 " SYNC"27172717-#endif27182718-#ifdef CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE27192719- " TAG"27202772#endif27212773#if (DEBUG & DEBUG_NO_WRITE)27222774 " NOWRITE (" __stringify(NO_WRITE) ")"···27692827 seq_printf(m, "Device/Lun TaggedQ Sync\n");27702828 seq_printf(m, " %d/%llu ", scd->id, scd->lun);27712829 if (scd->tagged_supported)27722772- seq_printf(m, "%3sabled(%3d) ",27732773- scd->simple_tags ? "en" : "dis",27742774- scd->current_tag);28302830+ seq_printf(m, "%3sabled ",28312831+ scd->simple_tags ? "en" : "dis");27752832 else27762833 seq_printf(m, "unsupported ");27772834
+8-23
drivers/scsi/arm/fas216.c
···7777 * I was thinking that this was a good chip until I found this restriction ;(7878 */7979#define SCSI2_SYNC8080-#undef SCSI2_TAG81808281#undef DEBUG_CONNECT8382#undef DEBUG_MESSAGES···989990 info->scsi.disconnectable = 0;990991 if (info->SCpnt->device->id == target &&991992 info->SCpnt->device->lun == lun &&992992- info->SCpnt->tag == tag) {993993+ scsi_cmd_to_rq(info->SCpnt)->tag == tag) {993994 fas216_log(info, LOG_CONNECT, "reconnected previously executing command");994995 } else {995996 queue_add_cmd_tail(&info->queues.disconnected, info->SCpnt);···17901791 /*17911792 * add tag message if required17921793 */17931793- if (SCpnt->tag)17941794- msgqueue_addmsg(&info->scsi.msgs, 2, SIMPLE_QUEUE_TAG, SCpnt->tag);17941794+ if (SCpnt->device->simple_tags)17951795+ msgqueue_addmsg(&info->scsi.msgs, 2, SIMPLE_QUEUE_TAG,17961796+ scsi_cmd_to_rq(SCpnt)->tag);1795179717961798 do {17971799#ifdef SCSI2_SYNC···1815181518161816static void fas216_allocate_tag(FAS216_Info *info, struct scsi_cmnd *SCpnt)18171817{18181818-#ifdef SCSI2_TAG18191819- /*18201820- * tagged queuing - allocate a new tag to this command18211821- */18221822- if (SCpnt->device->simple_tags && SCpnt->cmnd[0] != REQUEST_SENSE &&18231823- SCpnt->cmnd[0] != INQUIRY) {18241824- SCpnt->device->current_tag += 1;18251825- if (SCpnt->device->current_tag == 0)18261826- SCpnt->device->current_tag = 1;18271827- SCpnt->tag = SCpnt->device->current_tag;18281828- } else18291829-#endif18301830- set_bit(SCpnt->device->id * 8 +18311831- (u8)(SCpnt->device->lun & 0x7), info->busyluns);18181818+ set_bit(SCpnt->device->id * 8 +18191819+ (u8)(SCpnt->device->lun & 0x7), info->busyluns);1832182018331821 info->stats.removes += 1;18341822 switch (SCpnt->cmnd[0]) {···21052117 init_SCp(SCpnt);21062118 SCpnt->SCp.Message = 0;21072119 SCpnt->SCp.Status = 0;21082108- SCpnt->tag = 0;21092120 SCpnt->host_scribble = (void *)fas216_rq_sns_done;2110212121112122 /*···22102223 init_SCp(SCpnt);2211222422122225 info->stats.queues += 1;22132213- SCpnt->tag = 0;2214222622152227 spin_lock(&info->host_lock);22162228···29893003 dev = &info->device[scd->id];29903004 seq_printf(m, " %d/%llu ", scd->id, scd->lun);29913005 if (scd->tagged_supported)29922992- seq_printf(m, "%3sabled(%3d) ",29932993- scd->simple_tags ? "en" : "dis",29942994- scd->current_tag);30063006+ seq_printf(m, "%3sabled ",30073007+ scd->simple_tags ? "en" : "dis");29953008 else29963009 seq_puts(m, "unsupported ");29973010
···928928 break;929929930930 case EFC_EVT_NPORT_TOPOLOGY_NOTIFY: {931931- enum efc_nport_topology topology =932932- (enum efc_nport_topology)arg;931931+ enum efc_nport_topology *topology = arg;933932934933 WARN_ON(node->nport->domain->attached);935934936935 WARN_ON(node->send_ls_acc != EFC_NODE_SEND_LS_ACC_PLOGI);937936938937 node_printf(node, "topology notification, topology=%d\n",939939- topology);938938+ *topology);940939941940 /* At the time the PLOGI was received, the topology was unknown,942941 * so we didn't know which node would perform the domain attach:943942 * 1. The node from which the PLOGI was sent (p2p) or944943 * 2. The node to which the FLOGI was sent (fabric).945944 */946946- if (topology == EFC_NPORT_TOPO_P2P) {945945+ if (*topology == EFC_NPORT_TOPO_P2P) {947946 /* if this is p2p, need to attach to the domain using948947 * the d_id from the PLOGI received949948 */
···40154015 be32_to_cpu(pcgd->desc_tag),40164016 be32_to_cpu(pcgd->desc_len),40174017 be32_to_cpu(pcgd->xmt_signal_capability),40184018- be32_to_cpu(pcgd->xmt_signal_frequency.count),40194019- be32_to_cpu(pcgd->xmt_signal_frequency.units),40184018+ be16_to_cpu(pcgd->xmt_signal_frequency.count),40194019+ be16_to_cpu(pcgd->xmt_signal_frequency.units),40204020 be32_to_cpu(pcgd->rcv_signal_capability),40214021- be32_to_cpu(pcgd->rcv_signal_frequency.count),40224022- be32_to_cpu(pcgd->rcv_signal_frequency.units));40214021+ be16_to_cpu(pcgd->rcv_signal_frequency.count),40224022+ be16_to_cpu(pcgd->rcv_signal_frequency.units));4023402340244024 /* Compare driver and Fport capabilities and choose40254025 * least common.···93879387 /* Extract the next WWPN from the payload */93889388 wwn = *wwnlist++;93899389 wwpn = be64_to_cpu(wwn);93909390- len += scnprintf(buf + len, LPFC_FPIN_WWPN_LINE_SZ,93909390+ len += scnprintf(buf + len, LPFC_FPIN_WWPN_LINE_SZ - len,93919391 " %016llx", wwpn);9392939293939393 /* Log a message if we are on the last WWPN
···19161916 raid = MR_LdRaidGet(ld, local_map_ptr);1917191719181918 if (raid->capability.ldPiMode == MR_PROT_INFO_TYPE_CONTROLLER)19191919- blk_queue_update_dma_alignment(sdev->request_queue, 0x7);19191919+ blk_queue_update_dma_alignment(sdev->request_queue, 0x7);1920192019211921 mr_device_priv_data->is_tm_capable =19221922 raid->capability.tmCapable;···8033803380348034 if (instance->adapter_type != MFI_SERIES) {80358035 megasas_release_fusion(instance);80368036- pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +80368036+ pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +80378037 (sizeof(struct MR_PD_CFG_SEQ) *80388038 (MAX_PHYSICAL_DEVICES - 1));80398039 for (i = 0; i < 2 ; i++) {···8773877387748774 if (event_type & SCAN_VD_CHANNEL) {87758775 if (!instance->requestorId ||87768776- (instance->requestorId &&87778777- megasas_get_ld_vf_affiliation(instance, 0))) {87768776+ megasas_get_ld_vf_affiliation(instance, 0)) {87788777 dcmd_ret = megasas_ld_list_query(instance,87798778 MR_LD_QUERY_TYPE_EXPOSED_TO_HOST);87808779 if (dcmd_ret != DCMD_SUCCESS)
+3-1
drivers/scsi/mpt3sas/mpt3sas_base.c
···15821582 * wait for current poll to complete.15831583 */15841584 for (qid = 0; qid < iopoll_q_count; qid++) {15851585- while (atomic_read(&ioc->io_uring_poll_queues[qid].busy))15851585+ while (atomic_read(&ioc->io_uring_poll_queues[qid].busy)) {15861586+ cpu_relax();15861587 udelay(500);15881588+ }15871589 }15881590}15891591
···71697169 return 0;71707170 break;71717171 case QLA2XXX_INI_MODE_DUAL:71727172- if (!qla_dual_mode_enabled(vha))71727172+ if (!qla_dual_mode_enabled(vha) &&71737173+ !qla_ini_mode_enabled(vha))71737174 return 0;71747175 break;71757176 case QLA2XXX_INI_MODE_ENABLED:
+4-4
drivers/scsi/scsi_transport_iscsi.c
···441441 struct iscsi_transport *t = iface->transport;442442 int param = -1;443443444444- if (attr == &dev_attr_iface_enabled.attr)445445- param = ISCSI_NET_PARAM_IFACE_ENABLE;446446- else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr)444444+ if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr)447445 param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO;448446 else if (attr == &dev_attr_iface_header_digest.attr)449447 param = ISCSI_IFACE_PARAM_HDRDGST_EN;···481483 if (param != -1)482484 return t->attr_is_visible(ISCSI_IFACE_PARAM, param);483485484484- if (attr == &dev_attr_iface_vlan_id.attr)486486+ if (attr == &dev_attr_iface_enabled.attr)487487+ param = ISCSI_NET_PARAM_IFACE_ENABLE;488488+ else if (attr == &dev_attr_iface_vlan_id.attr)485489 param = ISCSI_NET_PARAM_VLAN_ID;486490 else if (attr == &dev_attr_iface_vlan_priority.attr)487491 param = ISCSI_NET_PARAM_VLAN_PRIORITY;
···154154155155 /*156156 * Report zone buffer size should be at most 64B times the number of157157- * zones requested plus the 64B reply header, but should be at least158158- * SECTOR_SIZE for ATA devices.157157+ * zones requested plus the 64B reply header, but should be aligned158158+ * to SECTOR_SIZE for ATA devices.159159 * Make sure that this size does not exceed the hardware capabilities.160160 * Furthermore, since the report zone command cannot be split, make161161 * sure that the allocated buffer can always be mapped by limiting the···174174 *buflen = bufsize;175175 return buf;176176 }177177- bufsize >>= 1;177177+ bufsize = rounddown(bufsize >> 1, SECTOR_SIZE);178178 }179179180180 return NULL;···280280{281281 struct scsi_disk *sdkp;282282 unsigned long flags;283283- unsigned int zno;283283+ sector_t zno;284284 int ret;285285286286 sdkp = container_of(work, struct scsi_disk, zone_wp_offset_work);
···523523 return rc;524524 cd->readcd_known = 0;525525 sr_printk(KERN_INFO, cd,526526- "CDROM does'nt support READ CD (0xbe) command\n");526526+ "CDROM doesn't support READ CD (0xbe) command\n");527527 /* fall & retry the other way */528528 }529529 /* ... if this fails, we switch the blocksize using MODE SELECT */
···128128 return err;129129}130130131131+static int ufs_intel_set_lanes(struct ufs_hba *hba, u32 lanes)132132+{133133+ struct ufs_pa_layer_attr pwr_info = hba->pwr_info;134134+ int ret;135135+136136+ pwr_info.lane_rx = lanes;137137+ pwr_info.lane_tx = lanes;138138+ ret = ufshcd_config_pwr_mode(hba, &pwr_info);139139+ if (ret)140140+ dev_err(hba->dev, "%s: Setting %u lanes, err = %d\n",141141+ __func__, lanes, ret);142142+ return ret;143143+}144144+145145+static int ufs_intel_lkf_pwr_change_notify(struct ufs_hba *hba,146146+ enum ufs_notify_change_status status,147147+ struct ufs_pa_layer_attr *dev_max_params,148148+ struct ufs_pa_layer_attr *dev_req_params)149149+{150150+ int err = 0;151151+152152+ switch (status) {153153+ case PRE_CHANGE:154154+ if (ufshcd_is_hs_mode(dev_max_params) &&155155+ (hba->pwr_info.lane_rx != 2 || hba->pwr_info.lane_tx != 2))156156+ ufs_intel_set_lanes(hba, 2);157157+ memcpy(dev_req_params, dev_max_params, sizeof(*dev_req_params));158158+ break;159159+ case POST_CHANGE:160160+ if (ufshcd_is_hs_mode(dev_req_params)) {161161+ u32 peer_granularity;162162+163163+ usleep_range(1000, 1250);164164+ err = ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_GRANULARITY),165165+ &peer_granularity);166166+ }167167+ break;168168+ default:169169+ break;170170+ }171171+172172+ return err;173173+}174174+175175+static int ufs_intel_lkf_apply_dev_quirks(struct ufs_hba *hba)176176+{177177+ u32 granularity, peer_granularity;178178+ u32 pa_tactivate, peer_pa_tactivate;179179+ int ret;180180+181181+ ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_GRANULARITY), &granularity);182182+ if (ret)183183+ goto out;184184+185185+ ret = ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_GRANULARITY), &peer_granularity);186186+ if (ret)187187+ goto out;188188+189189+ ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_TACTIVATE), &pa_tactivate);190190+ if (ret)191191+ goto out;192192+193193+ ret = ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_TACTIVATE), &peer_pa_tactivate);194194+ if (ret)195195+ goto out;196196+197197+ if (granularity == peer_granularity) {198198+ u32 new_peer_pa_tactivate = pa_tactivate + 2;199199+200200+ ret = ufshcd_dme_peer_set(hba, UIC_ARG_MIB(PA_TACTIVATE), new_peer_pa_tactivate);201201+ }202202+out:203203+ return ret;204204+}205205+131206#define INTEL_ACTIVELTR 0x804132207#define INTEL_IDLELTR 0x808133208···426351 struct ufs_host *ufs_host;427352 int err;428353354354+ hba->nop_out_timeout = 200;429355 hba->quirks |= UFSHCD_QUIRK_BROKEN_AUTO_HIBERN8;430356 hba->caps |= UFSHCD_CAP_CRYPTO;431357 err = ufs_intel_common_init(hba);···457381 .exit = ufs_intel_common_exit,458382 .hce_enable_notify = ufs_intel_hce_enable_notify,459383 .link_startup_notify = ufs_intel_link_startup_notify,384384+ .pwr_change_notify = ufs_intel_lkf_pwr_change_notify,385385+ .apply_dev_quirks = ufs_intel_lkf_apply_dev_quirks,460386 .resume = ufs_intel_resume,461387 .device_reset = ufs_intel_device_reset,462388};
+57-59
drivers/scsi/ufs/ufshcd.c
···1717#include <linux/blk-pm.h>1818#include <linux/blkdev.h>1919#include <scsi/scsi_driver.h>2020-#include <scsi/scsi_transport.h>2121-#include "../scsi_transport_api.h"2220#include "ufshcd.h"2321#include "ufs_quirks.h"2422#include "unipro.h"···235237static irqreturn_t ufshcd_intr(int irq, void *__hba);236238static int ufshcd_change_power_mode(struct ufs_hba *hba,237239 struct ufs_pa_layer_attr *pwr_mode);240240+static void ufshcd_schedule_eh_work(struct ufs_hba *hba);238241static int ufshcd_setup_hba_vreg(struct ufs_hba *hba, bool on);239242static int ufshcd_setup_vreg(struct ufs_hba *hba, bool on);240243static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba,···27582759out:27592760 up_read(&hba->clk_scaling_lock);2760276127612761- if (ufs_trigger_eh())27622762- scsi_schedule_eh(hba->host);27622762+ if (ufs_trigger_eh()) {27632763+ unsigned long flags;27642764+27652765+ spin_lock_irqsave(hba->host->host_lock, flags);27662766+ ufshcd_schedule_eh_work(hba);27672767+ spin_unlock_irqrestore(hba->host->host_lock, flags);27682768+ }2763276927642770 return err;27652771}···39233919}39243920EXPORT_SYMBOL_GPL(ufshcd_dme_get_attr);3925392139263926-static inline bool ufshcd_is_saved_err_fatal(struct ufs_hba *hba)39273927-{39283928- lockdep_assert_held(hba->host->host_lock);39293929-39303930- return (hba->saved_uic_err & UFSHCD_UIC_DL_PA_INIT_ERROR) ||39313931- (hba->saved_err & (INT_FATAL_ERRORS | UFSHCD_UIC_HIBERN8_MASK));39323932-}39333933-39343934-static void ufshcd_schedule_eh(struct ufs_hba *hba)39353935-{39363936- bool schedule_eh = false;39373937- unsigned long flags;39383938-39393939- spin_lock_irqsave(hba->host->host_lock, flags);39403940- /* handle fatal errors only when link is not in error state */39413941- if (hba->ufshcd_state != UFSHCD_STATE_ERROR) {39423942- if (hba->force_reset || ufshcd_is_link_broken(hba) ||39433943- ufshcd_is_saved_err_fatal(hba))39443944- hba->ufshcd_state = UFSHCD_STATE_EH_SCHEDULED_FATAL;39453945- else39463946- hba->ufshcd_state = UFSHCD_STATE_EH_SCHEDULED_NON_FATAL;39473947- schedule_eh = true;39483948- }39493949- spin_unlock_irqrestore(hba->host->host_lock, flags);39503950-39513951- if (schedule_eh)39523952- scsi_schedule_eh(hba->host);39533953-}39543954-39553922/**39563923 * ufshcd_uic_pwr_ctrl - executes UIC commands (which affects the link power39573924 * state) and waits for it to take effect.···39433968{39443969 DECLARE_COMPLETION_ONSTACK(uic_async_done);39453970 unsigned long flags;39463946- bool schedule_eh = false;39473971 u8 status;39483972 int ret;39493973 bool reenable_intr = false;···40124038 ufshcd_enable_intr(hba, UIC_COMMAND_COMPL);40134039 if (ret) {40144040 ufshcd_set_link_broken(hba);40154015- schedule_eh = true;40414041+ ufshcd_schedule_eh_work(hba);40164042 }40174017-40184043out_unlock:40194044 spin_unlock_irqrestore(hba->host->host_lock, flags);40204020-40214021- if (schedule_eh)40224022- ufshcd_schedule_eh(hba);40234045 mutex_unlock(&hba->uic_cmd_mutex);4024404640254047 return ret;···47464776 mutex_lock(&hba->dev_cmd.lock);47474777 for (retries = NOP_OUT_RETRIES; retries > 0; retries--) {47484778 err = ufshcd_exec_dev_cmd(hba, DEV_CMD_TYPE_NOP,47494749- NOP_OUT_TIMEOUT);47794779+ hba->nop_out_timeout);4750478047514781 if (!err || err == -ETIMEDOUT)47524782 break;···58815911 return err_handling;58825912}5883591359145914+/* host lock must be held before calling this func */59155915+static inline bool ufshcd_is_saved_err_fatal(struct ufs_hba *hba)59165916+{59175917+ return (hba->saved_uic_err & UFSHCD_UIC_DL_PA_INIT_ERROR) ||59185918+ (hba->saved_err & (INT_FATAL_ERRORS | UFSHCD_UIC_HIBERN8_MASK));59195919+}59205920+59215921+/* host lock must be held before calling this func */59225922+static inline void ufshcd_schedule_eh_work(struct ufs_hba *hba)59235923+{59245924+ /* handle fatal errors only when link is not in error state */59255925+ if (hba->ufshcd_state != UFSHCD_STATE_ERROR) {59265926+ if (hba->force_reset || ufshcd_is_link_broken(hba) ||59275927+ ufshcd_is_saved_err_fatal(hba))59285928+ hba->ufshcd_state = UFSHCD_STATE_EH_SCHEDULED_FATAL;59295929+ else59305930+ hba->ufshcd_state = UFSHCD_STATE_EH_SCHEDULED_NON_FATAL;59315931+ queue_work(hba->eh_wq, &hba->eh_work);59325932+ }59335933+}59345934+58845935static void ufshcd_clk_scaling_allow(struct ufs_hba *hba, bool allow)58855936{58865937 down_write(&hba->clk_scaling_lock);···6035604460366045/**60376046 * ufshcd_err_handler - handle UFS errors that require s/w attention60386038- * @host: SCSI host pointer60476047+ * @work: pointer to work structure60396048 */60406040-static void ufshcd_err_handler(struct Scsi_Host *host)60496049+static void ufshcd_err_handler(struct work_struct *work)60416050{60426042- struct ufs_hba *hba = shost_priv(host);60516051+ struct ufs_hba *hba;60436052 unsigned long flags;60446053 bool err_xfer = false;60456054 bool err_tm = false;···60476056 int tag;60486057 bool needs_reset = false, needs_restore = false;6049605860596059+ hba = container_of(work, struct ufs_hba, eh_work);60606060+60506061 down(&hba->host_sem);60516062 spin_lock_irqsave(hba->host->host_lock, flags);60526052- hba->host->host_eh_scheduled = 0;60536063 if (ufshcd_err_handling_should_stop(hba)) {60546064 if (hba->ufshcd_state != UFSHCD_STATE_ERROR)60556065 hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL;···63636371 "host_regs: ");63646372 ufshcd_print_pwr_info(hba);63656373 }63746374+ ufshcd_schedule_eh_work(hba);63666375 retval |= IRQ_HANDLED;63676376 }63686377 /*···63756382 hba->errors = 0;63766383 hba->uic_error = 0;63776384 spin_unlock(hba->host->host_lock);63786378-63796379- if (queue_eh_work)63806380- ufshcd_schedule_eh(hba);63816381-63826385 return retval;63836386}63846387···68656876 err = ufshcd_clear_cmd(hba, pos);68666877 if (err)68676878 break;68686868- __ufshcd_transfer_req_compl(hba, pos, /*retry_requests=*/true);68796879+ __ufshcd_transfer_req_compl(hba, 1U << pos, false);68696880 }68706881 }68716882···70377048 * will be to send LU reset which, again, is a spec violation.70387049 * To avoid these unnecessary/illegal steps, first we clean up70397050 * the lrb taken by this cmd and re-set it in outstanding_reqs,70407040- * then queue the error handler and bail.70517051+ * then queue the eh_work and bail.70417052 */70427053 if (lrbp->lun == UFS_UPIU_UFS_DEVICE_WLUN) {70437054 ufshcd_update_evt_hist(hba, UFS_EVT_ABORT, lrbp->lun);7044705570457056 spin_lock_irqsave(host->host_lock, flags);70467057 hba->force_reset = true;70587058+ ufshcd_schedule_eh_work(hba);70477059 spin_unlock_irqrestore(host->host_lock, flags);70487048-70497049- ufshcd_schedule_eh(hba);70507050-70517060 goto release;70527061 }70537062···7178719171797192 spin_lock_irqsave(hba->host->host_lock, flags);71807193 hba->force_reset = true;71947194+ ufshcd_schedule_eh_work(hba);71817195 dev_err(hba->dev, "%s: reset in progress - 1\n", __func__);71827196 spin_unlock_irqrestore(hba->host->host_lock, flags);7183719771847184- ufshcd_err_handler(hba->host);71987198+ flush_work(&hba->eh_work);7185719971867200 spin_lock_irqsave(hba->host->host_lock, flags);71877201 if (hba->ufshcd_state == UFSHCD_STATE_ERROR)···85928604 if (hba->is_powered) {85938605 ufshcd_exit_clk_scaling(hba);85948606 ufshcd_exit_clk_gating(hba);86078607+ if (hba->eh_wq)86088608+ destroy_workqueue(hba->eh_wq);85958609 ufs_debugfs_hba_exit(hba);85968610 ufshcd_variant_hba_exit(hba);85978611 ufshcd_setup_vreg(hba, false);···94389448 return dma_set_mask_and_coherent(hba->dev, DMA_BIT_MASK(32));94399449}9440945094419441-static struct scsi_transport_template ufshcd_transport_template = {94429442- .eh_strategy_handler = ufshcd_err_handler,94439443-};94449444-94459451/**94469452 * ufshcd_alloc_host - allocate Host Bus Adapter (HBA)94479453 * @dev: pointer to device handle···94649478 err = -ENOMEM;94659479 goto out_error;94669480 }94679467- host->transportt = &ufshcd_transport_template;94689481 hba = shost_priv(host);94699482 hba->host = host;94709483 hba->dev = dev;94719484 hba->dev_ref_clk_freq = REF_CLK_FREQ_INVAL;94859485+ hba->nop_out_timeout = NOP_OUT_TIMEOUT;94729486 INIT_LIST_HEAD(&hba->clk_list_head);94739487 spin_lock_init(&hba->outstanding_lock);94749488···95039517 int err;95049518 struct Scsi_Host *host = hba->host;95059519 struct device *dev = hba->dev;95209520+ char eh_wq_name[sizeof("ufs_eh_wq_00")];9506952195079522 if (!mmio_base) {95089523 dev_err(hba->dev,···9557957095589571 hba->max_pwr_info.is_valid = false;9559957295739573+ /* Initialize work queues */95749574+ snprintf(eh_wq_name, sizeof(eh_wq_name), "ufs_eh_wq_%d",95759575+ hba->host->host_no);95769576+ hba->eh_wq = create_singlethread_workqueue(eh_wq_name);95779577+ if (!hba->eh_wq) {95789578+ dev_err(hba->dev, "%s: failed to create eh workqueue\n",95799579+ __func__);95809580+ err = -ENOMEM;95819581+ goto out_disable;95829582+ }95839583+ INIT_WORK(&hba->eh_work, ufshcd_err_handler);95609584 INIT_WORK(&hba->eeh_work, ufshcd_exception_event_handler);9561958595629586 sema_init(&hba->host_sem, 1);
+5
drivers/scsi/ufs/ufshcd.h
···741741 * @is_powered: flag to check if HBA is powered742742 * @shutting_down: flag to check if shutdown has been invoked743743 * @host_sem: semaphore used to serialize concurrent contexts744744+ * @eh_wq: Workqueue that eh_work works on745745+ * @eh_work: Worker to handle UFS errors that require s/w attention744746 * @eeh_work: Worker to handle exception events745747 * @errors: HBA errors746748 * @uic_error: UFS interconnect layer error status···845843 struct semaphore host_sem;846844847845 /* Work Queues */846846+ struct workqueue_struct *eh_wq;847847+ struct work_struct eh_work;848848 struct work_struct eeh_work;849849850850 /* HBA Errors */···862858 /* Device management request data */863859 struct ufs_dev_cmd dev_cmd;864860 ktime_t last_dme_cmd_tstamp;861861+ int nop_out_timeout;865862866863 /* Keeps information of the UFS device connected to this host */867864 struct ufs_dev_info dev_info;
···416416 USB_SC_UFI, USB_PR_DEVICE, NULL, US_FL_FIX_INQUIRY | US_FL_SINGLE_LUN),417417418418/*419419- * Reported by Ondrej Zary <linux@rainbow-software.org>419419+ * Reported by Ondrej Zary <linux@zary.sk>420420 * The device reports one sector more and breaks when that sector is accessed421421+ * Firmwares older than 2.6c (the latest one and the only that claims Linux422422+ * support) have also broken tag handling421423 */424424+UNUSUAL_DEV( 0x04ce, 0x0002, 0x0000, 0x026b,425425+ "ScanLogic",426426+ "SL11R-IDE",427427+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,428428+ US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG),422429UNUSUAL_DEV( 0x04ce, 0x0002, 0x026c, 0x026c,423430 "ScanLogic",424431 "SL11R-IDE",
+1-1
drivers/usb/storage/unusual_uas.h
···5050 "LaCie",5151 "Rugged USB3-FW",5252 USB_SC_DEVICE, USB_PR_DEVICE, NULL,5353- US_FL_IGNORE_UAS),5353+ US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME),54545555/*5656 * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI
···10771077 */10781078static int afs_d_revalidate_rcu(struct dentry *dentry)10791079{10801080- struct afs_vnode *dvnode, *vnode;10801080+ struct afs_vnode *dvnode;10811081 struct dentry *parent;10821082- struct inode *dir, *inode;10821082+ struct inode *dir;10831083 long dir_version, de_version;1084108410851085 _enter("%p", dentry);···11071107 dir_version = (long)READ_ONCE(dvnode->invalid_before);11081108 if (de_version - dir_version < 0)11091109 return -ECHILD;11101110- }11111111-11121112- /* Check to see if the vnode referred to by the dentry still11131113- * has a callback.11141114- */11151115- if (d_really_is_positive(dentry)) {11161116- inode = d_inode_rcu(dentry);11171117- if (inode) {11181118- vnode = AFS_FS_I(inode);11191119- if (!afs_check_validity(vnode))11201120- return -ECHILD;11211121- }11221110 }1123111111241112 return 1; /* Still valid */···11441156 if (IS_ERR(key))11451157 key = NULL;1146115811471147- if (d_really_is_positive(dentry)) {11481148- inode = d_inode(dentry);11491149- if (inode) {11501150- vnode = AFS_FS_I(inode);11511151- afs_validate(vnode, key);11521152- if (test_bit(AFS_VNODE_DELETED, &vnode->flags))11531153- goto out_bad;11541154- }11551155- }11561156-11571157- /* lock down the parent dentry so we can peer at it */11591159+ /* Hold the parent dentry so we can peer at it */11581160 parent = dget_parent(dentry);11591161 dir = AFS_FS_I(d_inode(parent));11601162···1153117511541176 if (test_bit(AFS_VNODE_DELETED, &dir->flags)) {11551177 _debug("%pd: parent dir deleted", dentry);11561156- goto out_bad_parent;11781178+ goto not_found;11571179 }1158118011591181 /* We only need to invalidate a dentry if the server's copy changed···11791201 case 0:11801202 /* the filename maps to something */11811203 if (d_really_is_negative(dentry))11821182- goto out_bad_parent;12041204+ goto not_found;11831205 inode = d_inode(dentry);11841206 if (is_bad_inode(inode)) {11851207 printk("kAFS: afs_d_revalidate: %pd2 has bad inode\n",11861208 dentry);11871187- goto out_bad_parent;12091209+ goto not_found;11881210 }1189121111901212 vnode = AFS_FS_I(inode);···12061228 dentry, fid.unique,12071229 vnode->fid.unique,12081230 vnode->vfs_inode.i_generation);12091209- write_seqlock(&vnode->cb_lock);12101210- set_bit(AFS_VNODE_DELETED, &vnode->flags);12111211- write_sequnlock(&vnode->cb_lock);12121231 goto not_found;12131232 }12141233 goto out_valid;···12201245 default:12211246 _debug("failed to iterate dir %pd: %d",12221247 parent, ret);12231223- goto out_bad_parent;12481248+ goto not_found;12241249 }1225125012261251out_valid:···12311256 _leave(" = 1 [valid]");12321257 return 1;1233125812341234- /* the dirent, if it exists, now points to a different vnode */12351259not_found:12361236- spin_lock(&dentry->d_lock);12371237- dentry->d_flags |= DCACHE_NFSFS_RENAMED;12381238- spin_unlock(&dentry->d_lock);12391239-12401240-out_bad_parent:12411260 _debug("dropping dentry %pd2", dentry);12421261 dput(parent);12431243-out_bad:12441262 key_put(key);1245126312461264 _leave(" = 0 [bad]");···17601792 goto error;17611793 }1762179417951795+ ret = afs_validate(vnode, op->key);17961796+ if (ret < 0)17971797+ goto error_op;17981798+17631799 afs_op_set_vnode(op, 0, dvnode);17641800 afs_op_set_vnode(op, 1, vnode);17651801 op->file[0].dv_delta = 1;···17771805 op->create.reason = afs_edit_dir_for_link;17781806 return afs_do_sync_operation(op);1779180718081808+error_op:18091809+ afs_put_operation(op);17801810error:17811811 d_drop(dentry);17821812 _leave(" = %d", ret);···19621988 op = afs_alloc_operation(NULL, orig_dvnode->volume);19631989 if (IS_ERR(op))19641990 return PTR_ERR(op);19911991+19921992+ ret = afs_validate(vnode, op->key);19931993+ op->error = ret;19941994+ if (ret < 0)19951995+ goto error;1965199619661997 afs_op_set_vnode(op, 0, orig_dvnode);19671998 afs_op_set_vnode(op, 1, new_dvnode); /* May be same as orig_dvnode */
+2-2
fs/afs/dir_edit.c
···263263 if (b == nr_blocks) {264264 _debug("init %u", b);265265 afs_edit_init_block(meta, block, b);266266- i_size_write(&vnode->vfs_inode, (b + 1) * AFS_DIR_BLOCK_SIZE);266266+ afs_set_i_size(vnode, (b + 1) * AFS_DIR_BLOCK_SIZE);267267 }268268269269 /* Only lower dir pages have a counter in the header. */···296296new_directory:297297 afs_edit_init_block(meta, meta, 0);298298 i_size = AFS_DIR_BLOCK_SIZE;299299- i_size_write(&vnode->vfs_inode, i_size);299299+ afs_set_i_size(vnode, i_size);300300 slot = AFS_DIR_RESV_BLOCKS0;301301 page = page0;302302 block = meta;
···99#include <linux/slab.h>1010#include "afs_fs.h"1111#include "internal.h"1212+#include "protocol_afs.h"1213#include "protocol_yfs.h"13141415static unsigned int afs_fs_probe_fast_poll_interval = 30 * HZ;···103102 struct afs_addr_list *alist = call->alist;104103 struct afs_server *server = call->server;105104 unsigned int index = call->addr_ix;106106- unsigned int rtt_us = 0;105105+ unsigned int rtt_us = 0, cap0;107106 int ret = call->error;108107109108 _enter("%pU,%u", &server->uuid, index);···160159 clear_bit(AFS_SERVER_FL_IS_YFS, &server->flags);161160 alist->addrs[index].srx_service = call->service_id;162161 }162162+ cap0 = ntohl(call->tmp);163163+ if (cap0 & AFS3_VICED_CAPABILITY_64BITFILES)164164+ set_bit(AFS_SERVER_FL_HAS_FS64, &server->flags);165165+ else166166+ clear_bit(AFS_SERVER_FL_HAS_FS64, &server->flags);163167 }164168165169 if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) &&
+20-11
fs/afs/fsclient.c
···456456 struct afs_read *req = op->fetch.req;457457 __be32 *bp;458458459459- if (upper_32_bits(req->pos) ||460460- upper_32_bits(req->len) ||461461- upper_32_bits(req->pos + req->len))459459+ if (test_bit(AFS_SERVER_FL_HAS_FS64, &op->server->flags))462460 return afs_fs_fetch_data64(op);463461464462 _enter("");···11111113 (unsigned long long)op->store.pos,11121114 (unsigned long long)op->store.i_size);1113111511141114- if (upper_32_bits(op->store.pos) ||11151115- upper_32_bits(op->store.size) ||11161116- upper_32_bits(op->store.i_size))11161116+ if (test_bit(AFS_SERVER_FL_HAS_FS64, &op->server->flags))11171117 return afs_fs_store_data64(op);1118111811191119 call = afs_alloc_flat_call(op->net, &afs_RXFSStoreData,···12251229 key_serial(op->key), vp->fid.vid, vp->fid.vnode);1226123012271231 ASSERT(attr->ia_valid & ATTR_SIZE);12281228- if (upper_32_bits(attr->ia_size))12321232+ if (test_bit(AFS_SERVER_FL_HAS_FS64, &op->server->flags))12291233 return afs_fs_setattr_size64(op);1230123412311235 call = afs_alloc_flat_call(op->net, &afs_RXFSStoreData_as_Status,···16531657 return ret;1654165816551659 count = ntohl(call->tmp);16561656-16571660 call->count = count;16581661 call->count2 = count;16591659- afs_extract_discard(call, count * sizeof(__be32));16621662+ if (count == 0) {16631663+ call->unmarshall = 4;16641664+ call->tmp = 0;16651665+ break;16661666+ }16671667+16681668+ /* Extract the first word of the capabilities to call->tmp */16691669+ afs_extract_to_tmp(call);16601670 call->unmarshall++;16611671 fallthrough;1662167216631663- /* Extract capabilities words */16641673 case 2:16651674 ret = afs_extract_data(call, false);16661675 if (ret < 0)16671676 return ret;1668167716691669- /* TODO: Examine capabilities */16781678+ afs_extract_discard(call, (count - 1) * sizeof(__be32));16791679+ call->unmarshall++;16801680+ fallthrough;16811681+16821682+ /* Extract remaining capabilities words */16831683+ case 3:16841684+ ret = afs_extract_data(call, false);16851685+ if (ret < 0)16861686+ return ret;1670168716711688 call->unmarshall++;16721689 break;
+43-55
fs/afs/inode.c
···5454}55555656/*5757- * Set the file size and block count. Estimate the number of 512 bytes blocks5858- * used, rounded up to nearest 1K for consistency with other AFS clients.5959- */6060-static void afs_set_i_size(struct afs_vnode *vnode, u64 size)6161-{6262- i_size_write(&vnode->vfs_inode, size);6363- vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1;6464-}6565-6666-/*6757 * Initialise an inode from the vnode status.6858 */6959static int afs_inode_init_from_status(struct afs_operation *op,···577587}578588579589/*580580- * Get the server reinit counter for a vnode's current server.590590+ * Check to see if we have a server currently serving this volume and that it591591+ * hasn't been reinitialised or dropped from the list.581592 */582582-static bool afs_get_s_break_rcu(struct afs_vnode *vnode, unsigned int *_s_break)593593+static bool afs_check_server_good(struct afs_vnode *vnode)583594{584584- struct afs_server_list *slist = rcu_dereference(vnode->volume->servers);595595+ struct afs_server_list *slist;585596 struct afs_server *server;597597+ bool good;586598 int i;587599600600+ if (vnode->cb_fs_s_break == atomic_read(&vnode->volume->cell->fs_s_break))601601+ return true;602602+603603+ rcu_read_lock();604604+605605+ slist = rcu_dereference(vnode->volume->servers);588606 for (i = 0; i < slist->nr_servers; i++) {589607 server = slist->servers[i].server;590608 if (server == vnode->cb_server) {591591- *_s_break = READ_ONCE(server->cb_s_break);592592- return true;609609+ good = (vnode->cb_s_break == server->cb_s_break);610610+ rcu_read_unlock();611611+ return good;593612 }594613 }595614615615+ rcu_read_unlock();596616 return false;597617}598618···611611 */612612bool afs_check_validity(struct afs_vnode *vnode)613613{614614- struct afs_volume *volume = vnode->volume;615614 enum afs_cb_break_reason need_clear = afs_cb_break_no_break;616615 time64_t now = ktime_get_real_seconds();617617- bool valid;618618- unsigned int cb_break, cb_s_break, cb_v_break;616616+ unsigned int cb_break;619617 int seq = 0;620618621619 do {622620 read_seqbegin_or_lock(&vnode->cb_lock, &seq);623623- cb_v_break = READ_ONCE(volume->cb_v_break);624621 cb_break = vnode->cb_break;625622626626- if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags) &&627627- afs_get_s_break_rcu(vnode, &cb_s_break)) {628628- if (vnode->cb_s_break != cb_s_break ||629629- vnode->cb_v_break != cb_v_break) {630630- vnode->cb_s_break = cb_s_break;631631- vnode->cb_v_break = cb_v_break;632632- need_clear = afs_cb_break_for_vsbreak;633633- valid = false;634634- } else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags)) {623623+ if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {624624+ if (vnode->cb_v_break != vnode->volume->cb_v_break)625625+ need_clear = afs_cb_break_for_v_break;626626+ else if (!afs_check_server_good(vnode))627627+ need_clear = afs_cb_break_for_s_reinit;628628+ else if (test_bit(AFS_VNODE_ZAP_DATA, &vnode->flags))635629 need_clear = afs_cb_break_for_zap;636636- valid = false;637637- } else if (vnode->cb_expires_at - 10 <= now) {630630+ else if (vnode->cb_expires_at - 10 <= now)638631 need_clear = afs_cb_break_for_lapsed;639639- valid = false;640640- } else {641641- valid = true;642642- }643632 } else if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) {644644- valid = true;633633+ ;645634 } else {646646- vnode->cb_v_break = cb_v_break;647647- valid = false;635635+ need_clear = afs_cb_break_no_promise;648636 }649637650638 } while (need_seqretry(&vnode->cb_lock, seq));651639652640 done_seqretry(&vnode->cb_lock, seq);653641654654- if (need_clear != afs_cb_break_no_break) {655655- write_seqlock(&vnode->cb_lock);656656- if (cb_break == vnode->cb_break)657657- __afs_break_callback(vnode, need_clear);658658- else659659- trace_afs_cb_miss(&vnode->fid, need_clear);660660- write_sequnlock(&vnode->cb_lock);661661- valid = false;662662- }642642+ if (need_clear == afs_cb_break_no_break)643643+ return true;663644664664- return valid;645645+ write_seqlock(&vnode->cb_lock);646646+ if (need_clear == afs_cb_break_no_promise)647647+ vnode->cb_v_break = vnode->volume->cb_v_break;648648+ else if (cb_break == vnode->cb_break)649649+ __afs_break_callback(vnode, need_clear);650650+ else651651+ trace_afs_cb_miss(&vnode->fid, need_clear);652652+ write_sequnlock(&vnode->cb_lock);653653+ return false;665654}666655667656/*···664675 */665676int afs_validate(struct afs_vnode *vnode, struct key *key)666677{667667- bool valid;668678 int ret;669679670680 _enter("{v={%llx:%llu} fl=%lx},%x",671681 vnode->fid.vid, vnode->fid.vnode, vnode->flags,672682 key_serial(key));673683674674- rcu_read_lock();675675- valid = afs_check_validity(vnode);676676- rcu_read_unlock();684684+ if (unlikely(test_bit(AFS_VNODE_DELETED, &vnode->flags))) {685685+ if (vnode->vfs_inode.i_nlink)686686+ clear_nlink(&vnode->vfs_inode);687687+ goto valid;688688+ }677689678678- if (test_bit(AFS_VNODE_DELETED, &vnode->flags))679679- clear_nlink(&vnode->vfs_inode);680680-681681- if (valid)690690+ if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags) &&691691+ afs_check_validity(vnode))682692 goto valid;683693684694 down_write(&vnode->validate_lock);
+21
fs/afs/internal.h
···390390 /* Active fileserver interaction state. */391391 struct rb_root fs_servers; /* afs_server (by server UUID) */392392 seqlock_t fs_lock; /* For fs_servers */393393+ struct rw_semaphore fs_open_mmaps_lock;394394+ struct list_head fs_open_mmaps; /* List of vnodes that are mmapped */395395+ atomic_t fs_s_break; /* Counter of CB.InitCallBackState messages */393396394397 /* VL server list. */395398 rwlock_t vl_servers_lock; /* Lock on vl_servers */···506503 struct hlist_node addr4_link; /* Link in net->fs_addresses4 */507504 struct hlist_node addr6_link; /* Link in net->fs_addresses6 */508505 struct hlist_node proc_link; /* Link in net->fs_proc */506506+ struct work_struct initcb_work; /* Work for CB.InitCallBackState* */509507 struct afs_server *gc_next; /* Next server in manager's list */510508 time64_t unuse_time; /* Time at which last unused */511509 unsigned long flags;···520516#define AFS_SERVER_FL_IS_YFS 16 /* Server is YFS not AFS */521517#define AFS_SERVER_FL_NO_IBULK 17 /* Fileserver doesn't support FS.InlineBulkStatus */522518#define AFS_SERVER_FL_NO_RM2 18 /* Fileserver doesn't support YFS.RemoveFile2 */519519+#define AFS_SERVER_FL_HAS_FS64 19 /* Fileserver supports FS.{Fetch,Store}Data64 */523520 atomic_t ref; /* Object refcount */524521 atomic_t active; /* Active user count */525522 u32 addr_version; /* Address list version */···662657 afs_lock_type_t lock_type : 8;663658664659 /* outstanding callback notification on this file */660660+ struct work_struct cb_work; /* Work for mmap'd files */661661+ struct list_head cb_mmap_link; /* Link in cell->fs_open_mmaps */665662 void *cb_server; /* Server with callback/filelock */663663+ atomic_t cb_nr_mmap; /* Number of mmaps */664664+ unsigned int cb_fs_s_break; /* Mass server break counter (cell->fs_s_break) */666665 unsigned int cb_s_break; /* Mass break counter on ->server */667666 unsigned int cb_v_break; /* Mass break counter on ->volume */668667 unsigned int cb_break; /* Break counter on vnode */···974965/*975966 * callback.c976967 */968968+extern void afs_invalidate_mmap_work(struct work_struct *);969969+extern void afs_server_init_callback_work(struct work_struct *work);977970extern void afs_init_callback_state(struct afs_server *);978971extern void __afs_break_callback(struct afs_vnode *, enum afs_cb_break_reason);979972extern void afs_break_callback(struct afs_vnode *, enum afs_cb_break_reason);···15941583 if (!op->error)15951584 dentry->d_fsdata =15961585 (void *)(unsigned long)dir_vp->scb.status.data_version;15861586+}15871587+15881588+/*15891589+ * Set the file size and block count. Estimate the number of 512 bytes blocks15901590+ * used, rounded up to nearest 1K for consistency with other AFS clients.15911591+ */15921592+static inline void afs_set_i_size(struct afs_vnode *vnode, u64 size)15931593+{15941594+ i_size_write(&vnode->vfs_inode, size);15951595+ vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1;15971596}1598159715991598/*
+15
fs/afs/protocol_afs.h
···11+/* SPDX-License-Identifier: GPL-2.0-or-later */22+/* AFS protocol bits33+ *44+ * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.55+ * Written by David Howells (dhowells@redhat.com)66+ */77+88+99+#define AFSCAPABILITIESMAX 196 /* Maximum number of words in a capability set */1010+1111+/* AFS3 Fileserver capabilities word 0 */1212+#define AFS3_VICED_CAPABILITY_ERRORTRANS 0x0001 /* Uses UAE errors */1313+#define AFS3_VICED_CAPABILITY_64BITFILES 0x0002 /* FetchData64 & StoreData64 supported */1414+#define AFS3_VICED_CAPABILITY_WRITELOCKACL 0x0004 /* Can lock a file even without lock perm */1515+#define AFS3_VICED_CAPABILITY_SANEACLS 0x0008 /* ACLs reviewed for sanity - don't use */
···137137 write_seqlock(&vnode->cb_lock);138138 i_size = i_size_read(&vnode->vfs_inode);139139 if (maybe_i_size > i_size)140140- i_size_write(&vnode->vfs_inode, maybe_i_size);140140+ afs_set_i_size(vnode, maybe_i_size);141141 write_sequnlock(&vnode->cb_lock);142142 }143143···471471 }472472473473 /* Has the page moved or been split? */474474- if (unlikely(page != xas_reload(&xas)))474474+ if (unlikely(page != xas_reload(&xas))) {475475+ put_page(page);475476 break;477477+ }476478477477- if (!trylock_page(page))479479+ if (!trylock_page(page)) {480480+ put_page(page);478481 break;482482+ }479483 if (!PageDirty(page) || PageWriteback(page)) {480484 unlock_page(page);485485+ put_page(page);481486 break;482487 }483488···492487 t = afs_page_dirty_to(page, priv);493488 if (f != 0 && !new_content) {494489 unlock_page(page);490490+ put_page(page);495491 break;496492 }497493···807801ssize_t afs_file_write(struct kiocb *iocb, struct iov_iter *from)808802{809803 struct afs_vnode *vnode = AFS_FS_I(file_inode(iocb->ki_filp));804804+ struct afs_file *af = iocb->ki_filp->private_data;810805 ssize_t result;811806 size_t count = iov_iter_count(from);812807···823816 if (!count)824817 return 0;825818819819+ result = afs_validate(vnode, af->key);820820+ if (result < 0)821821+ return result;822822+826823 result = generic_file_write_iter(iocb, from);827824828825 _leave(" = %zd", result);···840829 */841830int afs_fsync(struct file *file, loff_t start, loff_t end, int datasync)842831{843843- struct inode *inode = file_inode(file);844844- struct afs_vnode *vnode = AFS_FS_I(inode);832832+ struct afs_vnode *vnode = AFS_FS_I(file_inode(file));833833+ struct afs_file *af = file->private_data;834834+ int ret;845835846836 _enter("{%llx:%llu},{n=%pD},%d",847837 vnode->fid.vid, vnode->fid.vnode, file,848838 datasync);839839+840840+ ret = afs_validate(vnode, af->key);841841+ if (ret < 0)842842+ return ret;849843850844 return file_write_and_wait_range(file, start, end);851845}···865849 struct file *file = vmf->vma->vm_file;866850 struct inode *inode = file_inode(file);867851 struct afs_vnode *vnode = AFS_FS_I(inode);852852+ struct afs_file *af = file->private_data;868853 unsigned long priv;869854 vm_fault_t ret = VM_FAULT_RETRY;870855871856 _enter("{{%llx:%llu}},{%lx}", vnode->fid.vid, vnode->fid.vnode, page->index);857857+858858+ afs_validate(vnode, af->key);872859873860 sb_start_pagefault(inode->i_sb);874861
+12-1
fs/btrfs/file-item.c
···665665666666 if (!ordered) {667667 ordered = btrfs_lookup_ordered_extent(inode, offset);668668- BUG_ON(!ordered); /* Logic error */668668+ /*669669+ * The bio range is not covered by any ordered extent,670670+ * must be a code logic error.671671+ */672672+ if (unlikely(!ordered)) {673673+ WARN(1, KERN_WARNING674674+ "no ordered extent for root %llu ino %llu offset %llu\n",675675+ inode->root->root_key.objectid,676676+ btrfs_ino(inode), offset);677677+ kvfree(sums);678678+ return BLK_STS_IOERR;679679+ }669680 }670681671682 nr_sectors = BTRFS_BYTES_TO_BLKS(fs_info,
+3-2
fs/btrfs/space-info.c
···414414{415415 lockdep_assert_held(&info->lock);416416417417- btrfs_info(fs_info, "space_info %llu has %llu free, is %sfull",417417+ /* The free space could be negative in case of overcommit */418418+ btrfs_info(fs_info, "space_info %llu has %lld free, is %sfull",418419 info->flags,419419- info->total_bytes - btrfs_space_info_used(info, true),420420+ (s64)(info->total_bytes - btrfs_space_info_used(info, true)),420421 info->full ? "" : "not ");421422 btrfs_info(fs_info,422423 "space_info total=%llu, used=%llu, pinned=%llu, reserved=%llu, may_use=%llu, readonly=%llu zone_unusable=%llu",
+4-2
fs/btrfs/verity.c
···451451 */452452static int rollback_verity(struct btrfs_inode *inode)453453{454454- struct btrfs_trans_handle *trans;454454+ struct btrfs_trans_handle *trans = NULL;455455 struct btrfs_root *root = inode->root;456456 int ret;457457···473473 trans = btrfs_start_transaction(root, 2);474474 if (IS_ERR(trans)) {475475 ret = PTR_ERR(trans);476476+ trans = NULL;476477 btrfs_handle_fs_error(root->fs_info, ret,477478 "failed to start transaction in verity rollback %llu",478479 (u64)inode->vfs_inode.i_ino);···491490 btrfs_abort_transaction(trans, ret);492491 goto out;493492 }494494- btrfs_end_transaction(trans);495493out:494494+ if (trans)495495+ btrfs_end_transaction(trans);496496 return ret;497497}498498
+13
fs/btrfs/volumes.c
···11371137 atomic_set(&device->dev_stats_ccnt, 0);11381138 extent_io_tree_release(&device->alloc_state);1139113911401140+ /*11411141+ * Reset the flush error record. We might have a transient flush error11421142+ * in this mount, and if so we aborted the current transaction and set11431143+ * the fs to an error state, guaranteeing no super blocks can be further11441144+ * committed. However that error might be transient and if we unmount the11451145+ * filesystem and mount it again, we should allow the mount to succeed11461146+ * (btrfs_check_rw_degradable() should not fail) - if after mounting the11471147+ * filesystem again we still get flush errors, then we will again abort11481148+ * any transaction and set the error state, guaranteeing no commits of11491149+ * unsafe super blocks.11501150+ */11511151+ device->last_flush_error = 0;11521152+11401153 /* Verify the device is back in a pristine state */11411154 ASSERT(!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state));11421155 ASSERT(!test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state));
+6-2
fs/buffer.c
···14251425}14261426EXPORT_SYMBOL_GPL(invalidate_bh_lrus);1427142714281428-void invalidate_bh_lrus_cpu(int cpu)14281428+/*14291429+ * It's called from workqueue context so we need a bh_lru_lock to close14301430+ * the race with preemption/irq.14311431+ */14321432+void invalidate_bh_lrus_cpu(void)14291433{14301434 struct bh_lru *b;1431143514321436 bh_lru_lock();14331433- b = per_cpu_ptr(&bh_lrus, cpu);14371437+ b = this_cpu_ptr(&bh_lrus);14341438 __invalidate_bh_lrus(b);14351439 bh_lru_unlock();14361440}
+2-2
fs/ceph/caps.c
···22632263 list_for_each_entry(req, &ci->i_unsafe_dirops,22642264 r_unsafe_dir_item) {22652265 s = req->r_session;22662266- if (unlikely(s->s_mds > max)) {22662266+ if (unlikely(s->s_mds >= max)) {22672267 spin_unlock(&ci->i_unsafe_lock);22682268 goto retry;22692269 }···22772277 list_for_each_entry(req, &ci->i_unsafe_iops,22782278 r_unsafe_target_item) {22792279 s = req->r_session;22802280- if (unlikely(s->s_mds > max)) {22802280+ if (unlikely(s->s_mds >= max)) {22812281 spin_unlock(&ci->i_unsafe_lock);22822282 goto retry;22832283 }
···11// SPDX-License-Identifier: GPL-2.0-or-later22/*33- * fs/cifs_debug.c43 *54 * Copyright (C) International Business Machines Corp., 2000,200565 *
-1
fs/cifs/cifs_fs_sb.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/cifs_fs_sb.h43 *54 * Copyright (c) International Business Machines Corp., 2002,200465 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/cifs_ioctl.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/cifs_ioctl.h43 *54 * Structure definitions for io control for cifs/smb365 *
+1-1
fs/cifs/cifs_spnego.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/cifs_spnego.c -- SPNEGO upcall management for CIFS33+ * SPNEGO upcall management for CIFS44 *55 * Copyright (c) 2007 Red Hat, Inc.66 * Author(s): Jeff Layton (jlayton@redhat.com)
+1-1
fs/cifs/cifs_spnego.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/cifs_spnego.h -- SPNEGO upcall management for CIFS33+ * SPNEGO upcall management for CIFS44 *55 * Copyright (c) 2007 Red Hat, Inc.66 * Author(s): Jeff Layton (jlayton@redhat.com)
-1
fs/cifs/cifs_unicode.c
···11// SPDX-License-Identifier: GPL-2.0-or-later22/*33- * fs/cifs/cifs_unicode.c43 *54 * Copyright (c) International Business Machines Corp., 2000,200965 * Modified by Steve French (sfrench@us.ibm.com)
-1
fs/cifs/cifsacl.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/cifsacl.c43 *54 * Copyright (C) International Business Machines Corp., 2007,200865 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/cifsacl.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/cifsacl.h43 *54 * Copyright (c) International Business Machines Corp., 200765 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/cifsencrypt.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/cifsencrypt.c43 *54 * Encryption and hashing operations relating to NTLM, NTLMv2. See MS-NLMP65 * for more detailed information
-1
fs/cifs/cifsfs.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/cifsfs.c43 *54 * Copyright (C) International Business Machines Corp., 2002,200865 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/cifsfs.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/cifsfs.h43 *54 * Copyright (c) International Business Machines Corp., 2002, 200765 * Author(s): Steve French (sfrench@us.ibm.com)
+1-1
fs/cifs/cifsglob.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/cifsglob.h43 *54 * Copyright (C) International Business Machines Corp., 2002,200865 * Author(s): Steve French (sfrench@us.ibm.com)···13991400#define CIFS_INO_INVALID_MAPPING (4) /* pagecache is invalid */14001401#define CIFS_INO_LOCK (5) /* lock bit for synchronization */14011402#define CIFS_INO_MODIFIED_ATTR (6) /* Indicate change in mtime/ctime */14031403+#define CIFS_INO_CLOSE_ON_LOCK (7) /* Not to defer the close when lock is set */14021404 unsigned long flags;14031405 spinlock_t writers_lock;14041406 unsigned int writers; /* Number of writers on this inode */
-1
fs/cifs/cifspdu.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/cifspdu.h43 *54 * Copyright (c) International Business Machines Corp., 2002,200965 * Author(s): Steve French (sfrench@us.ibm.com)
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/cifssmb.c43 *54 * Copyright (C) International Business Machines Corp., 2002,201065 * Author(s): Steve French (sfrench@us.ibm.com)
+13-5
fs/cifs/connect.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/connect.c43 *54 * Copyright (C) International Business Machines Corp., 2002,201165 * Author(s): Steve French (sfrench@us.ibm.com)···10891090 module_put_and_exit(0);10901091}1091109210921092-/**10931093+/*10931094 * Returns true if srcaddr isn't specified and rhs isn't specified, or10941095 * if srcaddr is specified and matches the IP address of the rhs argument10951096 */···1549155015501551/**15511552 * cifs_setup_ipc - helper to setup the IPC tcon for the session15531553+ * @ses: smb session to issue the request on15541554+ * @ctx: the superblock configuration context to use for building the15551555+ * new tree connection for the IPC (interprocess communication RPC)15521556 *15531557 * A new IPC connection is made and stored in the session15541558 * tcon_ipc. The IPC tcon has the same lifetime as the session.···1607160516081606/**16091607 * cifs_free_ipc - helper to release the session IPC tcon16081608+ * @ses: smb session to unmount the IPC from16101609 *16111610 * Needs to be called everytime a session is destroyed.16121611 *···1858185518591856/**18601857 * cifs_get_smb_ses - get a session matching @ctx data from @server18581858+ * @server: server to setup the session to18591859+ * @ctx: superblock configuration context to use to setup the session18611860 *18621861 * This function assumes it is being called from cifs_mount() where we18631862 * already got a server reference (server refcount +1). See···2070206520712066/**20722067 * cifs_get_tcon - get a tcon matching @ctx data from @ses20682068+ * @ses: smb session to issue the request on20692069+ * @ctx: the superblock configuration context to use for building the20732070 *20742071 * - tcon refcount is the number of mount points using the tcon.20752072 * - ses refcount is the number of tcon using the session.···23892382 spin_lock(&cifs_tcp_ses_lock);23902383 cifs_sb = CIFS_SB(sb);23912384 tlink = cifs_get_tlink(cifs_sb_master_tlink(cifs_sb));23922392- if (IS_ERR(tlink)) {23852385+ if (tlink == NULL) {23862386+ /* can not match superblock if tlink were ever null */23932387 spin_unlock(&cifs_tcp_ses_lock);23942394- return rc;23882388+ return 0;23952389 }23962390 tcon = tlink_tcon(tlink);23972391 ses = tcon->ses;···30383030 return full_path;30393031}3040303230413041-/**30333033+/*30423034 * expand_dfs_referral - Perform a dfs referral query and update the cifs_sb30433035 *30443036 * If a referral is found, cifs_sb->ctx->mount_options will be (re-)allocated
-1
fs/cifs/dir.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/dir.c43 *54 * vfs operations that deal with dentries65 *
-1
fs/cifs/dns_resolve.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/dns_resolve.c43 *54 * Copyright (c) 2007 Igor Mammedov65 * Author(s): Igor Mammedov (niallain@gmail.com)
+2-2
fs/cifs/dns_resolve.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/dns_resolve.h -- DNS Resolver upcall management for CIFS DFS44- * Handles host name to IP address resolution33+ * DNS Resolver upcall management for CIFS DFS44+ * Handles host name to IP address resolution55 *66 * Copyright (c) International Business Machines Corp., 200877 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/export.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/export.c43 *54 * Copyright (C) International Business Machines Corp., 200765 * Author(s): Steve French (sfrench@us.ibm.com)
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/inode.c43 *54 * Copyright (C) International Business Machines Corp., 2002,201065 * Author(s): Steve French (sfrench@us.ibm.com)···16241625 goto unlink_out;16251626 }1626162716271627- cifs_close_deferred_file(CIFS_I(inode));16281628+ cifs_close_deferred_file_under_dentry(tcon, full_path);16281629 if (cap_unix(tcon->ses) && (CIFS_UNIX_POSIX_PATH_OPS_CAP &16291630 le64_to_cpu(tcon->fsUnixInfo.Capability))) {16301631 rc = CIFSPOSIXDelFile(xid, tcon, full_path,···21132114 goto cifs_rename_exit;21142115 }2115211621162116- cifs_close_deferred_file(CIFS_I(d_inode(source_dentry)));21172117+ cifs_close_deferred_file_under_dentry(tcon, from_name);21172118 if (d_inode(target_dentry) != NULL)21182118- cifs_close_deferred_file(CIFS_I(d_inode(target_dentry)));21192119+ cifs_close_deferred_file_under_dentry(tcon, to_name);2119212021202121 rc = cifs_do_rename(xid, source_dentry, from_name, target_dentry,21212122 to_name);
+1-2
fs/cifs/ioctl.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/ioctl.c43 *54 * vfs operations that deal with io control65 *···358359 if (pSMBFile == NULL)359360 break;360361 tcon = tlink_tcon(pSMBFile->tlink);361361- caps = le64_to_cpu(tcon->fsUnixInfo.Capability);362362+ /* caps = le64_to_cpu(tcon->fsUnixInfo.Capability); */362363363364 if (get_user(ExtAttrBits, (int __user *)arg)) {364365 rc = -EFAULT;
-1
fs/cifs/link.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/link.c43 *54 * Copyright (C) International Business Machines Corp., 2002,200865 * Author(s): Steve French (sfrench@us.ibm.com)
+53-6
fs/cifs/misc.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/misc.c43 *54 * Copyright (C) International Business Machines Corp., 2002,200865 * Author(s): Steve French (sfrench@us.ibm.com)···264265265266 /* Uid is not converted */266267 buffer->Uid = treeCon->ses->Suid;267267- buffer->Mid = get_next_mid(treeCon->ses->server);268268+ if (treeCon->ses->server)269269+ buffer->Mid = get_next_mid(treeCon->ses->server);268270 }269271 if (treeCon->Flags & SMB_SHARE_IS_IN_DFS)270272 buffer->Flags2 |= SMBFLG2_DFS;···591591592592/**593593 * cifs_queue_oplock_break - queue the oplock break handler for cfile594594+ * @cfile: The file to break the oplock on594595 *595596 * This function is called from the demultiplex thread when it596597 * receives an oplock break for @cfile.···737736 if (cancel_delayed_work(&cfile->deferred)) {738737 tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC);739738 if (tmp_list == NULL)740740- continue;739739+ break;741740 tmp_list->cfile = cfile;742741 list_add_tail(&tmp_list->list, &file_head);743742 }···768767 if (cancel_delayed_work(&cfile->deferred)) {769768 tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC);770769 if (tmp_list == NULL)771771- continue;770770+ break;772771 tmp_list->cfile = cfile;773772 list_add_tail(&tmp_list->list, &file_head);774773 }···781780 list_del(&tmp_list->list);782781 kfree(tmp_list);783782 }783783+}784784+void785785+cifs_close_deferred_file_under_dentry(struct cifs_tcon *tcon, const char *path)786786+{787787+ struct cifsFileInfo *cfile;788788+ struct list_head *tmp;789789+ struct file_list *tmp_list, *tmp_next_list;790790+ struct list_head file_head;791791+ void *page;792792+ const char *full_path;793793+794794+ INIT_LIST_HEAD(&file_head);795795+ page = alloc_dentry_path();796796+ spin_lock(&tcon->open_file_lock);797797+ list_for_each(tmp, &tcon->openFileList) {798798+ cfile = list_entry(tmp, struct cifsFileInfo, tlist);799799+ full_path = build_path_from_dentry(cfile->dentry, page);800800+ if (strstr(full_path, path)) {801801+ if (delayed_work_pending(&cfile->deferred)) {802802+ if (cancel_delayed_work(&cfile->deferred)) {803803+ tmp_list = kmalloc(sizeof(struct file_list), GFP_ATOMIC);804804+ if (tmp_list == NULL)805805+ break;806806+ tmp_list->cfile = cfile;807807+ list_add_tail(&tmp_list->list, &file_head);808808+ }809809+ }810810+ }811811+ }812812+ spin_unlock(&tcon->open_file_lock);813813+814814+ list_for_each_entry_safe(tmp_list, tmp_next_list, &file_head, list) {815815+ _cifsFileInfo_put(tmp_list->cfile, true, false);816816+ list_del(&tmp_list->list);817817+ kfree(tmp_list);818818+ }819819+ free_dentry_path(page);784820}785821786822/* parses DFS refferal V3 structure···1067102910681030/**10691031 * cifs_alloc_hash - allocate hash and hash context together10321032+ * @name: The name of the crypto hash algo10331033+ * @shash: Where to put the pointer to the hash algo10341034+ * @sdesc: Where to put the pointer to the hash descriptor10701035 *10711036 * The caller has to make sure @sdesc is initialized to either NULL or10721037 * a valid context. Both can be freed via cifs_free_hash().···1108106711091068/**11101069 * cifs_free_hash - free hash and hash context together10701070+ * @shash: Where to find the pointer to the hash algo10711071+ * @sdesc: Where to find the pointer to the hash descriptor11111072 *11121073 * Freeing a NULL hash or context is safe.11131074 */···1125108211261083/**11271084 * rqst_page_get_length - obtain the length and offset for a page in smb_rqst11281128- * Input: rqst - a smb_rqst, page - a page index for rqst11291129- * Output: *len - the length for this page, *offset - the offset for this page10851085+ * @rqst: The request descriptor10861086+ * @page: The index of the page to query10871087+ * @len: Where to store the length for this page:10881088+ * @offset: Where to store the offset for this page11301089 */11311090void rqst_page_get_length(struct smb_rqst *rqst, unsigned int page,11321091 unsigned int *len, unsigned int *offset)···1161111611621117/**11631118 * copy_path_name - copy src path to dst, possibly truncating11191119+ * @dst: The destination buffer11201120+ * @src: The source name11641121 *11651122 * returns number of bytes written (including trailing nul)11661123 */
-1
fs/cifs/netmisc.c
···11// SPDX-License-Identifier: GPL-2.0-or-later22/*33- * fs/cifs/netmisc.c43 *54 * Copyright (c) International Business Machines Corp., 2002,200865 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/ntlmssp.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/ntlmssp.h43 *54 * Copyright (c) International Business Machines Corp., 2002,200765 * Author(s): Steve French (sfrench@us.ibm.com)
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/smb2file.c43 *54 * Copyright (C) International Business Machines Corp., 2002, 201165 * Author(s): Steve French (sfrench@us.ibm.com),
-1
fs/cifs/smb2glob.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/smb2glob.h43 *54 * Definitions for various global variables and structures65 *
-1
fs/cifs/smb2inode.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/smb2inode.c43 *54 * Copyright (C) International Business Machines Corp., 2002, 201165 * Etersoft, 2012
-1
fs/cifs/smb2misc.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/smb2misc.c43 *54 * Copyright (C) International Business Machines Corp., 2002,201165 * Etersoft, 2012
+2-3
fs/cifs/smb2pdu.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/smb2pdu.c43 *54 * Copyright (C) International Business Machines Corp., 2009, 201365 * Etersoft, 2012···23972398 buf->sd.OffsetDacl = cpu_to_le32(ptr - (__u8 *)&buf->sd);23982399 /* Ship the ACL for now. we will copy it into buf later. */23992400 aclptr = ptr;24002400- ptr += sizeof(struct cifs_acl);24012401+ ptr += sizeof(struct smb3_acl);2401240224022403 /* create one ACE to hold the mode embedded in reserved special SID */24032404 acelen = setup_special_mode_ACE((struct cifs_ace *)ptr, (__u64)mode);···24222423 acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */24232424 acl.AclSize = cpu_to_le16(acl_size);24242425 acl.AceCount = cpu_to_le16(ace_count);24252425- memcpy(aclptr, &acl, sizeof(struct cifs_acl));24262426+ memcpy(aclptr, &acl, sizeof(struct smb3_acl));2426242724272428 buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd);24282429 *len = roundup(ptr - (__u8 *)buf, 8);
-1
fs/cifs/smb2pdu.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/smb2pdu.h43 *54 * Copyright (c) International Business Machines Corp., 2009, 201365 * Etersoft, 2012
-1
fs/cifs/smb2proto.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/smb2proto.h43 *54 * Copyright (c) International Business Machines Corp., 2002, 201165 * Etersoft, 2012
-1
fs/cifs/smb2status.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/smb2status.h43 *54 * SMB2 Status code (network error) definitions65 * Definitions are from MS-ERREF
-1
fs/cifs/smb2transport.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/smb2transport.c43 *54 * Copyright (C) International Business Machines Corp., 2002, 201165 * Etersoft, 2012
-1
fs/cifs/smberr.h
···11/* SPDX-License-Identifier: LGPL-2.1 */22/*33- * fs/cifs/smberr.h43 *54 * Copyright (c) International Business Machines Corp., 2002,200465 * Author(s): Steve French (sfrench@us.ibm.com)
-1
fs/cifs/transport.c
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/transport.c43 *54 * Copyright (C) International Business Machines Corp., 2002,200865 * Author(s): Steve French (sfrench@us.ibm.com)
···11// SPDX-License-Identifier: LGPL-2.122/*33- * fs/cifs/xattr.c43 *54 * Copyright (c) International Business Machines Corp., 2003, 200765 * Author(s): Steve French (sfrench@us.ibm.com)
+1-1
fs/erofs/inode.c
···176176 }177177178178 if (vi->datalayout == EROFS_INODE_CHUNK_BASED) {179179- if (!(vi->chunkformat & EROFS_CHUNK_FORMAT_ALL)) {179179+ if (vi->chunkformat & ~EROFS_CHUNK_FORMAT_ALL) {180180 erofs_err(inode->i_sb,181181 "unsupported chunk format %x of nid %llu",182182 vi->chunkformat, vi->nid);
···584584585585 if (!get_signal(&ksig))586586 continue;587587- if (fatal_signal_pending(current))587587+ if (fatal_signal_pending(current) ||588588+ signal_group_exit(current->signal))588589 break;589590 continue;590591 }
+70-15
fs/io_uring.c
···502502struct io_close {503503 struct file *file;504504 int fd;505505+ u32 file_slot;505506};506507507508struct io_timeout_data {···1099109811001099static int io_install_fixed_file(struct io_kiocb *req, struct file *file,11011100 unsigned int issue_flags, u32 slot_index);11011101+static int io_close_fixed(struct io_kiocb *req, unsigned int issue_flags);11021102+11021103static enum hrtimer_restart io_link_timeout_fn(struct hrtimer *timer);1103110411041105static struct kmem_cache *req_cachep;···36083605 iov_iter_save_state(iter, state);36093606 }36103607 req->result = iov_iter_count(iter);36113611- ret2 = 0;3612360836133609 /* Ensure we clear previously set non-block flag */36143610 if (!force_nonblock)···36723670 } else {36733671copy_iov:36743672 iov_iter_restore(iter, state);36753675- if (ret2 > 0)36763676- iov_iter_advance(iter, ret2);36773673 ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false);36783674 return ret ?: -EAGAIN;36793675 }···43874387 int i, bid = pbuf->bid;4388438843894389 for (i = 0; i < pbuf->nbufs; i++) {43904390- buf = kmalloc(sizeof(*buf), GFP_KERNEL);43904390+ buf = kmalloc(sizeof(*buf), GFP_KERNEL_ACCOUNT);43914391 if (!buf)43924392 break;43934393···45944594 if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))45954595 return -EINVAL;45964596 if (sqe->ioprio || sqe->off || sqe->addr || sqe->len ||45974597- sqe->rw_flags || sqe->buf_index || sqe->splice_fd_in)45974597+ sqe->rw_flags || sqe->buf_index)45984598 return -EINVAL;45994599 if (req->flags & REQ_F_FIXED_FILE)46004600 return -EBADF;4601460146024602 req->close.fd = READ_ONCE(sqe->fd);46034603+ req->close.file_slot = READ_ONCE(sqe->file_index);46044604+ if (req->close.file_slot && req->close.fd)46054605+ return -EINVAL;46064606+46034607 return 0;46044608}46054609···46144610 struct fdtable *fdt;46154611 struct file *file = NULL;46164612 int ret = -EBADF;46134613+46144614+ if (req->close.file_slot) {46154615+ ret = io_close_fixed(req, issue_flags);46164616+ goto err;46174617+ }4617461846184619 spin_lock(&files->file_lock);46194620 fdt = files_fdtable(files);···53475338 if (req->poll.events & EPOLLONESHOT)53485339 flags = 0;53495340 if (!io_cqring_fill_event(ctx, req->user_data, error, flags)) {53505350- req->poll.done = true;53415341+ req->poll.events |= EPOLLONESHOT;53515342 flags = 0;53525343 }53535344 if (flags & IORING_CQE_F_MORE)···53765367 } else {53775368 bool done;5378536953705370+ if (req->poll.done) {53715371+ spin_unlock(&ctx->completion_lock);53725372+ return;53735373+ }53795374 done = __io_poll_complete(req, req->result);53805375 if (done) {53815376 io_poll_remove_double(req);53825377 hash_del(&req->hash_node);53785378+ req->poll.done = true;53835379 } else {53845380 req->result = 0;53855381 add_wait_queue(req->poll.head, &req->poll.wait);···5522550855235509 hash_del(&req->hash_node);55245510 io_poll_remove_double(req);55115511+ apoll->poll.done = true;55255512 spin_unlock(&ctx->completion_lock);5526551355275514 if (!READ_ONCE(apoll->poll.canceled))···58435828 struct io_ring_ctx *ctx = req->ctx;58445829 struct io_poll_table ipt;58455830 __poll_t mask;58315831+ bool done;5846583258475833 ipt.pt._qproc = io_poll_queue_proc;58485834···5852583658535837 if (mask) { /* no async, we'd stolen it */58545838 ipt.error = 0;58555855- io_poll_complete(req, mask);58395839+ done = io_poll_complete(req, mask);58565840 }58575841 spin_unlock(&ctx->completion_lock);5858584258595843 if (mask) {58605844 io_cqring_ev_posted(ctx);58615861- if (poll->events & EPOLLONESHOT)58455845+ if (done)58625846 io_put_req(req);58635847 }58645848 return ipt.error;···63496333 struct io_uring_rsrc_update2 up;63506334 int ret;6351633563526352- if (issue_flags & IO_URING_F_NONBLOCK)63536353- return -EAGAIN;63546354-63556336 up.offset = req->rsrc_update.offset;63566337 up.data = req->rsrc_update.arg;63576338 up.nr = 0;63586339 up.tags = 0;63596340 up.resv = 0;6360634163616361- mutex_lock(&ctx->uring_lock);63426342+ io_ring_submit_lock(ctx, !(issue_flags & IO_URING_F_NONBLOCK));63626343 ret = __io_register_rsrc_update(ctx, IORING_RSRC_FILE,63636344 &up, req->rsrc_update.nr_args);63646364- mutex_unlock(&ctx->uring_lock);63456345+ io_ring_submit_unlock(ctx, !(issue_flags & IO_URING_F_NONBLOCK));6365634663666347 if (ret < 0)63676348 req_set_fail(req);···84138400 return ret;84148401}8415840284038403+static int io_close_fixed(struct io_kiocb *req, unsigned int issue_flags)84048404+{84058405+ unsigned int offset = req->close.file_slot - 1;84068406+ struct io_ring_ctx *ctx = req->ctx;84078407+ struct io_fixed_file *file_slot;84088408+ struct file *file;84098409+ int ret, i;84108410+84118411+ io_ring_submit_lock(ctx, !(issue_flags & IO_URING_F_NONBLOCK));84128412+ ret = -ENXIO;84138413+ if (unlikely(!ctx->file_data))84148414+ goto out;84158415+ ret = -EINVAL;84168416+ if (offset >= ctx->nr_user_files)84178417+ goto out;84188418+ ret = io_rsrc_node_switch_start(ctx);84198419+ if (ret)84208420+ goto out;84218421+84228422+ i = array_index_nospec(offset, ctx->nr_user_files);84238423+ file_slot = io_fixed_file_slot(&ctx->file_table, i);84248424+ ret = -EBADF;84258425+ if (!file_slot->file_ptr)84268426+ goto out;84278427+84288428+ file = (struct file *)(file_slot->file_ptr & FFS_MASK);84298429+ ret = io_queue_rsrc_removal(ctx->file_data, offset, ctx->rsrc_node, file);84308430+ if (ret)84318431+ goto out;84328432+84338433+ file_slot->file_ptr = 0;84348434+ io_rsrc_node_switch(ctx, ctx->file_data);84358435+ ret = 0;84368436+out:84378437+ io_ring_submit_unlock(ctx, !(issue_flags & IO_URING_F_NONBLOCK));84388438+ return ret;84398439+}84408440+84168441static int __io_sqe_files_update(struct io_ring_ctx *ctx,84178442 struct io_uring_rsrc_update2 *up,84188443 unsigned nr_args)···92179166 struct io_buffer *buf;92189167 unsigned long index;9219916892209220- xa_for_each(&ctx->io_buffers, index, buf)91699169+ xa_for_each(&ctx->io_buffers, index, buf) {92219170 __io_remove_buffers(ctx, buf, index, -1U);91719171+ cond_resched();91729172+ }92229173}9223917492249175static void io_req_cache_free(struct list_head *list)···97189665 struct io_tctx_node *node;97199666 unsigned long index;9720966797219721- xa_for_each(&tctx->xa, index, node)96689668+ xa_for_each(&tctx->xa, index, node) {97229669 io_uring_del_tctx_node(index);96709670+ cond_resched();96719671+ }97239672 if (wq) {97249673 /*97259674 * Must be after io_uring_del_task_file() (removes nodes under
···584584 ret = ksmbd_workqueue_init();585585 if (ret)586586 goto err_crypto_destroy;587587+588588+ pr_warn_once("The ksmbd server is experimental, use at your own risk.\n");589589+587590 return 0;588591589592err_crypto_destroy:
+40-75
fs/ksmbd/smb2pdu.c
···433433 work->compound_pfid = KSMBD_NO_FID;434434 }435435 memset((char *)rsp_hdr + 4, 0, sizeof(struct smb2_hdr) + 2);436436- rsp_hdr->ProtocolId = rcv_hdr->ProtocolId;436436+ rsp_hdr->ProtocolId = SMB2_PROTO_NUMBER;437437 rsp_hdr->StructureSize = SMB2_HEADER_STRUCTURE_SIZE;438438 rsp_hdr->Command = rcv_hdr->Command;439439···634634smb2_get_name(struct ksmbd_share_config *share, const char *src,635635 const int maxlen, struct nls_table *local_nls)636636{637637- char *name, *unixname;637637+ char *name;638638639639 name = smb_strndup_from_utf16(src, maxlen, 1, local_nls);640640 if (IS_ERR(name)) {···642642 return name;643643 }644644645645- /* change it to absolute unix name */646645 ksmbd_conv_path_to_unix(name);647646 ksmbd_strip_last_slash(name);648648-649649- unixname = convert_to_unix_name(share, name);650650- kfree(name);651651- if (!unixname) {652652- pr_err("can not convert absolute name\n");653653- return ERR_PTR(-ENOMEM);654654- }655655-656656- ksmbd_debug(SMB, "absolute name = %s\n", unixname);657657- return unixname;647647+ return name;658648}659649660650int setup_async_work(struct ksmbd_work *work, void (*fn)(void **), void **arg)···23382348 return rc;23392349 }2340235023412341- rc = ksmbd_vfs_kern_path(name, 0, path, 0);23512351+ rc = ksmbd_vfs_kern_path(work, name, 0, path, 0);23422352 if (rc) {23432353 pr_err("cannot get linux path (%s), err = %d\n",23442354 name, rc);···24132423 struct oplock_info *opinfo;24142424 __le32 *next_ptr = NULL;24152425 int req_op_level = 0, open_flags = 0, may_flags = 0, file_info = 0;24162416- int rc = 0, len = 0;24262426+ int rc = 0;24172427 int contxt_cnt = 0, query_disk_id = 0;24182428 int maximal_access_ctxt = 0, posix_ctxt = 0;24192429 int s_type = 0;···24852495 goto err_out1;24862496 }24872497 } else {24882488- len = strlen(share->path);24892489- ksmbd_debug(SMB, "share path len %d\n", len);24902490- name = kmalloc(len + 1, GFP_KERNEL);24982498+ name = kstrdup("", GFP_KERNEL);24912499 if (!name) {24922492- rsp->hdr.Status = STATUS_NO_MEMORY;24932500 rc = -ENOMEM;24942501 goto err_out1;24952502 }24962496-24972497- memcpy(name, share->path, len);24982498- *(name + len) = '\0';24992503 }2500250425012505 req_op_level = req->RequestedOplockLevel;···26122628 goto err_out1;26132629 }2614263026152615- if (req->CreateOptions & FILE_DELETE_ON_CLOSE_LE) {26162616- /*26172617- * On delete request, instead of following up, need to26182618- * look the current entity26192619- */26202620- rc = ksmbd_vfs_kern_path(name, 0, &path, 1);26212621- if (!rc) {26312631+ rc = ksmbd_vfs_kern_path(work, name, LOOKUP_NO_SYMLINKS, &path, 1);26322632+ if (!rc) {26332633+ if (req->CreateOptions & FILE_DELETE_ON_CLOSE_LE) {26222634 /*26232635 * If file exists with under flags, return access26242636 * denied error.···26332653 path_put(&path);26342654 goto err_out;26352655 }26362636- }26372637- } else {26382638- if (test_share_config_flag(work->tcon->share_conf,26392639- KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS)) {26402640- /*26412641- * Use LOOKUP_FOLLOW to follow the path of26422642- * symlink in path buildup26432643- */26442644- rc = ksmbd_vfs_kern_path(name, LOOKUP_FOLLOW, &path, 1);26452645- if (rc) { /* Case for broken link ?*/26462646- rc = ksmbd_vfs_kern_path(name, 0, &path, 1);26472647- }26482648- } else {26492649- rc = ksmbd_vfs_kern_path(name, 0, &path, 1);26502650- if (!rc && d_is_symlink(path.dentry)) {26512651- rc = -EACCES;26522652- path_put(&path);26532653- goto err_out;26542654- }26562656+ } else if (d_is_symlink(path.dentry)) {26572657+ rc = -EACCES;26582658+ path_put(&path);26592659+ goto err_out;26552660 }26562661 }2657266226582663 if (rc) {26592659- if (rc == -EACCES) {26602660- ksmbd_debug(SMB,26612661- "User does not have right permission\n");26642664+ if (rc != -ENOENT)26622665 goto err_out;26632663- }26642666 ksmbd_debug(SMB, "can not get linux path for %s, rc = %d\n",26652667 name, rc);26662668 rc = 0;···31383176 rsp->hdr.Status = STATUS_INVALID_PARAMETER;31393177 else if (rc == -EOPNOTSUPP)31403178 rsp->hdr.Status = STATUS_NOT_SUPPORTED;31413141- else if (rc == -EACCES || rc == -ESTALE)31793179+ else if (rc == -EACCES || rc == -ESTALE || rc == -EXDEV)31423180 rsp->hdr.Status = STATUS_ACCESS_DENIED;31433181 else if (rc == -ENOENT)31443182 rsp->hdr.Status = STATUS_OBJECT_NAME_INVALID;···40034041 path = &fp->filp->f_path;40044042 /* single EA entry is requested with given user.* name */40054043 if (req->InputBufferLength) {40444044+ if (le32_to_cpu(req->InputBufferLength) <40454045+ sizeof(struct smb2_ea_info_req))40464046+ return -EINVAL;40474047+40064048 ea_req = (struct smb2_ea_info_req *)req->Buffer;40074049 } else {40084050 /* need to send all EAs, if no specific EA is requested*/···42544288 return -EACCES;42554289 }4256429042574257- filename = convert_to_nt_pathname(fp->filename,42584258- work->tcon->share_conf->path);42914291+ filename = convert_to_nt_pathname(fp->filename);42594292 if (!filename)42604293 return -ENOMEM;42614294···43854420 file_info->NextEntryOffset = cpu_to_le32(next);43864421 }4387442243884388- if (nbytes) {44234423+ if (!S_ISDIR(stat.mode)) {43894424 file_info = (struct smb2_file_stream_info *)43904425 &rsp->Buffer[nbytes];43914426 streamlen = smbConvertToUTF16((__le16 *)file_info->StreamName,43924427 "::$DATA", 7, conn->local_nls, 0);43934428 streamlen *= 2;43944429 file_info->StreamNameLength = cpu_to_le32(streamlen);43954395- file_info->StreamSize = S_ISDIR(stat.mode) ? 0 :43964396- cpu_to_le64(stat.size);43974397- file_info->StreamAllocationSize = S_ISDIR(stat.mode) ? 0 :43984398- cpu_to_le64(stat.size);44304430+ file_info->StreamSize = 0;44314431+ file_info->StreamAllocationSize = 0;43994432 nbytes += sizeof(struct smb2_file_stream_info) + streamlen;44004433 }44014434···47084745 struct path path;47094746 int rc = 0, len;47104747 int fs_infoclass_size = 0;47114711- int lookup_flags = 0;4712474847134713- if (test_share_config_flag(share, KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS))47144714- lookup_flags = LOOKUP_FOLLOW;47154715-47164716- rc = ksmbd_vfs_kern_path(share->path, lookup_flags, &path, 0);47494749+ rc = kern_path(share->path, LOOKUP_NO_SYMLINKS, &path);47174750 if (rc) {47184751 pr_err("cannot create vfs path\n");47194752 return -EIO;···52585299 goto out;5259530052605301 len = strlen(new_name);52615261- if (new_name[len - 1] != '/') {53025302+ if (len > 0 && new_name[len - 1] != '/') {52625303 pr_err("not allow base filename in rename\n");52635304 rc = -ESHARE;52645305 goto out;···52865327 }5287532852885329 ksmbd_debug(SMB, "new name %s\n", new_name);52895289- rc = ksmbd_vfs_kern_path(new_name, 0, &path, 1);52905290- if (rc)53305330+ rc = ksmbd_vfs_kern_path(work, new_name, LOOKUP_NO_SYMLINKS, &path, 1);53315331+ if (rc) {53325332+ if (rc != -ENOENT)53335333+ goto out;52915334 file_present = false;52925292- else53355335+ } else {52935336 path_put(&path);53375337+ }5294533852955339 if (ksmbd_share_veto_filename(share, new_name)) {52965340 rc = -ENOENT;···53635401 }5364540253655403 ksmbd_debug(SMB, "target name is %s\n", target_name);53665366- rc = ksmbd_vfs_kern_path(link_name, 0, &path, 0);53675367- if (rc)54045404+ rc = ksmbd_vfs_kern_path(work, link_name, LOOKUP_NO_SYMLINKS, &path, 0);54055405+ if (rc) {54065406+ if (rc != -ENOENT)54075407+ goto out;53685408 file_present = false;53695369- else54095409+ } else {53705410 path_put(&path);54115411+ }5371541253725413 if (file_info->ReplaceIfExists) {53735414 if (file_present) {···55305565 * inode size is retained by backup inode size.55315566 */55325567 size = i_size_read(inode);55335533- rc = ksmbd_vfs_truncate(work, NULL, fp, alloc_blks * 512);55685568+ rc = ksmbd_vfs_truncate(work, fp, alloc_blks * 512);55345569 if (rc) {55355570 pr_err("truncate failed! filename : %s, err %d\n",55365571 fp->filename, rc);···55675602 if (inode->i_sb->s_magic != MSDOS_SUPER_MAGIC) {55685603 ksmbd_debug(SMB, "filename : %s truncated to newsize %lld\n",55695604 fp->filename, newsize);55705570- rc = ksmbd_vfs_truncate(work, NULL, fp, newsize);56055605+ rc = ksmbd_vfs_truncate(work, fp, newsize);55715606 if (rc) {55725607 ksmbd_debug(SMB, "truncate failed! filename : %s err %d\n",55735608 fp->filename, rc);···58445879 return 0;5845588058465881err_out:58475847- if (rc == -EACCES || rc == -EPERM)58825882+ if (rc == -EACCES || rc == -EPERM || rc == -EXDEV)58485883 rsp->hdr.Status = STATUS_ACCESS_DENIED;58495884 else if (rc == -EINVAL)58505885 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
···2020 * depending on the status field in the last byte. The2121 * first byte is where the name start either way, and a2222 * zero means it's empty.2323+ *2424+ * Also, due to a bug in gcc, we don't want to use the2525+ * real (differently sized) name arrays in the inode and2626+ * link entries, but always the 'de_name[]' one in the2727+ * fake struct entry.2828+ *2929+ * See3030+ *3131+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c63232+ *3333+ * for details, but basically gcc will take the size of the3434+ * 'name' array from one of the used union entries randomly.3535+ *3636+ * This use of 'de_name[]' (48 bytes) avoids the false positive3737+ * warnings that would happen if gcc decides to use 'inode.di_name'3838+ * (16 bytes) even when the pointer and size were to come from3939+ * 'link.dl_name' (48 bytes).4040+ *4141+ * In all cases the actual name pointer itself is the same, it's4242+ * only the gcc internal 'what is the size of this field' logic4343+ * that can get confused.2344 */2445union qnx4_directory_entry {2546 struct {2626- char de_name;2727- char de_pad[62];2828- char de_status;4747+ const char de_name[48];4848+ u8 de_pad[15];4949+ u8 de_status;2950 };3051 struct qnx4_inode_entry inode;3152 struct qnx4_link_info link;···7453 ix = (ctx->pos >> QNX4_DIR_ENTRY_SIZE_BITS) % QNX4_INODES_PER_BLOCK;7554 for (; ix < QNX4_INODES_PER_BLOCK; ix++, ctx->pos += QNX4_DIR_ENTRY_SIZE) {7655 union qnx4_directory_entry *de;7777- const char *name;78567957 offset = ix * QNX4_DIR_ENTRY_SIZE;8058 de = (union qnx4_directory_entry *) (bh->b_data + offset);81598282- if (!de->de_name)6060+ if (!de->de_name[0])8361 continue;8462 if (!(de->de_status & (QNX4_FILE_USED|QNX4_FILE_LINK)))8563 continue;8664 if (!(de->de_status & QNX4_FILE_LINK)) {8765 size = sizeof(de->inode.di_fname);8888- name = de->inode.di_fname;8966 ino = blknum * QNX4_INODES_PER_BLOCK + ix - 1;9067 } else {9168 size = sizeof(de->link.dl_fname);9292- name = de->link.dl_fname;9369 ino = ( le32_to_cpu(de->link.dl_inode_blk) - 1 ) *9470 QNX4_INODES_PER_BLOCK +9571 de->link.dl_inode_ndx;9672 }9797- size = strnlen(name, size);7373+ size = strnlen(de->de_name, size);9874 QNX4DEBUG((KERN_INFO "qnx4_readdir:%.*s\n", size, name));9999- if (!dir_emit(ctx, name, size, ino, DT_UNKNOWN)) {7575+ if (!dir_emit(ctx, de->de_name, size, ino, DT_UNKNOWN)) {10076 brelse(bh);10177 return 0;10278 }
+1-1
fs/smbfs_common/smbfsctl.h
···11/* SPDX-License-Identifier: LGPL-2.1+ */22/*33- * fs/cifs/smbfsctl.h: SMB, CIFS, SMB2 FSCTL definitions33+ * SMB, CIFS, SMB2 FSCTL definitions44 *55 * Copyright (c) International Business Machines Corp., 2002,201366 * Author(s): Steve French (sfrench@us.ibm.com)
···251251}252252253253void irq_domain_free_fwnode(struct fwnode_handle *fwnode);254254-struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,254254+struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int size,255255 irq_hw_number_t hwirq_max, int direct_max,256256 const struct irq_domain_ops *ops,257257 void *host_data);
+3
include/linux/mdio.h
···80808181 /* Clears up any memory if needed */8282 void (*remove)(struct mdio_device *mdiodev);8383+8484+ /* Quiesces the device on system shutdown, turns off interrupts etc */8585+ void (*shutdown)(struct mdio_device *mdiodev);8386};84878588static inline struct mdio_driver *
+5-1
include/linux/migrate.h
···1919 */2020#define MIGRATEPAGE_SUCCESS 021212222+/*2323+ * Keep sync with:2424+ * - macro MIGRATE_REASON in include/trace/events/migrate.h2525+ * - migrate_reason_names[MR_TYPES] in mm/debug.c2626+ */2227enum migrate_reason {2328 MR_COMPACTION,2429 MR_MEMORY_FAILURE,···3732 MR_TYPES3833};39344040-/* In mm/debug.c; also keep sync with include/trace/events/migrate.h */4135extern const char *migrate_reason_names[MR_TYPES];42364337#ifdef CONFIG_MIGRATION
···225225226226struct binder_frozen_status_info {227227 __u32 pid;228228+229229+ /* process received sync transactions since last frozen230230+ * bit 0: received sync transaction after being frozen231231+ * bit 1: new pending sync transaction during freezing232232+ */228233 __u32 sync_recv;234234+235235+ /* process received async transactions since last frozen */229236 __u32 async_recv;230237};231238
-1
include/uapi/linux/cifs/cifs_mount.h
···11/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */22/*33- * include/uapi/linux/cifs/cifs_mount.h43 *54 * Author(s): Scott Lovenberg (scott.lovenberg@gmail.com)65 *
-12
include/xen/xen-ops.h
···4646int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,4747 unsigned int address_bits,4848 dma_addr_t *dma_handle);4949-5049void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order);5151-#else5252-static inline int xen_create_contiguous_region(phys_addr_t pstart,5353- unsigned int order,5454- unsigned int address_bits,5555- dma_addr_t *dma_handle)5656-{5757- return 0;5858-}5959-6060-static inline void xen_destroy_contiguous_region(phys_addr_t pstart,6161- unsigned int order) { }6250#endif63516452#if defined(CONFIG_XEN_PV)
+16-14
init/do_mounts.c
···338338__setup("rootfstype=", fs_names_setup);339339__setup("rootdelay=", root_delay_setup);340340341341-static int __init split_fs_names(char *page, char *names)341341+/* This can return zero length strings. Caller should check */342342+static int __init split_fs_names(char *page, size_t size, char *names)342343{343343- int count = 0;344344+ int count = 1;344345 char *p = page;345346346346- strcpy(p, root_fs_names);347347+ strlcpy(p, root_fs_names, size);347348 while (*p++) {348348- if (p[-1] == ',')349349+ if (p[-1] == ',') {349350 p[-1] = '\0';351351+ count++;352352+ }350353 }351351- *p = '\0';352352-353353- for (p = page; *p; p += strlen(p)+1)354354- count++;355354356355 return count;357356}···403404 scnprintf(b, BDEVNAME_SIZE, "unknown-block(%u,%u)",404405 MAJOR(ROOT_DEV), MINOR(ROOT_DEV));405406 if (root_fs_names)406406- num_fs = split_fs_names(fs_names, root_fs_names);407407+ num_fs = split_fs_names(fs_names, PAGE_SIZE, root_fs_names);407408 else408409 num_fs = list_bdev_fs_names(fs_names, PAGE_SIZE);409410retry:410411 for (i = 0, p = fs_names; i < num_fs; i++, p += strlen(p)+1) {411411- int err = do_mount_root(name, p, flags, root_mount_data);412412+ int err;413413+414414+ if (!*p)415415+ continue;416416+ err = do_mount_root(name, p, flags, root_mount_data);412417 switch (err) {413418 case 0:414419 goto out;···546543 fs_names = (void *)__get_free_page(GFP_KERNEL);547544 if (!fs_names)548545 return -EINVAL;549549- num_fs = split_fs_names(fs_names, root_fs_names);546546+ num_fs = split_fs_names(fs_names, PAGE_SIZE, root_fs_names);550547551548 for (i = 0, fstype = fs_names; i < num_fs;552549 i++, fstype += strlen(fstype) + 1) {550550+ if (!*fstype)551551+ continue;553552 if (!fs_is_nodev(fstype))554553 continue;555554 err = do_mount_root(root_device_name, fstype, root_mountflags,556555 root_mount_data);557556 if (!err)558557 break;559559- if (err != -EACCES && err != -EINVAL)560560- panic("VFS: Unable to mount root \"%s\" (%s), err=%d\n",561561- root_device_name, fstype, err);562558 }563559564560 free_page((unsigned long)fs_names);
···171171 if (ti_work & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL))172172 handle_signal_work(regs, ti_work);173173174174- if (ti_work & _TIF_NOTIFY_RESUME) {174174+ if (ti_work & _TIF_NOTIFY_RESUME)175175 tracehook_notify_resume(regs);176176- rseq_handle_notify_resume(NULL, regs);177177- }178176179177 /* Architecture specific TIF work */180178 arch_exit_to_user_mode_work(regs, ti_work);
+1-1
kernel/irq/irqdomain.c
···136136 * Allocates and initializes an irq_domain structure.137137 * Returns pointer to IRQ domain, or NULL on failure.138138 */139139-struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,139139+struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, unsigned int size,140140 irq_hw_number_t hwirq_max, int direct_max,141141 const struct irq_domain_ops *ops,142142 void *host_data)
+11-3
kernel/rseq.c
···282282283283 if (unlikely(t->flags & PF_EXITING))284284 return;285285- ret = rseq_ip_fixup(regs);286286- if (unlikely(ret < 0))287287- goto error;285285+286286+ /*287287+ * regs is NULL if and only if the caller is in a syscall path. Skip288288+ * fixup and leave rseq_cs as is so that rseq_sycall() will detect and289289+ * kill a misbehaving userspace on debug kernels.290290+ */291291+ if (regs) {292292+ ret = rseq_ip_fixup(regs);293293+ if (unlikely(ret < 0))294294+ goto error;295295+ }288296 if (unlikely(rseq_update_cpu_id(t)))289297 goto error;290298 return;
···346346 int "Warn for stack frames larger than"347347 range 0 8192348348 default 2048 if GCC_PLUGIN_LATENT_ENTROPY349349- default 1536 if (!64BIT && PARISC)349349+ default 1536 if (!64BIT && (PARISC || XTENSA))350350 default 1024 if (!64BIT && !PARISC)351351 default 2048 if 64BIT352352 help
+2
lib/Kconfig.kasan
···6666config KASAN_GENERIC6767 bool "Generic mode"6868 depends on HAVE_ARCH_KASAN && CC_HAS_KASAN_GENERIC6969+ depends on CC_HAS_WORKING_NOSANITIZE_ADDRESS6970 select SLUB_DEBUG if SLUB7071 select CONSTRUCTORS7172 help···8786config KASAN_SW_TAGS8887 bool "Software tag-based mode"8988 depends on HAVE_ARCH_KASAN_SW_TAGS && CC_HAS_KASAN_SW_TAGS8989+ depends on CC_HAS_WORKING_NOSANITIZE_ADDRESS9090 select SLUB_DEBUG if SLUB9191 select CONSTRUCTORS9292 help
···306306 struct vm_area_struct *vma)307307{308308 unsigned long address = vma_address(page, vma);309309+ unsigned long ret = 0;309310 pgd_t *pgd;310311 p4d_t *p4d;311312 pud_t *pud;···330329 if (pmd_devmap(*pmd))331330 return PMD_SHIFT;332331 pte = pte_offset_map(pmd, address);333333- if (!pte_present(*pte))334334- return 0;335335- if (pte_devmap(*pte))336336- return PAGE_SHIFT;337337- return 0;332332+ if (pte_present(*pte) && pte_devmap(*pte))333333+ ret = PAGE_SHIFT;334334+ pte_unmap(pte);335335+ return ret;338336}339337340338/*···11261126 */11271127static inline bool HWPoisonHandlable(struct page *page)11281128{11291129- return PageLRU(page) || __PageMovable(page);11291129+ return PageLRU(page) || __PageMovable(page) || is_free_buddy_page(page);11301130}1131113111321132static int __get_hwpoison_page(struct page *page)
+1
mm/memory.c
···34033403 unmap_mapping_range_tree(&mapping->i_mmap, &details);34043404 i_mmap_unlock_write(mapping);34053405}34063406+EXPORT_SYMBOL_GPL(unmap_mapping_pages);3406340734073408/**34083409 * unmap_mapping_range - unmap the portion of all mmaps in the specified
+2-2
mm/shmem.c
···490490 case SHMEM_HUGE_ALWAYS:491491 return true;492492 case SHMEM_HUGE_WITHIN_SIZE:493493- index = round_up(index, HPAGE_PMD_NR);493493+ index = round_up(index + 1, HPAGE_PMD_NR);494494 i_size = round_up(i_size_read(inode), PAGE_SIZE);495495- if (i_size >= HPAGE_PMD_SIZE && (i_size >> PAGE_SHIFT) >= index)495495+ if (i_size >> PAGE_SHIFT >= index)496496 return true;497497 fallthrough;498498 case SHMEM_HUGE_ADVISE:
+16-3
mm/swap.c
···620620 pagevec_lru_move_fn(pvec, lru_lazyfree_fn);621621622622 activate_page_drain(cpu);623623- invalidate_bh_lrus_cpu(cpu);624623}625624626625/**···702703 local_unlock(&lru_pvecs.lock);703704}704705706706+/*707707+ * It's called from per-cpu workqueue context in SMP case so708708+ * lru_add_drain_cpu and invalidate_bh_lrus_cpu should run on709709+ * the same cpu. It shouldn't be a problem in !SMP case since710710+ * the core is only one and the locks will disable preemption.711711+ */712712+static void lru_add_and_bh_lrus_drain(void)713713+{714714+ local_lock(&lru_pvecs.lock);715715+ lru_add_drain_cpu(smp_processor_id());716716+ local_unlock(&lru_pvecs.lock);717717+ invalidate_bh_lrus_cpu();718718+}719719+705720void lru_add_drain_cpu_zone(struct zone *zone)706721{707722 local_lock(&lru_pvecs.lock);···730717731718static void lru_add_drain_per_cpu(struct work_struct *dummy)732719{733733- lru_add_drain();720720+ lru_add_and_bh_lrus_drain();734721}735722736723/*···871858 */872859 __lru_add_drain_all(true);873860#else874874- lru_add_drain();861861+ lru_add_and_bh_lrus_drain();875862#endif876863}877864
+2-2
mm/util.c
···787787 size_t *lenp, loff_t *ppos)788788{789789 struct ctl_table t;790790- int new_policy;790790+ int new_policy = -1;791791 int ret;792792793793 /*···805805 t = *table;806806 t.data = &new_policy;807807 ret = proc_dointvec_minmax(&t, write, buffer, lenp, ppos);808808- if (ret)808808+ if (ret || new_policy == -1)809809 return ret;810810811811 mm_compute_batch(new_policy);
+1
mm/workingset.c
···352352353353 inc_lruvec_state(lruvec, WORKINGSET_REFAULT_BASE + file);354354355355+ mem_cgroup_flush_stats();355356 /*356357 * Compare the distance to the existing workingset size. We357358 * don't activate pages that couldn't stay resident even if
+10-6
net/core/dev.c
···69236923 */69246924void napi_enable(struct napi_struct *n)69256925{69266926- BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));69276927- smp_mb__before_atomic();69286928- clear_bit(NAPI_STATE_SCHED, &n->state);69296929- clear_bit(NAPI_STATE_NPSVC, &n->state);69306930- if (n->dev->threaded && n->thread)69316931- set_bit(NAPI_STATE_THREADED, &n->state);69266926+ unsigned long val, new;69276927+69286928+ do {69296929+ val = READ_ONCE(n->state);69306930+ BUG_ON(!test_bit(NAPI_STATE_SCHED, &val));69316931+69326932+ new = val & ~(NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC);69336933+ if (n->dev->threaded && n->thread)69346934+ new |= NAPIF_STATE_THREADED;69356935+ } while (cmpxchg(&n->state, val, new) != val);69326936}69336937EXPORT_SYMBOL(napi_enable);69346938
+23-14
net/core/sock.c
···3179317931803180void lock_sock_nested(struct sock *sk, int subclass)31813181{31823182+ /* The sk_lock has mutex_lock() semantics here. */31833183+ mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_);31843184+31823185 might_sleep();31833186 spin_lock_bh(&sk->sk_lock.slock);31843187 if (sk->sk_lock.owned)31853188 __lock_sock(sk);31863189 sk->sk_lock.owned = 1;31873187- spin_unlock(&sk->sk_lock.slock);31883188- /*31893189- * The sk_lock has mutex_lock() semantics here:31903190- */31913191- mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_);31923192- local_bh_enable();31903190+ spin_unlock_bh(&sk->sk_lock.slock);31933191}31943192EXPORT_SYMBOL(lock_sock_nested);31953193···32253227 */32263228bool lock_sock_fast(struct sock *sk) __acquires(&sk->sk_lock.slock)32273229{32303230+ /* The sk_lock has mutex_lock() semantics here. */32313231+ mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_);32323232+32283233 might_sleep();32293234 spin_lock_bh(&sk->sk_lock.slock);3230323532313231- if (!sk->sk_lock.owned)32363236+ if (!sk->sk_lock.owned) {32323237 /*32333233- * Note : We must disable BH32383238+ * Fast path return with bottom halves disabled and32393239+ * sock::sk_lock.slock held.32403240+ *32413241+ * The 'mutex' is not contended and holding32423242+ * sock::sk_lock.slock prevents all other lockers to32433243+ * proceed so the corresponding unlock_sock_fast() can32443244+ * avoid the slow path of release_sock() completely and32453245+ * just release slock.32463246+ *32473247+ * From a semantical POV this is equivalent to 'acquiring'32483248+ * the 'mutex', hence the corresponding lockdep32493249+ * mutex_release() has to happen in the fast path of32503250+ * unlock_sock_fast().32343251 */32353252 return false;32533253+ }3236325432373255 __lock_sock(sk);32383256 sk->sk_lock.owned = 1;32393239- spin_unlock(&sk->sk_lock.slock);32403240- /*32413241- * The sk_lock has mutex_lock() semantics here:32423242- */32433243- mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_);32443257 __acquire(&sk->sk_lock.slock);32453245- local_bh_enable();32583258+ spin_unlock_bh(&sk->sk_lock.slock);32463259 return true;32473260}32483261EXPORT_SYMBOL(lock_sock_fast);
+106-8
net/dsa/dsa2.c
···429429{430430 struct devlink_port *dlp = &dp->devlink_port;431431 bool dsa_port_link_registered = false;432432+ struct dsa_switch *ds = dp->ds;432433 bool dsa_port_enabled = false;433434 int err = 0;434435···438437439438 INIT_LIST_HEAD(&dp->fdbs);440439 INIT_LIST_HEAD(&dp->mdbs);440440+441441+ if (ds->ops->port_setup) {442442+ err = ds->ops->port_setup(ds, dp->index);443443+ if (err)444444+ return err;445445+ }441446442447 switch (dp->type) {443448 case DSA_PORT_TYPE_UNUSED:···487480 dsa_port_disable(dp);488481 if (err && dsa_port_link_registered)489482 dsa_port_link_unregister_of(dp);490490- if (err)483483+ if (err) {484484+ if (ds->ops->port_teardown)485485+ ds->ops->port_teardown(ds, dp->index);491486 return err;487487+ }492488493489 dp->setup = true;494490···543533static void dsa_port_teardown(struct dsa_port *dp)544534{545535 struct devlink_port *dlp = &dp->devlink_port;536536+ struct dsa_switch *ds = dp->ds;546537 struct dsa_mac_addr *a, *tmp;547538548539 if (!dp->setup)549540 return;541541+542542+ if (ds->ops->port_teardown)543543+ ds->ops->port_teardown(ds, dp->index);550544551545 devlink_port_type_clear(dlp);552546···593579 if (dp->devlink_port_setup)594580 devlink_port_unregister(dlp);595581 dp->devlink_port_setup = false;582582+}583583+584584+/* Destroy the current devlink port, and create a new one which has the UNUSED585585+ * flavour. At this point, any call to ds->ops->port_setup has been already586586+ * balanced out by a call to ds->ops->port_teardown, so we know that any587587+ * devlink port regions the driver had are now unregistered. We then call its588588+ * ds->ops->port_setup again, in order for the driver to re-create them on the589589+ * new devlink port.590590+ */591591+static int dsa_port_reinit_as_unused(struct dsa_port *dp)592592+{593593+ struct dsa_switch *ds = dp->ds;594594+ int err;595595+596596+ dsa_port_devlink_teardown(dp);597597+ dp->type = DSA_PORT_TYPE_UNUSED;598598+ err = dsa_port_devlink_setup(dp);599599+ if (err)600600+ return err;601601+602602+ if (ds->ops->port_setup) {603603+ /* On error, leave the devlink port registered,604604+ * dsa_switch_teardown will clean it up later.605605+ */606606+ err = ds->ops->port_setup(ds, dp->index);607607+ if (err)608608+ return err;609609+ }610610+611611+ return 0;596612}597613598614static int dsa_devlink_info_get(struct devlink *dl,···880836 devlink_params_publish(ds->devlink);881837882838 if (!ds->slave_mii_bus && ds->ops->phy_read) {883883- ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev);839839+ ds->slave_mii_bus = mdiobus_alloc();884840 if (!ds->slave_mii_bus) {885841 err = -ENOMEM;886842 goto teardown;···890846891847 err = mdiobus_register(ds->slave_mii_bus);892848 if (err < 0)893893- goto teardown;849849+ goto free_slave_mii_bus;894850 }895851896852 ds->setup = true;897853898854 return 0;899855856856+free_slave_mii_bus:857857+ if (ds->slave_mii_bus && ds->ops->phy_read)858858+ mdiobus_free(ds->slave_mii_bus);900859teardown:901860 if (ds->ops->teardown)902861 ds->ops->teardown(ds);···924877 if (!ds->setup)925878 return;926879927927- if (ds->slave_mii_bus && ds->ops->phy_read)880880+ if (ds->slave_mii_bus && ds->ops->phy_read) {928881 mdiobus_unregister(ds->slave_mii_bus);882882+ mdiobus_free(ds->slave_mii_bus);883883+ ds->slave_mii_bus = NULL;884884+ }929885930886 dsa_switch_unregister_notifier(ds);931887···988938 list_for_each_entry(dp, &dst->ports, list) {989939 err = dsa_port_setup(dp);990940 if (err) {991991- dsa_port_devlink_teardown(dp);992992- dp->type = DSA_PORT_TYPE_UNUSED;993993- err = dsa_port_devlink_setup(dp);941941+ err = dsa_port_reinit_as_unused(dp);994942 if (err)995943 goto teardown;996996- continue;997944 }998945 }999946···10951048teardown_master:10961049 dsa_tree_teardown_master(dst);10971050teardown_switches:10511051+ dsa_tree_teardown_ports(dst);10981052 dsa_tree_teardown_switches(dst);10991053teardown_cpu_ports:11001054 dsa_tree_teardown_cpu_ports(dst);···16101562 mutex_unlock(&dsa2_mutex);16111563}16121564EXPORT_SYMBOL_GPL(dsa_unregister_switch);15651565+15661566+/* If the DSA master chooses to unregister its net_device on .shutdown, DSA is15671567+ * blocking that operation from completion, due to the dev_hold taken inside15681568+ * netdev_upper_dev_link. Unlink the DSA slave interfaces from being uppers of15691569+ * the DSA master, so that the system can reboot successfully.15701570+ */15711571+void dsa_switch_shutdown(struct dsa_switch *ds)15721572+{15731573+ struct net_device *master, *slave_dev;15741574+ LIST_HEAD(unregister_list);15751575+ struct dsa_port *dp;15761576+15771577+ mutex_lock(&dsa2_mutex);15781578+ rtnl_lock();15791579+15801580+ list_for_each_entry(dp, &ds->dst->ports, list) {15811581+ if (dp->ds != ds)15821582+ continue;15831583+15841584+ if (!dsa_port_is_user(dp))15851585+ continue;15861586+15871587+ master = dp->cpu_dp->master;15881588+ slave_dev = dp->slave;15891589+15901590+ netdev_upper_dev_unlink(master, slave_dev);15911591+ /* Just unlinking ourselves as uppers of the master is not15921592+ * sufficient. When the master net device unregisters, that will15931593+ * also call dev_close, which we will catch as NETDEV_GOING_DOWN15941594+ * and trigger a dev_close on our own devices (dsa_slave_close).15951595+ * In turn, that will call dev_mc_unsync on the master's net15961596+ * device. If the master is also a DSA switch port, this will15971597+ * trigger dsa_slave_set_rx_mode which will call dev_mc_sync on15981598+ * its own master. Lockdep will complain about the fact that15991599+ * all cascaded masters have the same dsa_master_addr_list_lock_key,16001600+ * which it normally would not do if the cascaded masters would16011601+ * be in a proper upper/lower relationship, which we've just16021602+ * destroyed.16031603+ * To suppress the lockdep warnings, let's actually unregister16041604+ * the DSA slave interfaces too, to avoid the nonsensical16051605+ * multicast address list synchronization on shutdown.16061606+ */16071607+ unregister_netdevice_queue(slave_dev, &unregister_list);16081608+ }16091609+ unregister_netdevice_many(&unregister_list);16101610+16111611+ rtnl_unlock();16121612+ mutex_unlock(&dsa2_mutex);16131613+}16141614+EXPORT_SYMBOL_GPL(dsa_switch_shutdown);
···11// SPDX-License-Identifier: GPL-2.022-/* Copyright 2020-2021 NXP Semiconductors22+/* Copyright 2020-2021 NXP33 *44 * An implementation of the software-defined tag_8021q.c tagger format, which55 * also preserves full functionality under a vlan_filtering bridge. It does
+16-5
net/ipv4/nexthop.c
···19821982 rcu_assign_pointer(old->nh_grp, newg);1983198319841984 if (newg->resilient) {19851985+ /* Make sure concurrent readers are not using 'oldg' anymore. */19861986+ synchronize_net();19851987 rcu_assign_pointer(oldg->res_table, tmp_table);19861988 rcu_assign_pointer(oldg->spare->res_table, tmp_table);19871989 }···35673565};3568356635693567static int nexthops_dump(struct net *net, struct notifier_block *nb,35683568+ enum nexthop_event_type event_type,35703569 struct netlink_ext_ack *extack)35713570{35723571 struct rb_root *root = &net->nexthop.rb_root;···35783575 struct nexthop *nh;3579357635803577 nh = rb_entry(node, struct nexthop, rb_node);35813581- err = call_nexthop_notifier(nb, net, NEXTHOP_EVENT_REPLACE, nh,35823582- extack);35783578+ err = call_nexthop_notifier(nb, net, event_type, nh, extack);35833579 if (err)35843580 break;35853581 }···35923590 int err;3593359135943592 rtnl_lock();35953595- err = nexthops_dump(net, nb, extack);35933593+ err = nexthops_dump(net, nb, NEXTHOP_EVENT_REPLACE, extack);35963594 if (err)35973595 goto unlock;35983596 err = blocking_notifier_chain_register(&net->nexthop.notifier_chain,···3605360336063604int unregister_nexthop_notifier(struct net *net, struct notifier_block *nb)36073605{36083608- return blocking_notifier_chain_unregister(&net->nexthop.notifier_chain,36093609- nb);36063606+ int err;36073607+36083608+ rtnl_lock();36093609+ err = blocking_notifier_chain_unregister(&net->nexthop.notifier_chain,36103610+ nb);36113611+ if (err)36123612+ goto unlock;36133613+ nexthops_dump(net, nb, NEXTHOP_EVENT_DEL, NULL);36143614+unlock:36153615+ rtnl_unlock();36163616+ return err;36103617}36113618EXPORT_SYMBOL(unregister_nexthop_notifier);36123619
···230230 goto out_rel;231231 }232232 /* get address to which the internal TCP socket is bound */233233- kernel_getsockname(clcsock, (struct sockaddr *)&addrs);233233+ if (kernel_getsockname(clcsock, (struct sockaddr *)&addrs) < 0)234234+ goto out_rel;234235 /* analyze IP specific data of net_device belonging to TCP socket */235236 addr6 = (struct sockaddr_in6 *)&addrs;236237 rcu_read_lock();
···9595 uint32_t flag;9696};97979898+#define MIN_RUN_DELAY_NS 200000UL9999+98100bool thp_configured(void);99101size_t get_trans_hugepagesz(void);100102size_t get_def_hugetlb_pagesz(void);···104102size_t get_backing_src_pagesz(uint32_t i);105103void backing_src_help(void);106104enum vm_mem_backing_src_type parse_backing_src_type(const char *type_name);105105+long get_run_delay(void);107106108107/*109108 * Whether or not the given source type is shared memory (as opposed to
+21-1
tools/testing/selftests/kvm/lib/test_util.c
···1111#include <stdlib.h>1212#include <time.h>1313#include <sys/stat.h>1414+#include <sys/syscall.h>1415#include <linux/mman.h>1516#include "linux/kernel.h"1617···130129{131130 size_t size;132131 FILE *f;132132+ int ret;133133134134 TEST_ASSERT(thp_configured(), "THP is not configured in host kernel");135135136136 f = fopen("/sys/kernel/mm/transparent_hugepage/hpage_pmd_size", "r");137137 TEST_ASSERT(f != NULL, "Error in opening transparent_hugepage/hpage_pmd_size");138138139139- fscanf(f, "%ld", &size);139139+ ret = fscanf(f, "%ld", &size);140140+ ret = fscanf(f, "%ld", &size);141141+ TEST_ASSERT(ret < 1, "Error reading transparent_hugepage/hpage_pmd_size");140142 fclose(f);141143142144 return size;···303299 backing_src_help();304300 TEST_FAIL("Unknown backing src type: %s", type_name);305301 return -1;302302+}303303+304304+long get_run_delay(void)305305+{306306+ char path[64];307307+ long val[2];308308+ FILE *fp;309309+310310+ sprintf(path, "/proc/%ld/schedstat", syscall(SYS_gettid));311311+ fp = fopen(path, "r");312312+ /* Return MIN_RUN_DELAY_NS upon failure just to be safe */313313+ if (fscanf(fp, "%ld %ld ", &val[0], &val[1]) < 2)314314+ val[1] = MIN_RUN_DELAY_NS;315315+ fclose(fp);316316+317317+ return val[1];306318}
+236
tools/testing/selftests/kvm/rseq_test.c
···11+// SPDX-License-Identifier: GPL-2.0-only22+#define _GNU_SOURCE /* for program_invocation_short_name */33+#include <errno.h>44+#include <fcntl.h>55+#include <pthread.h>66+#include <sched.h>77+#include <stdio.h>88+#include <stdlib.h>99+#include <string.h>1010+#include <signal.h>1111+#include <syscall.h>1212+#include <sys/ioctl.h>1313+#include <asm/barrier.h>1414+#include <linux/atomic.h>1515+#include <linux/rseq.h>1616+#include <linux/unistd.h>1717+1818+#include "kvm_util.h"1919+#include "processor.h"2020+#include "test_util.h"2121+2222+#define VCPU_ID 02323+2424+static __thread volatile struct rseq __rseq = {2525+ .cpu_id = RSEQ_CPU_ID_UNINITIALIZED,2626+};2727+2828+/*2929+ * Use an arbitrary, bogus signature for configuring rseq, this test does not3030+ * actually enter an rseq critical section.3131+ */3232+#define RSEQ_SIG 0xdeadbeef3333+3434+/*3535+ * Any bug related to task migration is likely to be timing-dependent; perform3636+ * a large number of migrations to reduce the odds of a false negative.3737+ */3838+#define NR_TASK_MIGRATIONS 1000003939+4040+static pthread_t migration_thread;4141+static cpu_set_t possible_mask;4242+static bool done;4343+4444+static atomic_t seq_cnt;4545+4646+static void guest_code(void)4747+{4848+ for (;;)4949+ GUEST_SYNC(0);5050+}5151+5252+static void sys_rseq(int flags)5353+{5454+ int r;5555+5656+ r = syscall(__NR_rseq, &__rseq, sizeof(__rseq), flags, RSEQ_SIG);5757+ TEST_ASSERT(!r, "rseq failed, errno = %d (%s)", errno, strerror(errno));5858+}5959+6060+static void *migration_worker(void *ign)6161+{6262+ cpu_set_t allowed_mask;6363+ int r, i, nr_cpus, cpu;6464+6565+ CPU_ZERO(&allowed_mask);6666+6767+ nr_cpus = CPU_COUNT(&possible_mask);6868+6969+ for (i = 0; i < NR_TASK_MIGRATIONS; i++) {7070+ cpu = i % nr_cpus;7171+ if (!CPU_ISSET(cpu, &possible_mask))7272+ continue;7373+7474+ CPU_SET(cpu, &allowed_mask);7575+7676+ /*7777+ * Bump the sequence count twice to allow the reader to detect7878+ * that a migration may have occurred in between rseq and sched7979+ * CPU ID reads. An odd sequence count indicates a migration8080+ * is in-progress, while a completely different count indicates8181+ * a migration occurred since the count was last read.8282+ */8383+ atomic_inc(&seq_cnt);8484+8585+ /*8686+ * Ensure the odd count is visible while sched_getcpu() isn't8787+ * stable, i.e. while changing affinity is in-progress.8888+ */8989+ smp_wmb();9090+ r = sched_setaffinity(0, sizeof(allowed_mask), &allowed_mask);9191+ TEST_ASSERT(!r, "sched_setaffinity failed, errno = %d (%s)",9292+ errno, strerror(errno));9393+ smp_wmb();9494+ atomic_inc(&seq_cnt);9595+9696+ CPU_CLR(cpu, &allowed_mask);9797+9898+ /*9999+ * Wait 1-10us before proceeding to the next iteration and more100100+ * specifically, before bumping seq_cnt again. A delay is101101+ * needed on three fronts:102102+ *103103+ * 1. To allow sched_setaffinity() to prompt migration before104104+ * ioctl(KVM_RUN) enters the guest so that TIF_NOTIFY_RESUME105105+ * (or TIF_NEED_RESCHED, which indirectly leads to handling106106+ * NOTIFY_RESUME) is handled in KVM context.107107+ *108108+ * If NOTIFY_RESUME/NEED_RESCHED is set after KVM enters109109+ * the guest, the guest will trigger a IO/MMIO exit all the110110+ * way to userspace and the TIF flags will be handled by111111+ * the generic "exit to userspace" logic, not by KVM. The112112+ * exit to userspace is necessary to give the test a chance113113+ * to check the rseq CPU ID (see #2).114114+ *115115+ * Alternatively, guest_code() could include an instruction116116+ * to trigger an exit that is handled by KVM, but any such117117+ * exit requires architecture specific code.118118+ *119119+ * 2. To let ioctl(KVM_RUN) make its way back to the test120120+ * before the next round of migration. The test's check on121121+ * the rseq CPU ID must wait for migration to complete in122122+ * order to avoid false positive, thus any kernel rseq bug123123+ * will be missed if the next migration starts before the124124+ * check completes.125125+ *126126+ * 3. To ensure the read-side makes efficient forward progress,127127+ * e.g. if sched_getcpu() involves a syscall. Stalling the128128+ * read-side means the test will spend more time waiting for129129+ * sched_getcpu() to stabilize and less time trying to hit130130+ * the timing-dependent bug.131131+ *132132+ * Because any bug in this area is likely to be timing-dependent,133133+ * run with a range of delays at 1us intervals from 1us to 10us134134+ * as a best effort to avoid tuning the test to the point where135135+ * it can hit _only_ the original bug and not detect future136136+ * regressions.137137+ *138138+ * The original bug can reproduce with a delay up to ~500us on139139+ * x86-64, but starts to require more iterations to reproduce140140+ * as the delay creeps above ~10us, and the average runtime of141141+ * each iteration obviously increases as well. Cap the delay142142+ * at 10us to keep test runtime reasonable while minimizing143143+ * potential coverage loss.144144+ *145145+ * The lower bound for reproducing the bug is likely below 1us,146146+ * e.g. failures occur on x86-64 with nanosleep(0), but at that147147+ * point the overhead of the syscall likely dominates the delay.148148+ * Use usleep() for simplicity and to avoid unnecessary kernel149149+ * dependencies.150150+ */151151+ usleep((i % 10) + 1);152152+ }153153+ done = true;154154+ return NULL;155155+}156156+157157+int main(int argc, char *argv[])158158+{159159+ int r, i, snapshot;160160+ struct kvm_vm *vm;161161+ u32 cpu, rseq_cpu;162162+163163+ /* Tell stdout not to buffer its content */164164+ setbuf(stdout, NULL);165165+166166+ r = sched_getaffinity(0, sizeof(possible_mask), &possible_mask);167167+ TEST_ASSERT(!r, "sched_getaffinity failed, errno = %d (%s)", errno,168168+ strerror(errno));169169+170170+ if (CPU_COUNT(&possible_mask) < 2) {171171+ print_skip("Only one CPU, task migration not possible\n");172172+ exit(KSFT_SKIP);173173+ }174174+175175+ sys_rseq(0);176176+177177+ /*178178+ * Create and run a dummy VM that immediately exits to userspace via179179+ * GUEST_SYNC, while concurrently migrating the process by setting its180180+ * CPU affinity.181181+ */182182+ vm = vm_create_default(VCPU_ID, 0, guest_code);183183+184184+ pthread_create(&migration_thread, NULL, migration_worker, 0);185185+186186+ for (i = 0; !done; i++) {187187+ vcpu_run(vm, VCPU_ID);188188+ TEST_ASSERT(get_ucall(vm, VCPU_ID, NULL) == UCALL_SYNC,189189+ "Guest failed?");190190+191191+ /*192192+ * Verify rseq's CPU matches sched's CPU. Ensure migration193193+ * doesn't occur between sched_getcpu() and reading the rseq194194+ * cpu_id by rereading both if the sequence count changes, or195195+ * if the count is odd (migration in-progress).196196+ */197197+ do {198198+ /*199199+ * Drop bit 0 to force a mismatch if the count is odd,200200+ * i.e. if a migration is in-progress.201201+ */202202+ snapshot = atomic_read(&seq_cnt) & ~1;203203+204204+ /*205205+ * Ensure reading sched_getcpu() and rseq.cpu_id206206+ * complete in a single "no migration" window, i.e. are207207+ * not reordered across the seq_cnt reads.208208+ */209209+ smp_rmb();210210+ cpu = sched_getcpu();211211+ rseq_cpu = READ_ONCE(__rseq.cpu_id);212212+ smp_rmb();213213+ } while (snapshot != atomic_read(&seq_cnt));214214+215215+ TEST_ASSERT(rseq_cpu == cpu,216216+ "rseq CPU = %d, sched CPU = %d\n", rseq_cpu, cpu);217217+ }218218+219219+ /*220220+ * Sanity check that the test was able to enter the guest a reasonable221221+ * number of times, e.g. didn't get stalled too often/long waiting for222222+ * sched_getcpu() to stabilize. A 2:1 migration:KVM_RUN ratio is a223223+ * fairly conservative ratio on x86-64, which can do _more_ KVM_RUNs224224+ * than migrations given the 1us+ delay in the migration task.225225+ */226226+ TEST_ASSERT(i > (NR_TASK_MIGRATIONS / 2),227227+ "Only performed %d KVM_RUNs, task stalled too much?\n", i);228228+229229+ pthread_join(migration_thread, NULL);230230+231231+ kvm_vm_free(vm);232232+233233+ sys_rseq(RSEQ_FLAG_UNREGISTER);234234+235235+ return 0;236236+}
···4848# When local build is done, headers are installed in the default4949# INSTALL_HDR_PATH usr/include.5050.PHONY: khdr5151+.NOTPARALLEL:5152khdr:5253ifndef KSFT_KHDR_INSTALL_DONE5354ifeq (1,$(DEFAULT_INSTALL_HDR_PATH))