···971971N: Daniel Drake972972E: dsd@gentoo.org973973D: USBAT02 CompactFlash support in usb-storage974974+D: ZD1211RW wireless driver974975S: UK975976976977N: Oleg Drokin
···2020 - snps,dwcmshc-sdhci21212222 reg:2323- minItems: 12424- items:2525- - description: Offset and length of the register set for the device2323+ maxItems: 126242725 interrupts:2826 maxItems: 1
···132132Core Complex Die (CCD) temperatures. Up to 8 such temperatures are reported133133as temp{3..10}_input, labeled Tccd{1..8}. Actual support depends on the CPU134134variant.135135-136136-Various Family 17h and 18h CPUs report voltage and current telemetry137137-information. The following attributes may be reported.138138-139139-Attribute Label Description140140-=============== ======= ================141141-in0_input Vcore Core voltage142142-in1_input Vsoc SoC voltage143143-curr1_input Icore Core current144144-curr2_input Isoc SoC current145145-=============== ======= ================146146-147147-Current values are raw (unscaled) as reported by the CPU. Core current is148148-reported as multiples of 1A / LSB. SoC is reported as multiples of 0.25A149149-/ LSB. The real current is board specific. Reported currents should be seen150150-as rough guidance, and should be scaled using sensors3.conf as appropriate151151-for a given board.
+13-9
MAINTAINERS
···414414F: drivers/acpi/pmic/415415416416ACPI THERMAL DRIVER417417-M: Zhang Rui <rui.zhang@intel.com>417417+M: Rafael J. Wysocki <rafael@kernel.org>418418+R: Zhang Rui <rui.zhang@intel.com>418419L: linux-acpi@vger.kernel.org419420S: Supported420421W: https://01.org/linux-acpi···1276127512771276APPLE DART IOMMU DRIVER12781277M: Sven Peter <sven@svenpeter.dev>12781278+R: Alyssa Rosenzweig <alyssa@rosenzweig.io>12791279L: iommu@lists.linux-foundation.org12801280S: Maintained12811281F: Documentation/devicetree/bindings/iommu/apple,dart.yaml···1713171117141712ARM/APPLE MACHINE SUPPORT17151713M: Hector Martin <marcan@marcan.st>17141714+M: Sven Peter <sven@svenpeter.dev>17151715+R: Alyssa Rosenzweig <alyssa@rosenzweig.io>17161716L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)17171717S: Maintained17181718W: https://asahilinux.org···2240223622412237ARM/MStar/Sigmastar Armv7 SoC support22422238M: Daniel Palmer <daniel@thingy.jp>22392239+M: Romain Perier <romain.perier@gmail.com>22432240L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)22442241S: Maintained22452242W: http://linux-chenxing.org/···2717271227182713ARM/TEXAS INSTRUMENTS K3 ARCHITECTURE27192714M: Nishanth Menon <nm@ti.com>27152715+M: Vignesh Raghavendra <vigneshr@ti.com>27202716M: Tero Kristo <kristo@kernel.org>27212717L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)27222718S: Supported···46624656T: git git://git.samba.org/sfrench/cifs-2.6.git46634657F: Documentation/admin-guide/cifs/46644658F: fs/cifs/46654665-F: fs/cifs_common/46594659+F: fs/smbfs_common/4666466046674661COMPACTPCI HOTPLUG CORE46684662M: Scott Murray <scott@spiteful.org>···86148608F: drivers/iio/humidity/hts221*8615860986168610HUAWEI ETHERNET DRIVER86178617-M: Bin Luo <luobin9@huawei.com>86188611L: netdev@vger.kernel.org86198619-S: Supported86128612+S: Orphan86208613F: Documentation/networking/device_drivers/ethernet/huawei/hinic.rst86218614F: drivers/net/ethernet/huawei/hinic/86228615···1019910194L: linux-cifs@vger.kernel.org1020010195S: Maintained1020110196T: git git://git.samba.org/ksmbd.git1020210202-F: fs/cifs_common/1020310197F: fs/ksmbd/1019810198+F: fs/smbfs_common/10204101991020510200KERNEL UNIT TESTING FRAMEWORK (KUnit)1020610201M: Brendan Higgins <brendanhiggins@google.com>···17798177931779917794STAGING - OLPC SECONDARY DISPLAY CONTROLLER (DCON)1780017795M: Jens Frederich <jfrederich@gmail.com>1780117801-M: Daniel Drake <dsd@laptop.org>1780217796M: Jon Nettleton <jon.nettleton@gmail.com>1780317797S: Maintained1780417798W: http://wiki.laptop.org/go/DCON···1855318549F: drivers/media/radio/radio-raremono.c18554185501855518551THERMAL1855618556-M: Zhang Rui <rui.zhang@intel.com>1855218552+M: Rafael J. Wysocki <rafael@kernel.org>1855718553M: Daniel Lezcano <daniel.lezcano@linaro.org>1855818554R: Amit Kucheria <amitk@kernel.org>1855518555+R: Zhang Rui <rui.zhang@intel.com>1855918556L: linux-pm@vger.kernel.org1856018557S: Supported1856118558Q: https://patchwork.kernel.org/project/linux-pm/list/1856218562-T: git git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git1855918559+T: git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git thermal1856318560F: Documentation/devicetree/bindings/thermal/1856418561F: drivers/thermal/1856518562F: include/linux/cpu_cooling.h···2070320698F: mm/zbud.c20704206992070520700ZD1211RW WIRELESS DRIVER2070620706-M: Daniel Drake <dsd@gentoo.org>2070720701M: Ulrich Kunitz <kune@deine-taler.de>2070820702L: linux-wireless@vger.kernel.org2070920703L: zd1211-devs@lists.sourceforge.net (subscribers-only)
···99/* REVISIT: omap1 legacy drivers still rely on this */1010#include <mach/soc.h>11111212-/*1313- * Bus address is physical address, except for OMAP-1510 Local Bus.1414- * OMAP-1510 bus address is translated into a Local Bus address if the1515- * OMAP bus type is lbus. We do the address translation based on the1616- * device overriding the defaults used in the dma-mapping API.1717- */1818-1919-/*2020- * OMAP-1510 Local Bus address offset2121- */2222-#define OMAP1510_LB_OFFSET UL(0x30000000)2323-2412#endif
+82-34
arch/arm/mach-omap1/usb.c
···1111#include <linux/platform_device.h>1212#include <linux/dma-map-ops.h>1313#include <linux/io.h>1414+#include <linux/delay.h>14151516#include <asm/irq.h>1617···207206208207#endif209208210210-#if IS_ENABLED(CONFIG_USB_OHCI_HCD)211211-212209/* The dmamask must be set for OHCI to work */213210static u64 ohci_dmamask = ~(u32)0;214211···235236236237static inline void ohci_device_init(struct omap_usb_config *pdata)237238{239239+ if (!IS_ENABLED(CONFIG_USB_OHCI_HCD))240240+ return;241241+238242 if (cpu_is_omap7xx())239243 ohci_resources[1].start = INT_7XX_USB_HHC_1;240244 pdata->ohci_device = &ohci_device;241245 pdata->ocpi_enable = &ocpi_enable;242246}243243-244244-#else245245-246246-static inline void ohci_device_init(struct omap_usb_config *pdata)247247-{248248-}249249-250250-#endif251247252248#if defined(CONFIG_USB_OTG) && defined(CONFIG_ARCH_OMAP_OTG)253249···528534}529535530536#ifdef CONFIG_ARCH_OMAP15XX537537+/* OMAP-1510 OHCI has its own MMU for DMA */538538+#define OMAP1510_LB_MEMSIZE 32 /* Should be same as SDRAM size */539539+#define OMAP1510_LB_CLOCK_DIV 0xfffec10c540540+#define OMAP1510_LB_MMU_CTL 0xfffec208541541+#define OMAP1510_LB_MMU_LCK 0xfffec224542542+#define OMAP1510_LB_MMU_LD_TLB 0xfffec228543543+#define OMAP1510_LB_MMU_CAM_H 0xfffec22c544544+#define OMAP1510_LB_MMU_CAM_L 0xfffec230545545+#define OMAP1510_LB_MMU_RAM_H 0xfffec234546546+#define OMAP1510_LB_MMU_RAM_L 0xfffec238547547+548548+/*549549+ * Bus address is physical address, except for OMAP-1510 Local Bus.550550+ * OMAP-1510 bus address is translated into a Local Bus address if the551551+ * OMAP bus type is lbus.552552+ */553553+#define OMAP1510_LB_OFFSET UL(0x30000000)554554+555555+/*556556+ * OMAP-1510 specific Local Bus clock on/off557557+ */558558+static int omap_1510_local_bus_power(int on)559559+{560560+ if (on) {561561+ omap_writel((1 << 1) | (1 << 0), OMAP1510_LB_MMU_CTL);562562+ udelay(200);563563+ } else {564564+ omap_writel(0, OMAP1510_LB_MMU_CTL);565565+ }566566+567567+ return 0;568568+}569569+570570+/*571571+ * OMAP-1510 specific Local Bus initialization572572+ * NOTE: This assumes 32MB memory size in OMAP1510LB_MEMSIZE.573573+ * See also arch/mach-omap/memory.h for __virt_to_dma() and574574+ * __dma_to_virt() which need to match with the physical575575+ * Local Bus address below.576576+ */577577+static int omap_1510_local_bus_init(void)578578+{579579+ unsigned int tlb;580580+ unsigned long lbaddr, physaddr;581581+582582+ omap_writel((omap_readl(OMAP1510_LB_CLOCK_DIV) & 0xfffffff8) | 0x4,583583+ OMAP1510_LB_CLOCK_DIV);584584+585585+ /* Configure the Local Bus MMU table */586586+ for (tlb = 0; tlb < OMAP1510_LB_MEMSIZE; tlb++) {587587+ lbaddr = tlb * 0x00100000 + OMAP1510_LB_OFFSET;588588+ physaddr = tlb * 0x00100000 + PHYS_OFFSET;589589+ omap_writel((lbaddr & 0x0fffffff) >> 22, OMAP1510_LB_MMU_CAM_H);590590+ omap_writel(((lbaddr & 0x003ffc00) >> 6) | 0xc,591591+ OMAP1510_LB_MMU_CAM_L);592592+ omap_writel(physaddr >> 16, OMAP1510_LB_MMU_RAM_H);593593+ omap_writel((physaddr & 0x0000fc00) | 0x300, OMAP1510_LB_MMU_RAM_L);594594+ omap_writel(tlb << 4, OMAP1510_LB_MMU_LCK);595595+ omap_writel(0x1, OMAP1510_LB_MMU_LD_TLB);596596+ }597597+598598+ /* Enable the walking table */599599+ omap_writel(omap_readl(OMAP1510_LB_MMU_CTL) | (1 << 3), OMAP1510_LB_MMU_CTL);600600+ udelay(200);601601+602602+ return 0;603603+}604604+605605+static void omap_1510_local_bus_reset(void)606606+{607607+ omap_1510_local_bus_power(1);608608+ omap_1510_local_bus_init();609609+}531610532611/* ULPD_DPLL_CTRL */533612#define DPLL_IOB (1 << 13)···609542610543/* ULPD_APLL_CTRL */611544#define APLL_NDPLL_SWITCH (1 << 0)612612-613613-static int omap_1510_usb_ohci_notifier(struct notifier_block *nb,614614- unsigned long event, void *data)615615-{616616- struct device *dev = data;617617-618618- if (event != BUS_NOTIFY_ADD_DEVICE)619619- return NOTIFY_DONE;620620-621621- if (strncmp(dev_name(dev), "ohci", 4) == 0 &&622622- dma_direct_set_offset(dev, PHYS_OFFSET, OMAP1510_LB_OFFSET,623623- (u64)-1))624624- WARN_ONCE(1, "failed to set DMA offset\n");625625- return NOTIFY_OK;626626-}627627-628628-static struct notifier_block omap_1510_usb_ohci_nb = {629629- .notifier_call = omap_1510_usb_ohci_notifier,630630-};631545632546static void __init omap_1510_usb_init(struct omap_usb_config *config)633547{···664616 }665617#endif666618667667-#if IS_ENABLED(CONFIG_USB_OHCI_HCD)668668- if (config->register_host) {619619+ if (IS_ENABLED(CONFIG_USB_OHCI_HCD) && config->register_host) {669620 int status;670621671671- bus_register_notifier(&platform_bus_type,672672- &omap_1510_usb_ohci_nb);673622 ohci_device.dev.platform_data = config;623623+ dma_direct_set_offset(&ohci_device.dev, PHYS_OFFSET,624624+ OMAP1510_LB_OFFSET, (u64)-1);674625 status = platform_device_register(&ohci_device);675626 if (status)676627 pr_debug("can't register OHCI device, %d\n", status);677628 /* hcd explicitly gates 48MHz */629629+630630+ config->lb_reset = omap_1510_local_bus_reset;678631 }679679-#endif680632}681633682634#else
···1010#include <linux/io.h>1111#include <linux/types.h>12121313-#include <asm/mips-boards/launch.h>1414-1513extern unsigned long __cps_access_bad_size(void)1614 __compiletime_error("Bad size for CPS accessor");1715···165167 */166168static inline unsigned int mips_cps_numcores(unsigned int cluster)167169{168168- unsigned int ncores;169169-170170 if (!mips_cm_present())171171 return 0;172172173173 /* Add one before masking to handle 0xff indicating no cores */174174- ncores = (mips_cps_cluster_config(cluster) + 1) & CM_GCR_CONFIG_PCORES;175175-176176- if (IS_ENABLED(CONFIG_SOC_MT7621)) {177177- struct cpulaunch *launch;178178-179179- /*180180- * Ralink MT7621S SoC is single core, but the GCR_CONFIG method181181- * always reports 2 cores. Check the second core's LAUNCH_FREADY182182- * flag to detect if the second core is missing. This method183183- * only works before the core has been started.184184- */185185- launch = (struct cpulaunch *)CKSEG0ADDR(CPULAUNCH);186186- launch += 2; /* MT7621 has 2 VPEs per core */187187- if (!(launch->flags & LAUNCH_FREADY))188188- ncores = 1;189189- }190190-191191- return ncores;174174+ return (mips_cps_cluster_config(cluster) + 1) & CM_GCR_CONFIG_PCORES;192175}193176194177/**
···122122 ipi_arg->reserved = 0;123123 ipi_arg->vp_set.valid_bank_mask = 0;124124125125- if (!cpumask_equal(mask, cpu_present_mask)) {125125+ /*126126+ * Use HV_GENERIC_SET_ALL and avoid converting cpumask to VP_SET127127+ * when the IPI is sent to all currently present CPUs.128128+ */129129+ if (!cpumask_equal(mask, cpu_present_mask) || exclude_self) {126130 ipi_arg->vp_set.format = HV_GENERIC_SET_SPARSE_4K;127131 if (exclude_self)128132 nr_bank = cpumask_to_vpset_noself(&(ipi_arg->vp_set), mask);129133 else130134 nr_bank = cpumask_to_vpset(&(ipi_arg->vp_set), mask);131131- }132132- if (nr_bank < 0)133133- goto ipi_mask_ex_done;134134- if (!nr_bank)135135+136136+ /*137137+ * 'nr_bank <= 0' means some CPUs in cpumask can't be138138+ * represented in VP_SET. Return an error and fall back to139139+ * native (architectural) method of sending IPIs.140140+ */141141+ if (nr_bank <= 0)142142+ goto ipi_mask_ex_done;143143+ } else {135144 ipi_arg->vp_set.format = HV_GENERIC_SET_ALL;145145+ }136146137147 status = hv_do_rep_hypercall(HVCALL_SEND_IPI_EX, 0, nr_bank,138148 ipi_arg, NULL);
···4949static struct pvclock_vsyscall_time_info5050 hv_clock_boot[HVC_BOOT_ARRAY_SIZE] __bss_decrypted __aligned(PAGE_SIZE);5151static struct pvclock_wall_clock wall_clock __bss_decrypted;5252-static DEFINE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu);5352static struct pvclock_vsyscall_time_info *hvclock_mem;5454-5555-static inline struct pvclock_vcpu_time_info *this_cpu_pvti(void)5656-{5757- return &this_cpu_read(hv_clock_per_cpu)->pvti;5858-}5959-6060-static inline struct pvclock_vsyscall_time_info *this_cpu_hvclock(void)6161-{6262- return this_cpu_read(hv_clock_per_cpu);6363-}5353+DEFINE_PER_CPU(struct pvclock_vsyscall_time_info *, hv_clock_per_cpu);5454+EXPORT_PER_CPU_SYMBOL_GPL(hv_clock_per_cpu);64556556/*6657 * The wallclock is the time of day when we booted. Since then, some time may
+2-2
arch/x86/kvm/cpuid.c
···6565 for (i = 0; i < nent; i++) {6666 e = &entries[i];67676868- if (e->function == function && (e->index == index ||6969- !(e->flags & KVM_CPUID_FLAG_SIGNIFCANT_INDEX)))6868+ if (e->function == function &&6969+ (!(e->flags & KVM_CPUID_FLAG_SIGNIFCANT_INDEX) || e->index == index))7070 return e;7171 }7272
···26622662 * are likely to increase the throughput.26632663 */26642664 bfqq->new_bfqq = new_bfqq;26652665- /*26662666- * The above assignment schedules the following redirections:26672667- * each time some I/O for bfqq arrives, the process that26682668- * generated that I/O is disassociated from bfqq and26692669- * associated with new_bfqq. Here we increases new_bfqq->ref26702670- * in advance, adding the number of processes that are26712671- * expected to be associated with new_bfqq as they happen to26722672- * issue I/O.26732673- */26742665 new_bfqq->ref += process_refs;26752666 return new_bfqq;26762667}···27232732 void *io_struct, bool request, struct bfq_io_cq *bic)27242733{27252734 struct bfq_queue *in_service_bfqq, *new_bfqq;27262726-27272727- /* if a merge has already been setup, then proceed with that first */27282728- if (bfqq->new_bfqq)27292729- return bfqq->new_bfqq;2730273527312736 /*27322737 * Check delayed stable merge for rotational or non-queueing···28242837 */28252838 if (bfq_too_late_for_merging(bfqq))28262839 return NULL;28402840+28412841+ if (bfqq->new_bfqq)28422842+ return bfqq->new_bfqq;2827284328282844 if (!io_struct || unlikely(bfqq == &bfqd->oom_bfqq))28292845 return NULL;
+12
drivers/acpi/nfit/core.c
···30073007 ndr_desc->target_node = NUMA_NO_NODE;30083008 }3009300930103010+ /* Fallback to address based numa information if node lookup failed */30113011+ if (ndr_desc->numa_node == NUMA_NO_NODE) {30123012+ ndr_desc->numa_node = memory_add_physaddr_to_nid(spa->address);30133013+ dev_info(acpi_desc->dev, "changing numa node from %d to %d for nfit region [%pa-%pa]",30143014+ NUMA_NO_NODE, ndr_desc->numa_node, &res.start, &res.end);30153015+ }30163016+ if (ndr_desc->target_node == NUMA_NO_NODE) {30173017+ ndr_desc->target_node = phys_to_target_node(spa->address);30183018+ dev_info(acpi_desc->dev, "changing target node from %d to %d for nfit region [%pa-%pa]",30193019+ NUMA_NO_NODE, ndr_desc->numa_node, &res.start, &res.end);30203020+ }30213021+30103022 /*30113023 * Persistence domain bits are hierarchical, if30123024 * ACPI_NFIT_CAPABILITY_CACHE_FLUSH is set then
+63-27
drivers/base/core.c
···95959696 list_add(&link->s_hook, &sup->consumers);9797 list_add(&link->c_hook, &con->suppliers);9898+ pr_debug("%pfwP Linked as a fwnode consumer to %pfwP\n",9999+ con, sup);98100out:99101 mutex_unlock(&fwnode_link_lock);100102101103 return ret;104104+}105105+106106+/**107107+ * __fwnode_link_del - Delete a link between two fwnode_handles.108108+ * @link: the fwnode_link to be deleted109109+ *110110+ * The fwnode_link_lock needs to be held when this function is called.111111+ */112112+static void __fwnode_link_del(struct fwnode_link *link)113113+{114114+ pr_debug("%pfwP Dropping the fwnode link to %pfwP\n",115115+ link->consumer, link->supplier);116116+ list_del(&link->s_hook);117117+ list_del(&link->c_hook);118118+ kfree(link);102119}103120104121/**···129112 struct fwnode_link *link, *tmp;130113131114 mutex_lock(&fwnode_link_lock);132132- list_for_each_entry_safe(link, tmp, &fwnode->suppliers, c_hook) {133133- list_del(&link->s_hook);134134- list_del(&link->c_hook);135135- kfree(link);136136- }115115+ list_for_each_entry_safe(link, tmp, &fwnode->suppliers, c_hook)116116+ __fwnode_link_del(link);137117 mutex_unlock(&fwnode_link_lock);138118}139119···145131 struct fwnode_link *link, *tmp;146132147133 mutex_lock(&fwnode_link_lock);148148- list_for_each_entry_safe(link, tmp, &fwnode->consumers, s_hook) {149149- list_del(&link->s_hook);150150- list_del(&link->c_hook);151151- kfree(link);152152- }134134+ list_for_each_entry_safe(link, tmp, &fwnode->consumers, s_hook)135135+ __fwnode_link_del(link);153136 mutex_unlock(&fwnode_link_lock);154137}155138···986975{987976 struct device_link *link;988977 int ret = 0;978978+ struct fwnode_handle *sup_fw;989979990980 /*991981 * Device waiting for supplier to become available is not allowed to···995983 mutex_lock(&fwnode_link_lock);996984 if (dev->fwnode && !list_empty(&dev->fwnode->suppliers) &&997985 !fw_devlink_is_permissive()) {998998- dev_dbg(dev, "probe deferral - wait for supplier %pfwP\n",999999- list_first_entry(&dev->fwnode->suppliers,10001000- struct fwnode_link,10011001- c_hook)->supplier);986986+ sup_fw = list_first_entry(&dev->fwnode->suppliers,987987+ struct fwnode_link,988988+ c_hook)->supplier;989989+ dev_err_probe(dev, -EPROBE_DEFER, "wait for supplier %pfwP\n",990990+ sup_fw);1002991 mutex_unlock(&fwnode_link_lock);1003992 return -EPROBE_DEFER;1004993 }···10141001 if (link->status != DL_STATE_AVAILABLE &&10151002 !(link->flags & DL_FLAG_SYNC_STATE_ONLY)) {10161003 device_links_missing_supplier(dev);10171017- dev_dbg(dev, "probe deferral - supplier %s not ready\n",10181018- dev_name(link->supplier));10041004+ dev_err_probe(dev, -EPROBE_DEFER,10051005+ "supplier %s not ready\n",10061006+ dev_name(link->supplier));10191007 ret = -EPROBE_DEFER;10201008 break;10211009 }···17361722 struct device *sup_dev;17371723 int ret = 0;1738172417251725+ /*17261726+ * In some cases, a device P might also be a supplier to its child node17271727+ * C. However, this would defer the probe of C until the probe of P17281728+ * completes successfully. This is perfectly fine in the device driver17291729+ * model. device_add() doesn't guarantee probe completion of the device17301730+ * by the time it returns.17311731+ *17321732+ * However, there are a few drivers that assume C will finish probing17331733+ * as soon as it's added and before P finishes probing. So, we provide17341734+ * a flag to let fw_devlink know not to delay the probe of C until the17351735+ * probe of P completes successfully.17361736+ *17371737+ * When such a flag is set, we can't create device links where P is the17381738+ * supplier of C as that would delay the probe of C.17391739+ */17401740+ if (sup_handle->flags & FWNODE_FLAG_NEEDS_CHILD_BOUND_ON_ADD &&17411741+ fwnode_is_ancestor_of(sup_handle, con->fwnode))17421742+ return -EINVAL;17431743+17391744 sup_dev = get_dev_from_fwnode(sup_handle);17401745 if (sup_dev) {17411746 /*···18051772 * be broken by applying logic. Check for these types of cycles and18061773 * break them so that devices in the cycle probe properly.18071774 *18081808- * If the supplier's parent is dependent on the consumer, then18091809- * the consumer-supplier dependency is a false dependency. So,18101810- * treat it as an invalid link.17751775+ * If the supplier's parent is dependent on the consumer, then the17761776+ * consumer and supplier have a cyclic dependency. Since fw_devlink17771777+ * can't tell which of the inferred dependencies are incorrect, don't17781778+ * enforce probe ordering between any of the devices in this cyclic17791779+ * dependency. Do this by relaxing all the fw_devlink device links in17801780+ * this cycle and by treating the fwnode link between the consumer and17811781+ * the supplier as an invalid dependency.18111782 */18121783 sup_dev = fwnode_get_next_parent_dev(sup_handle);18131784 if (sup_dev && device_is_dependent(con, sup_dev)) {18141814- dev_dbg(con, "Not linking to %pfwP - False link\n",18151815- sup_handle);17851785+ dev_info(con, "Fixing up cyclic dependency with %pfwP (%s)\n",17861786+ sup_handle, dev_name(sup_dev));17871787+ device_links_write_lock();17881788+ fw_devlink_relax_cycle(con, sup_dev);17891789+ device_links_write_unlock();18161790 ret = -EINVAL;18171791 } else {18181792 /*···18981858 if (!own_link || ret == -EAGAIN)18991859 continue;1900186019011901- list_del(&link->s_hook);19021902- list_del(&link->c_hook);19031903- kfree(link);18611861+ __fwnode_link_del(link);19041862 }19051863}19061864···19501912 if (!own_link || ret == -EAGAIN)19511913 continue;1952191419531953- list_del(&link->s_hook);19541954- list_del(&link->c_hook);19551955- kfree(link);19151915+ __fwnode_link_del(link);1956191619571917 /* If no device link was created, nothing more to do. */19581918 if (ret)
···14641464 /* Quirks that need to be set based on detected module */14651465 SYSC_QUIRK("aess", 0, 0, 0x10, -ENODEV, 0x40000000, 0xffffffff,14661466 SYSC_MODULE_QUIRK_AESS),14671467+ /* Errata i893 handling for dra7 dcan1 and 2 */14681468+ SYSC_QUIRK("dcan", 0x4ae3c000, 0x20, -ENODEV, -ENODEV, 0xa3170504, 0xffffffff,14691469+ SYSC_QUIRK_CLKDM_NOAUTO),14671470 SYSC_QUIRK("dcan", 0x48480000, 0x20, -ENODEV, -ENODEV, 0xa3170504, 0xffffffff,14681471 SYSC_QUIRK_CLKDM_NOAUTO),14691472 SYSC_QUIRK("dss", 0x4832a000, 0, 0x10, 0x14, 0x00000020, 0xffffffff,···29572954 break;29582955 case SOC_AM3:29592956 sysc_add_disabled(0x48310000); /* rng */29572957+ break;29602958 default:29612959 break;29622960 }
+1-1
drivers/firmware/Kconfig
···204204205205config QCOM_SCM206206 tristate "Qcom SCM driver"207207- depends on ARM || ARM64207207+ depends on ARCH_QCOM || COMPILE_TEST208208 depends on HAVE_ARM_SMCCC209209 select RESET_CONTROLLER210210
+1-1
drivers/firmware/arm_scmi/Kconfig
···68686969config ARM_SCMI_TRANSPORT_VIRTIO7070 bool "SCMI transport based on VirtIO"7171- depends on VIRTIO7171+ depends on VIRTIO=y || VIRTIO=ARM_SCMI_PROTOCOL7272 select ARM_SCMI_HAVE_TRANSPORT7373 select ARM_SCMI_HAVE_MSG7474 help
+31-13
drivers/firmware/arm_scmi/virtio.c
···110110 if (vioch->is_rx) {111111 scmi_vio_feed_vq_rx(vioch, msg);112112 } else {113113- unsigned long flags;114114-115115- spin_lock_irqsave(&vioch->lock, flags);113113+ /* Here IRQs are assumed to be already disabled by the caller */114114+ spin_lock(&vioch->lock);116115 list_add(&msg->list, &vioch->free_list);117117- spin_unlock_irqrestore(&vioch->lock, flags);116116+ spin_unlock(&vioch->lock);118117 }119118}120119121120static void scmi_vio_complete_cb(struct virtqueue *vqueue)122121{123122 unsigned long ready_flags;124124- unsigned long flags;125123 unsigned int length;126124 struct scmi_vio_channel *vioch;127125 struct scmi_vio_msg *msg;···138140 goto unlock_ready_out;139141 }140142141141- spin_lock_irqsave(&vioch->lock, flags);143143+ /* IRQs already disabled here no need to irqsave */144144+ spin_lock(&vioch->lock);142145 if (cb_enabled) {143146 virtqueue_disable_cb(vqueue);144147 cb_enabled = false;···150151 goto unlock_out;151152 cb_enabled = true;152153 }153153- spin_unlock_irqrestore(&vioch->lock, flags);154154+ spin_unlock(&vioch->lock);154155155156 if (msg) {156157 msg->rx_len = length;···160161 scmi_finalize_message(vioch, msg);161162 }162163164164+ /*165165+ * Release ready_lock and re-enable IRQs between loop iterations166166+ * to allow virtio_chan_free() to possibly kick in and set the167167+ * flag vioch->ready to false even in between processing of168168+ * messages, so as to force outstanding messages to be ignored169169+ * when system is shutting down.170170+ */163171 spin_unlock_irqrestore(&vioch->ready_lock, ready_flags);164172 }165173166174unlock_out:167167- spin_unlock_irqrestore(&vioch->lock, flags);175175+ spin_unlock(&vioch->lock);168176unlock_ready_out:169177 spin_unlock_irqrestore(&vioch->ready_lock, ready_flags);170178}···390384 struct virtqueue *vqs[VIRTIO_SCMI_VQ_MAX_CNT];391385392386 /* Only one SCMI VirtiO device allowed */393393- if (scmi_vdev)394394- return -EINVAL;387387+ if (scmi_vdev) {388388+ dev_err(dev,389389+ "One SCMI Virtio device was already initialized: only one allowed.\n");390390+ return -EBUSY;391391+ }395392396393 have_vq_rx = scmi_vio_have_vq_rx(vdev);397394 vq_cnt = have_vq_rx ? VIRTIO_SCMI_VQ_MAX_CNT : 1;···437428 }438429439430 vdev->priv = channels;440440- scmi_vdev = vdev;431431+ /* Ensure initialized scmi_vdev is visible */432432+ smp_store_mb(scmi_vdev, vdev);441433442434 return 0;443435}444436445437static void scmi_vio_remove(struct virtio_device *vdev)446438{439439+ /*440440+ * Once we get here, virtio_chan_free() will have already been called by441441+ * the SCMI core for any existing channel and, as a consequence, all the442442+ * virtio channels will have been already marked NOT ready, causing any443443+ * outstanding message on any vqueue to be ignored by complete_cb: now444444+ * we can just stop processing buffers and destroy the vqueues.445445+ */447446 vdev->config->reset(vdev);448447 vdev->config->del_vqs(vdev);449449- scmi_vdev = NULL;448448+ /* Ensure scmi_vdev is visible as NULL */449449+ smp_store_mb(scmi_vdev, NULL);450450}451451452452static int scmi_vio_validate(struct virtio_device *vdev)···494476 return register_virtio_driver(&virtio_scmi_driver);495477}496478497497-static void __exit virtio_scmi_exit(void)479479+static void virtio_scmi_exit(void)498480{499481 unregister_virtio_driver(&virtio_scmi_driver);500482}
+31
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
···837837 return 0;838838}839839840840+/* Mirrors the is_displayable check in radeonsi's gfx6_compute_surface */841841+static int check_tiling_flags_gfx6(struct amdgpu_framebuffer *afb)842842+{843843+ u64 micro_tile_mode;844844+845845+ /* Zero swizzle mode means linear */846846+ if (AMDGPU_TILING_GET(afb->tiling_flags, SWIZZLE_MODE) == 0)847847+ return 0;848848+849849+ micro_tile_mode = AMDGPU_TILING_GET(afb->tiling_flags, MICRO_TILE_MODE);850850+ switch (micro_tile_mode) {851851+ case 0: /* DISPLAY */852852+ case 3: /* RENDER */853853+ return 0;854854+ default:855855+ drm_dbg_kms(afb->base.dev,856856+ "Micro tile mode %llu not supported for scanout\n",857857+ micro_tile_mode);858858+ return -EINVAL;859859+ }860860+}861861+840862static void get_block_dimensions(unsigned int block_log2, unsigned int cpp,841863 unsigned int *width, unsigned int *height)842864{···11251103 const struct drm_mode_fb_cmd2 *mode_cmd,11261104 struct drm_gem_object *obj)11271105{11061106+ struct amdgpu_device *adev = drm_to_adev(dev);11281107 int ret, i;1129110811301109 /*···11441121 ret = amdgpu_display_get_fb_info(rfb, &rfb->tiling_flags, &rfb->tmz_surface);11451122 if (ret)11461123 return ret;11241124+11251125+ if (!dev->mode_config.allow_fb_modifiers) {11261126+ drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,11271127+ "GFX9+ requires FB check based on format modifier\n");11281128+ ret = check_tiling_flags_gfx6(rfb);11291129+ if (ret)11301130+ return ret;11311131+ }1147113211481133 if (dev->mode_config.allow_fb_modifiers &&11491134 !(rfb->base.flags & DRM_MODE_FB_MODIFIERS)) {
+1-1
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
···3599359936003600 /* set static priority for a queue/ring */36013601 gfx_v9_0_mqd_set_priority(ring, mqd);36023602- mqd->cp_hqd_quantum = RREG32(mmCP_HQD_QUANTUM);36023602+ mqd->cp_hqd_quantum = RREG32_SOC15(GC, 0, mmCP_HQD_QUANTUM);3603360336043604 /* map_queues packet doesn't need activate the queue,36053605 * so only kiq need set this field.
+2-1
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
···10981098{10991099 struct amdgpu_device *adev = (struct amdgpu_device *)handle;1100110011011101+ gmc_v10_0_gart_disable(adev);11021102+11011103 if (amdgpu_sriov_vf(adev)) {11021104 /* full access mode, so don't touch any GMC register */11031105 DRM_DEBUG("For SRIOV client, shouldn't do anything.\n");···1108110611091107 amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0);11101108 amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);11111111- gmc_v10_0_gart_disable(adev);1112110911131110 return 0;11141111}
+2-1
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
···17941794{17951795 struct amdgpu_device *adev = (struct amdgpu_device *)handle;1796179617971797+ gmc_v9_0_gart_disable(adev);17981798+17971799 if (amdgpu_sriov_vf(adev)) {17981800 /* full access mode, so don't touch any GMC register */17991801 DRM_DEBUG("For SRIOV client, shouldn't do anything.\n");···1804180218051803 amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0);18061804 amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);18071807- gmc_v9_0_gart_disable(adev);1808180518091806 return 0;18101807}
+8
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
···868868 msleep(1000);869869 }870870871871+ /* TODO: check whether can submit a doorbell request to raise872872+ * a doorbell fence to exit gfxoff.873873+ */874874+ if (adev->in_s0ix)875875+ amdgpu_gfx_off_ctrl(adev, false);876876+871877 sdma_v5_2_soft_reset(adev);872878 /* unhalt the MEs */873879 sdma_v5_2_enable(adev, true);···882876883877 /* start the gfx rings and rlc compute queues */884878 r = sdma_v5_2_gfx_resume(adev);879879+ if (adev->in_s0ix)880880+ amdgpu_gfx_off_ctrl(adev, true);885881 if (r)886882 return r;887883 r = sdma_v5_2_rlc_resume(adev);
···18261826 if (panel_mode == DP_PANEL_MODE_EDP) {18271827 struct cp_psp *cp_psp = &stream->ctx->cp_psp;1828182818291829- if (cp_psp && cp_psp->funcs.enable_assr) {18301830- if (!cp_psp->funcs.enable_assr(cp_psp->handle, link)) {18311831- /* since eDP implies ASSR on, change panel18321832- * mode to disable ASSR18331833- */18341834- panel_mode = DP_PANEL_MODE_DEFAULT;18351835- }18361836- }18291829+ if (cp_psp && cp_psp->funcs.enable_assr)18301830+ /* ASSR is bound to fail with unsigned PSP18311831+ * verstage used during devlopment phase.18321832+ * Report and continue with eDP panel mode to18331833+ * perform eDP link training with right settings18341834+ */18351835+ cp_psp->funcs.enable_assr(cp_psp->handle, link);18371836 }18381837#endif18391838
+1-3
drivers/gpu/drm/exynos/exynos5433_drm_decon.c
···793793{794794 struct device *dev = &pdev->dev;795795 struct decon_context *ctx;796796- struct resource *res;797796 int ret;798797 int i;799798···817818 ctx->clks[i] = clk;818819 }819820820820- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);821821- ctx->addr = devm_ioremap_resource(dev, res);821821+ ctx->addr = devm_platform_ioremap_resource(pdev, 0);822822 if (IS_ERR(ctx->addr))823823 return PTR_ERR(ctx->addr);824824
+1-3
drivers/gpu/drm/exynos/exynos_drm_dsi.c
···17381738static int exynos_dsi_probe(struct platform_device *pdev)17391739{17401740 struct device *dev = &pdev->dev;17411741- struct resource *res;17421741 struct exynos_dsi *dsi;17431742 int ret, i;17441743···17881789 }17891790 }1790179117911791- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);17921792- dsi->reg_base = devm_ioremap_resource(dev, res);17921792+ dsi->reg_base = devm_platform_ioremap_resource(pdev, 0);17931793 if (IS_ERR(dsi->reg_base))17941794 return PTR_ERR(dsi->reg_base);17951795
···362362 return 0;363363}364364365365-static int sw_fence_dummy_notify(struct i915_sw_fence *sf,366366- enum i915_sw_fence_notify state)365365+static int __i915_sw_fence_call366366+sw_fence_dummy_notify(struct i915_sw_fence *sf,367367+ enum i915_sw_fence_notify state)367368{368369 return NOTIFY_DONE;369370}
-2
drivers/gpu/drm/i915/gt/intel_rps.c
···882882 if (!intel_rps_is_enabled(rps))883883 return;884884885885- GEM_BUG_ON(atomic_read(&rps->num_waiters));886886-887885 if (!intel_rps_clear_active(rps))888886 return;889887
···576576577577 /* No one is going to touch shadow bb from now on. */578578 i915_gem_object_flush_map(bb->obj);579579- i915_gem_object_unlock(bb->obj);579579+ i915_gem_ww_ctx_fini(&ww);580580 }581581 }582582 return 0;···630630 return ret;631631 }632632633633- i915_gem_object_unlock(wa_ctx->indirect_ctx.obj);633633+ i915_gem_ww_ctx_fini(&ww);634634635635 /* FIXME: we are not tracking our pinned VMA leaving it636636 * up to the core to fix up the stray pin_count upon
···989989 return ret;990990991991 /* check external clock presence */992992- extclk = devm_clk_get(st->dev, NULL);993993- if (!IS_ERR(extclk)) {992992+ extclk = devm_clk_get_optional(st->dev, NULL);993993+ if (IS_ERR(extclk))994994+ return dev_err_probe(st->dev, PTR_ERR(extclk),995995+ "Failed to get external clock\n");996996+997997+ if (extclk) {994998 unsigned long rate_hz;995999 u8 pre = 0, div, tbctl;9961000 u64 aux;
+9-3
drivers/hwmon/mlxreg-fan.c
···315315{316316 struct mlxreg_fan *fan = cdev->devdata;317317 unsigned long cur_state;318318+ int i, config = 0;318319 u32 regval;319319- int i;320320 int err;321321322322 /*···329329 * overwritten.330330 */331331 if (state >= MLXREG_FAN_SPEED_MIN && state <= MLXREG_FAN_SPEED_MAX) {332332+ /*333333+ * This is configuration change, which is only supported through sysfs.334334+ * For configuration non-zero value is to be returned to avoid thermal335335+ * statistics update.336336+ */337337+ config = 1;332338 state -= MLXREG_FAN_MAX_STATE;333339 for (i = 0; i < state; i++)334340 fan->cooling_levels[i] = state;···349343350344 cur_state = MLXREG_FAN_PWM_DUTY2STATE(regval);351345 if (state < cur_state)352352- return 0;346346+ return config;353347354348 state = cur_state;355349 }···365359 dev_err(fan->dev, "Failed to write PWM duty\n");366360 return err;367361 }368368- return 0;362362+ return config;369363}370364371365static const struct thermal_cooling_device_ops mlxreg_fan_cooling_ops = {
+5-12
drivers/hwmon/occ/common.c
···340340 if (val == OCC_TEMP_SENSOR_FAULT)341341 return -EREMOTEIO;342342343343- /*344344- * VRM doesn't return temperature, only alarm bit. This345345- * attribute maps to tempX_alarm instead of tempX_input for346346- * VRM347347- */348348- if (temp->fru_type != OCC_FRU_TYPE_VRM) {349349- /* sensor not ready */350350- if (val == 0)351351- return -EAGAIN;343343+ /* sensor not ready */344344+ if (val == 0)345345+ return -EAGAIN;352346353353- val *= 1000;354354- }347347+ val *= 1000;355348 break;356349 case 2:357350 val = temp->fru_type;···879886 0, i);880887 attr++;881888882882- if (sensors->temp.version > 1 &&889889+ if (sensors->temp.version == 2 &&883890 temp->fru_type == OCC_FRU_TYPE_VRM) {884891 snprintf(attr->name, sizeof(attr->name),885892 "temp%d_alarm", s);
···3333 unsigned int pointer_read;3434 unsigned int pointer_write;3535 struct tty_port tty_port;3636+ bool tty_registered;3637 union scc2698_channel __iomem *regs;3738 union scc2698_block __iomem *block_regs;3839 unsigned int board_id;···8281 return 0;8382}84838585-static int ipoctal_open(struct tty_struct *tty, struct file *file)8484+static int ipoctal_install(struct tty_driver *driver, struct tty_struct *tty)8685{8786 struct ipoctal_channel *channel = dev_get_drvdata(tty->dev);8887 struct ipoctal *ipoctal = chan_to_ipoctal(channel, tty->index);8989- int err;9090-9191- tty->driver_data = channel;8888+ int res;92899390 if (!ipack_get_carrier(ipoctal->dev))9491 return -EBUSY;95929696- err = tty_port_open(&channel->tty_port, tty, file);9797- if (err)9898- ipack_put_carrier(ipoctal->dev);9393+ res = tty_standard_install(driver, tty);9494+ if (res)9595+ goto err_put_carrier;9996100100- return err;9797+ tty->driver_data = channel;9898+9999+ return 0;100100+101101+err_put_carrier:102102+ ipack_put_carrier(ipoctal->dev);103103+104104+ return res;105105+}106106+107107+static int ipoctal_open(struct tty_struct *tty, struct file *file)108108+{109109+ struct ipoctal_channel *channel = tty->driver_data;110110+111111+ return tty_port_open(&channel->tty_port, tty, file);101112}102113103114static void ipoctal_reset_stats(struct ipoctal_stats *stats)···277264 int res;278265 int i;279266 struct tty_driver *tty;280280- char name[20];281267 struct ipoctal_channel *channel;282268 struct ipack_region *region;283269 void __iomem *addr;···367355 /* Fill struct tty_driver with ipoctal data */368356 tty->owner = THIS_MODULE;369357 tty->driver_name = KBUILD_MODNAME;370370- sprintf(name, KBUILD_MODNAME ".%d.%d.", bus_nr, slot);371371- tty->name = name;358358+ tty->name = kasprintf(GFP_KERNEL, KBUILD_MODNAME ".%d.%d.", bus_nr, slot);359359+ if (!tty->name) {360360+ res = -ENOMEM;361361+ goto err_put_driver;362362+ }372363 tty->major = 0;373364374365 tty->minor_start = 0;···386371 res = tty_register_driver(tty);387372 if (res) {388373 dev_err(&ipoctal->dev->dev, "Can't register tty driver.\n");389389- tty_driver_kref_put(tty);390390- return res;374374+ goto err_free_name;391375 }392376393377 /* Save struct tty_driver for use it when uninstalling the device */···397383398384 channel = &ipoctal->channel[i];399385 tty_port_init(&channel->tty_port);400400- tty_port_alloc_xmit_buf(&channel->tty_port);386386+ res = tty_port_alloc_xmit_buf(&channel->tty_port);387387+ if (res)388388+ continue;401389 channel->tty_port.ops = &ipoctal_tty_port_ops;402390403391 ipoctal_reset_stats(&channel->stats);···407391 spin_lock_init(&channel->lock);408392 channel->pointer_read = 0;409393 channel->pointer_write = 0;410410- tty_dev = tty_port_register_device(&channel->tty_port, tty, i, NULL);394394+ tty_dev = tty_port_register_device_attr(&channel->tty_port, tty,395395+ i, NULL, channel, NULL);411396 if (IS_ERR(tty_dev)) {412397 dev_err(&ipoctal->dev->dev, "Failed to register tty device.\n");398398+ tty_port_free_xmit_buf(&channel->tty_port);413399 tty_port_destroy(&channel->tty_port);414400 continue;415401 }416416- dev_set_drvdata(tty_dev, channel);402402+ channel->tty_registered = true;417403 }418404419405 /*···427409 ipoctal_irq_handler, ipoctal);428410429411 return 0;412412+413413+err_free_name:414414+ kfree(tty->name);415415+err_put_driver:416416+ tty_driver_kref_put(tty);417417+418418+ return res;430419}431420432421static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel,···673648674649static const struct tty_operations ipoctal_fops = {675650 .ioctl = NULL,651651+ .install = ipoctal_install,676652 .open = ipoctal_open,677653 .close = ipoctal_close,678654 .write = ipoctal_write_tty,···716690717691 for (i = 0; i < NR_CHANNELS; i++) {718692 struct ipoctal_channel *channel = &ipoctal->channel[i];693693+694694+ if (!channel->tty_registered)695695+ continue;696696+719697 tty_unregister_device(ipoctal->tty_drv, i);720698 tty_port_free_xmit_buf(&channel->tty_port);721699 tty_port_destroy(&channel->tty_port);722700 }723701724702 tty_unregister_driver(ipoctal->tty_drv);703703+ kfree(ipoctal->tty_drv->name);725704 tty_driver_kref_put(ipoctal->tty_drv);726705 kfree(ipoctal);727706}
+1-1
drivers/net/ethernet/google/gve/gve.h
···779779 gve_num_tx_qpls(priv));780780781781 /* we are out of rx qpls */782782- if (id == priv->qpl_cfg.qpl_map_size)782782+ if (id == gve_num_tx_qpls(priv) + gve_num_rx_qpls(priv))783783 return NULL;784784785785 set_bit(id, priv->qpl_cfg.qpl_id_map);
+29-16
drivers/net/ethernet/google/gve/gve_main.c
···4141{4242 struct gve_priv *priv = netdev_priv(dev);4343 unsigned int start;4444+ u64 packets, bytes;4445 int ring;45464647 if (priv->rx) {···4948 do {5049 start =5150 u64_stats_fetch_begin(&priv->rx[ring].statss);5252- s->rx_packets += priv->rx[ring].rpackets;5353- s->rx_bytes += priv->rx[ring].rbytes;5151+ packets = priv->rx[ring].rpackets;5252+ bytes = priv->rx[ring].rbytes;5453 } while (u64_stats_fetch_retry(&priv->rx[ring].statss,5554 start));5555+ s->rx_packets += packets;5656+ s->rx_bytes += bytes;5657 }5758 }5859 if (priv->tx) {···6259 do {6360 start =6461 u64_stats_fetch_begin(&priv->tx[ring].statss);6565- s->tx_packets += priv->tx[ring].pkt_done;6666- s->tx_bytes += priv->tx[ring].bytes_done;6262+ packets = priv->tx[ring].pkt_done;6363+ bytes = priv->tx[ring].bytes_done;6764 } while (u64_stats_fetch_retry(&priv->tx[ring].statss,6865 start));6666+ s->tx_packets += packets;6767+ s->tx_bytes += bytes;6968 }7069 }7170}···87828883static void gve_free_counter_array(struct gve_priv *priv)8984{8585+ if (!priv->counter_array)8686+ return;8787+9088 dma_free_coherent(&priv->pdev->dev,9189 priv->num_event_counters *9290 sizeof(*priv->counter_array),···150142151143static void gve_free_stats_report(struct gve_priv *priv)152144{145145+ if (!priv->stats_report)146146+ return;147147+153148 del_timer_sync(&priv->stats_report_timer);154149 dma_free_coherent(&priv->pdev->dev, priv->stats_report_len,155150 priv->stats_report, priv->stats_report_bus);···381370{382371 int i;383372384384- if (priv->msix_vectors) {385385- /* Free the irqs */386386- for (i = 0; i < priv->num_ntfy_blks; i++) {387387- struct gve_notify_block *block = &priv->ntfy_blocks[i];388388- int msix_idx = i;373373+ if (!priv->msix_vectors)374374+ return;389375390390- irq_set_affinity_hint(priv->msix_vectors[msix_idx].vector,391391- NULL);392392- free_irq(priv->msix_vectors[msix_idx].vector, block);393393- }394394- free_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector, priv);376376+ /* Free the irqs */377377+ for (i = 0; i < priv->num_ntfy_blks; i++) {378378+ struct gve_notify_block *block = &priv->ntfy_blocks[i];379379+ int msix_idx = i;380380+381381+ irq_set_affinity_hint(priv->msix_vectors[msix_idx].vector,382382+ NULL);383383+ free_irq(priv->msix_vectors[msix_idx].vector, block);395384 }385385+ free_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector, priv);396386 dma_free_coherent(&priv->pdev->dev,397387 priv->num_ntfy_blks * sizeof(*priv->ntfy_blocks),398388 priv->ntfy_blocks, priv->ntfy_block_bus);···1196118411971185void gve_handle_report_stats(struct gve_priv *priv)11981186{11991199- int idx, stats_idx = 0, tx_bytes;12001200- unsigned int start = 0;12011187 struct stats *stats = priv->stats_report->stats;11881188+ int idx, stats_idx = 0;11891189+ unsigned int start = 0;11901190+ u64 tx_bytes;1202119112031192 if (!gve_get_report_stats(priv))12041193 return;
+7-1
drivers/net/ethernet/google/gve/gve_rx.c
···104104 if (!rx->data.page_info)105105 return -ENOMEM;106106107107- if (!rx->data.raw_addressing)107107+ if (!rx->data.raw_addressing) {108108 rx->data.qpl = gve_assign_rx_qpl(priv);109109+ if (!rx->data.qpl) {110110+ kvfree(rx->data.page_info);111111+ rx->data.page_info = NULL;112112+ return -ENOMEM;113113+ }114114+ }109115 for (i = 0; i < slots; i++) {110116 if (!rx->data.raw_addressing) {111117 struct page *page = rx->data.qpl->pages[i];
+3-2
drivers/net/ethernet/intel/i40e/i40e_main.c
···48714871{48724872 int i;4873487348744874- i40e_free_misc_vector(pf);48744874+ if (test_bit(__I40E_MISC_IRQ_REQUESTED, pf->state))48754875+ i40e_free_misc_vector(pf);4875487648764877 i40e_put_lump(pf->irq_pile, pf->iwarp_base_vector,48774878 I40E_IWARP_IRQ_PILE_ID);···1011410113 if (pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOMEM) {1011510114 /* retry with a larger buffer */1011610115 buf_len = data_size;1011710117- } else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK) {1011610116+ } else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK || err) {1011810117 dev_info(&pf->pdev->dev,1011910118 "capability discovery failed, err %s aq_err %s\n",1012010119 i40e_stat_str(&pf->hw, err),
···998998}99999910001000struct ocelot_vcap_filter *10011001-ocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block, int cookie,10021002- bool tc_offload)10011001+ocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block,10021002+ unsigned long cookie, bool tc_offload)10031003{10041004 struct ocelot_vcap_filter *filter;10051005
+3-1
drivers/net/ethernet/pensando/ionic/ionic_lif.c
···12931293 if (err && err != -EEXIST) {12941294 /* set the state back to NEW so we can try again later */12951295 f = ionic_rx_filter_by_addr(lif, addr);12961296- if (f && f->state == IONIC_FILTER_STATE_SYNCED)12961296+ if (f && f->state == IONIC_FILTER_STATE_SYNCED) {12971297 f->state = IONIC_FILTER_STATE_NEW;12981298+ set_bit(IONIC_LIF_F_FILTER_SYNC_NEEDED, lif->state);12991299+ }1298130012991301 spin_unlock_bh(&lif->rx_filters.lock);13001302
···666666{667667 int ret;668668669669+ ret = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_EEE_MCTRL0);670670+ if (ret < 0)671671+ return ret;672672+669673 if (enable) {670674 /* Enable EEE */671675 ret = DW_VR_MII_EEE_LTX_EN | DW_VR_MII_EEE_LRX_EN |···677673 DW_VR_MII_EEE_TX_EN_CTRL | DW_VR_MII_EEE_RX_EN_CTRL |678674 mult_fact_100ns << DW_VR_MII_EEE_MULT_FACT_100NS_SHIFT;679675 } else {680680- ret = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_EEE_MCTRL0);681681- if (ret < 0)682682- return ret;683676 ret &= ~(DW_VR_MII_EEE_LTX_EN | DW_VR_MII_EEE_LRX_EN |684677 DW_VR_MII_EEE_TX_QUIET_EN | DW_VR_MII_EEE_RX_QUIET_EN |685678 DW_VR_MII_EEE_TX_EN_CTRL | DW_VR_MII_EEE_RX_EN_CTRL |···691690 if (ret < 0)692691 return ret;693692694694- ret |= DW_VR_MII_EEE_TRN_LPI;693693+ if (enable)694694+ ret |= DW_VR_MII_EEE_TRN_LPI;695695+ else696696+ ret &= ~DW_VR_MII_EEE_TRN_LPI;697697+695698 return xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_EEE_MCTRL1, ret);696699}697700EXPORT_SYMBOL_GPL(xpcs_config_eee);698701699702static int xpcs_config_aneg_c37_sgmii(struct dw_xpcs *xpcs, unsigned int mode)700703{701701- int ret;704704+ int ret, mdio_ctrl;702705703706 /* For AN for C37 SGMII mode, the settings are :-704704- * 1) VR_MII_AN_CTRL Bit(2:1)[PCS_MODE] = 10b (SGMII AN)705705- * 2) VR_MII_AN_CTRL Bit(3) [TX_CONFIG] = 0b (MAC side SGMII)707707+ * 1) VR_MII_MMD_CTRL Bit(12) [AN_ENABLE] = 0b (Disable SGMII AN in case708708+ it is already enabled)709709+ * 2) VR_MII_AN_CTRL Bit(2:1)[PCS_MODE] = 10b (SGMII AN)710710+ * 3) VR_MII_AN_CTRL Bit(3) [TX_CONFIG] = 0b (MAC side SGMII)706711 * DW xPCS used with DW EQoS MAC is always MAC side SGMII.707707- * 3) VR_MII_DIG_CTRL1 Bit(9) [MAC_AUTO_SW] = 1b (Automatic712712+ * 4) VR_MII_DIG_CTRL1 Bit(9) [MAC_AUTO_SW] = 1b (Automatic708713 * speed/duplex mode change by HW after SGMII AN complete)714714+ * 5) VR_MII_MMD_CTRL Bit(12) [AN_ENABLE] = 1b (Enable SGMII AN)709715 *710716 * Note: Since it is MAC side SGMII, there is no need to set711717 * SR_MII_AN_ADV. MAC side SGMII receives AN Tx Config from···720712 * between PHY and Link Partner. There is also no need to721713 * trigger AN restart for MAC-side SGMII.722714 */715715+ mdio_ctrl = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_CTRL);716716+ if (mdio_ctrl < 0)717717+ return mdio_ctrl;718718+719719+ if (mdio_ctrl & AN_CL37_EN) {720720+ ret = xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_CTRL,721721+ mdio_ctrl & ~AN_CL37_EN);722722+ if (ret < 0)723723+ return ret;724724+ }725725+723726 ret = xpcs_read(xpcs, MDIO_MMD_VEND2, DW_VR_MII_AN_CTRL);724727 if (ret < 0)725728 return ret;···755736 else756737 ret &= ~DW_VR_MII_DIG_CTRL1_MAC_AUTO_SW;757738758758- return xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_DIG_CTRL1, ret);739739+ ret = xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_DIG_CTRL1, ret);740740+ if (ret < 0)741741+ return ret;742742+743743+ if (phylink_autoneg_inband(mode))744744+ ret = xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_MMD_CTRL,745745+ mdio_ctrl | AN_CL37_EN);746746+747747+ return ret;759748}760749761750static int xpcs_config_2500basex(struct dw_xpcs *xpcs)
+11-1
drivers/net/phy/mdio_bus.c
···525525 NULL == bus->read || NULL == bus->write)526526 return -EINVAL;527527528528+ if (bus->parent && bus->parent->of_node)529529+ bus->parent->of_node->fwnode.flags |=530530+ FWNODE_FLAG_NEEDS_CHILD_BOUND_ON_ADD;531531+528532 BUG_ON(bus->state != MDIOBUS_ALLOCATED &&529533 bus->state != MDIOBUS_UNREGISTERED);530534···538534 bus->dev.groups = NULL;539535 dev_set_name(&bus->dev, "%s", bus->id);540536537537+ /* We need to set state to MDIOBUS_UNREGISTERED to correctly release538538+ * the device in mdiobus_free()539539+ *540540+ * State will be updated later in this function in case of success541541+ */542542+ bus->state = MDIOBUS_UNREGISTERED;543543+541544 err = device_register(&bus->dev);542545 if (err) {543546 pr_err("mii_bus %s failed to register\n", bus->id);544544- put_device(&bus->dev);545547 return -EINVAL;546548 }547549
···138138 * 48 bits.139139 */140140 NVME_QUIRK_DMA_ADDRESS_BITS_48 = (1 << 16),141141+142142+ /*143143+ * The controller requires the command_id value be be limited, so skip144144+ * encoding the generation sequence number.145145+ */146146+ NVME_QUIRK_SKIP_CID_GEN = (1 << 17),141147};142148143149/*
···33013301 return 0;3302330233033303 if (!keep_devs) {33043304- /* Delete any children which might still exist. */33043304+ struct list_head removed;33053305+33063306+ /* Move all present children to the list on stack */33073307+ INIT_LIST_HEAD(&removed);33053308 spin_lock_irqsave(&hbus->device_list_lock, flags);33063306- list_for_each_entry_safe(hpdev, tmp, &hbus->children, list_entry) {33093309+ list_for_each_entry_safe(hpdev, tmp, &hbus->children, list_entry)33103310+ list_move_tail(&hpdev->list_entry, &removed);33113311+ spin_unlock_irqrestore(&hbus->device_list_lock, flags);33123312+33133313+ /* Remove all children in the list */33143314+ list_for_each_entry_safe(hpdev, tmp, &removed, list_entry) {33073315 list_del(&hpdev->list_entry);33083316 if (hpdev->pci_slot)33093317 pci_destroy_slot(hpdev->pci_slot);···33193311 put_pcichild(hpdev);33203312 put_pcichild(hpdev);33213313 }33223322- spin_unlock_irqrestore(&hbus->device_list_lock, flags);33233314 }3324331533253316 ret = hv_send_resources_released(hdev);
+2-7
drivers/ptp/ptp_kvm_x86.c
···1515#include <linux/ptp_clock_kernel.h>1616#include <linux/ptp_kvm.h>17171818-struct pvclock_vsyscall_time_info *hv_clock;1919-2018static phys_addr_t clock_pair_gpa;2119static struct kvm_clock_pairing clock_pair;2220···2628 return -ENODEV;27292830 clock_pair_gpa = slow_virt_to_phys(&clock_pair);2929- hv_clock = pvclock_get_pvti_cpu0_va();3030- if (!hv_clock)3131+ if (!pvclock_get_pvti_cpu0_va())3132 return -ENODEV;32333334 ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING, clock_pair_gpa,···6164 struct pvclock_vcpu_time_info *src;6265 unsigned int version;6366 long ret;6464- int cpu;65676666- cpu = smp_processor_id();6767- src = &hv_clock[cpu].pvti;6868+ src = this_cpu_pvti();68696970 do {7071 /*
···262262263263 if (strcmp("free", parm) == 0) {264264 rc = blacklist_parse_parameters(buf, free, 0);265265- /* There could be subchannels without proper devices connected.266266- * evaluate all the entries265265+ /*266266+ * Evaluate the subchannels without an online device. This way,267267+ * no path-verification will be triggered on those subchannels268268+ * and it avoids unnecessary delays.267269 */268268- css_schedule_eval_all();270270+ css_schedule_eval_cond(CSS_EVAL_NOT_ONLINE, 0);269271 } else if (strcmp("add", parm) == 0)270272 rc = blacklist_parse_parameters(buf, add, 0);271273 else if (strcmp("purge", parm) == 0)
+31-9
drivers/s390/cio/css.c
···788788 return 0;789789}790790791791-void css_schedule_eval_all_unreg(unsigned long delay)791791+static int __unset_online(struct device *dev, void *data)792792+{793793+ struct idset *set = data;794794+ struct subchannel *sch = to_subchannel(dev);795795+ struct ccw_device *cdev = sch_get_cdev(sch);796796+797797+ if (cdev && cdev->online)798798+ idset_sch_del(set, sch->schid);799799+800800+ return 0;801801+}802802+803803+void css_schedule_eval_cond(enum css_eval_cond cond, unsigned long delay)792804{793805 unsigned long flags;794794- struct idset *unreg_set;806806+ struct idset *set;795807796808 /* Find unregistered subchannels. */797797- unreg_set = idset_sch_new();798798- if (!unreg_set) {809809+ set = idset_sch_new();810810+ if (!set) {799811 /* Fallback. */800812 css_schedule_eval_all();801813 return;802814 }803803- idset_fill(unreg_set);804804- bus_for_each_dev(&css_bus_type, NULL, unreg_set, __unset_registered);815815+ idset_fill(set);816816+ switch (cond) {817817+ case CSS_EVAL_UNREG:818818+ bus_for_each_dev(&css_bus_type, NULL, set, __unset_registered);819819+ break;820820+ case CSS_EVAL_NOT_ONLINE:821821+ bus_for_each_dev(&css_bus_type, NULL, set, __unset_online);822822+ break;823823+ default:824824+ break;825825+ }826826+805827 /* Apply to slow_subchannel_set. */806828 spin_lock_irqsave(&slow_subchannel_lock, flags);807807- idset_add_set(slow_subchannel_set, unreg_set);829829+ idset_add_set(slow_subchannel_set, set);808830 atomic_set(&css_eval_scheduled, 1);809831 queue_delayed_work(cio_work_q, &slow_path_work, delay);810832 spin_unlock_irqrestore(&slow_subchannel_lock, flags);811811- idset_free(unreg_set);833833+ idset_free(set);812834}813835814836void css_wait_for_slow_path(void)···842820void css_schedule_reprobe(void)843821{844822 /* Schedule with a delay to allow merging of subsequent calls. */845845- css_schedule_eval_all_unreg(1 * HZ);823823+ css_schedule_eval_cond(CSS_EVAL_UNREG, 1 * HZ);846824}847825EXPORT_SYMBOL_GPL(css_schedule_reprobe);848826
+9-1
drivers/s390/cio/css.h
···3434#define SNID_STATE3_MULTI_PATH 13535#define SNID_STATE3_SINGLE_PATH 036363737+/*3838+ * Conditions used to specify which subchannels need evaluation3939+ */4040+enum css_eval_cond {4141+ CSS_EVAL_UNREG, /* unregistered subchannels */4242+ CSS_EVAL_NOT_ONLINE /* sch without an online-device */4343+};4444+3745struct path_state {3846 __u8 state1 : 2; /* path state value 1 */3947 __u8 state2 : 2; /* path state value 2 */···144136/* Helper functions to build lists for the slow path. */145137void css_schedule_eval(struct subchannel_id schid);146138void css_schedule_eval_all(void);147147-void css_schedule_eval_all_unreg(unsigned long delay);139139+void css_schedule_eval_cond(enum css_eval_cond, unsigned long delay);148140int css_complete_work(void);149141150142int sch_is_pseudo_sch(struct subchannel *);
···9898 if (ehdr->e_phnum < 2)9999 return ERR_PTR(-EINVAL);100100101101- if (phdrs[0].p_type == PT_LOAD || phdrs[1].p_type == PT_LOAD)101101+ if (phdrs[0].p_type == PT_LOAD)102102 return ERR_PTR(-EINVAL);103103104104 if ((phdrs[1].p_flags & QCOM_MDT_TYPE_MASK) != QCOM_MDT_TYPE_HASH)
+1-1
drivers/soc/qcom/socinfo.c
···628628 /* Feed the soc specific unique data into entropy pool */629629 add_device_randomness(info, item_size);630630631631- platform_set_drvdata(pdev, qs->soc_dev);631631+ platform_set_drvdata(pdev, qs);632632633633 return 0;634634}
+16-13
drivers/soc/ti/omap_prm.c
···825825 writel_relaxed(v, reset->prm->base + reset->prm->data->rstctrl);826826 spin_unlock_irqrestore(&reset->lock, flags);827827828828- if (!has_rstst)829829- goto exit;830830-831831- /* wait for the status to be set */828828+ /* wait for the reset bit to clear */832829 ret = readl_relaxed_poll_timeout_atomic(reset->prm->base +833833- reset->prm->data->rstst,834834- v, v & BIT(st_bit), 1,835835- OMAP_RESET_MAX_WAIT);830830+ reset->prm->data->rstctrl,831831+ v, !(v & BIT(id)), 1,832832+ OMAP_RESET_MAX_WAIT);836833 if (ret)837834 pr_err("%s: timedout waiting for %s:%lu\n", __func__,838835 reset->prm->data->name, id);839836840840-exit:841841- if (reset->clkdm) {842842- /* At least dra7 iva needs a delay before clkdm idle */843843- if (has_rstst)844844- udelay(1);845845- pdata->clkdm_allow_idle(reset->clkdm);837837+ /* wait for the status to be set */838838+ if (has_rstst) {839839+ ret = readl_relaxed_poll_timeout_atomic(reset->prm->base +840840+ reset->prm->data->rstst,841841+ v, v & BIT(st_bit), 1,842842+ OMAP_RESET_MAX_WAIT);843843+ if (ret)844844+ pr_err("%s: timedout waiting for %s:%lu\n", __func__,845845+ reset->prm->data->name, id);846846 }847847+848848+ if (reset->clkdm)849849+ pdata->clkdm_allow_idle(reset->clkdm);847850848851 return ret;849852}
···4040#include <mach/usb.h>414142424343-/* OMAP-1510 OHCI has its own MMU for DMA */4444-#define OMAP1510_LB_MEMSIZE 32 /* Should be same as SDRAM size */4545-#define OMAP1510_LB_CLOCK_DIV 0xfffec10c4646-#define OMAP1510_LB_MMU_CTL 0xfffec2084747-#define OMAP1510_LB_MMU_LCK 0xfffec2244848-#define OMAP1510_LB_MMU_LD_TLB 0xfffec2284949-#define OMAP1510_LB_MMU_CAM_H 0xfffec22c5050-#define OMAP1510_LB_MMU_CAM_L 0xfffec2305151-#define OMAP1510_LB_MMU_RAM_H 0xfffec2345252-#define OMAP1510_LB_MMU_RAM_L 0xfffec2385353-5443#define DRIVER_DESC "OHCI OMAP driver"55445645struct ohci_omap_priv {···9210393104 return 0;94105}9595-9696-#ifdef CONFIG_ARCH_OMAP15XX9797-/*9898- * OMAP-1510 specific Local Bus clock on/off9999- */100100-static int omap_1510_local_bus_power(int on)101101-{102102- if (on) {103103- omap_writel((1 << 1) | (1 << 0), OMAP1510_LB_MMU_CTL);104104- udelay(200);105105- } else {106106- omap_writel(0, OMAP1510_LB_MMU_CTL);107107- }108108-109109- return 0;110110-}111111-112112-/*113113- * OMAP-1510 specific Local Bus initialization114114- * NOTE: This assumes 32MB memory size in OMAP1510LB_MEMSIZE.115115- * See also arch/mach-omap/memory.h for __virt_to_dma() and116116- * __dma_to_virt() which need to match with the physical117117- * Local Bus address below.118118- */119119-static int omap_1510_local_bus_init(void)120120-{121121- unsigned int tlb;122122- unsigned long lbaddr, physaddr;123123-124124- omap_writel((omap_readl(OMAP1510_LB_CLOCK_DIV) & 0xfffffff8) | 0x4,125125- OMAP1510_LB_CLOCK_DIV);126126-127127- /* Configure the Local Bus MMU table */128128- for (tlb = 0; tlb < OMAP1510_LB_MEMSIZE; tlb++) {129129- lbaddr = tlb * 0x00100000 + OMAP1510_LB_OFFSET;130130- physaddr = tlb * 0x00100000 + PHYS_OFFSET;131131- omap_writel((lbaddr & 0x0fffffff) >> 22, OMAP1510_LB_MMU_CAM_H);132132- omap_writel(((lbaddr & 0x003ffc00) >> 6) | 0xc,133133- OMAP1510_LB_MMU_CAM_L);134134- omap_writel(physaddr >> 16, OMAP1510_LB_MMU_RAM_H);135135- omap_writel((physaddr & 0x0000fc00) | 0x300, OMAP1510_LB_MMU_RAM_L);136136- omap_writel(tlb << 4, OMAP1510_LB_MMU_LCK);137137- omap_writel(0x1, OMAP1510_LB_MMU_LD_TLB);138138- }139139-140140- /* Enable the walking table */141141- omap_writel(omap_readl(OMAP1510_LB_MMU_CTL) | (1 << 3), OMAP1510_LB_MMU_CTL);142142- udelay(200);143143-144144- return 0;145145-}146146-#else147147-#define omap_1510_local_bus_power(x) {}148148-#define omap_1510_local_bus_init() {}149149-#endif150106151107#ifdef CONFIG_USB_OTG152108···163229164230 omap_ohci_clock_power(priv, 1);165231166166- if (cpu_is_omap15xx()) {167167- omap_1510_local_bus_power(1);168168- omap_1510_local_bus_init();169169- }232232+ if (config->lb_reset)233233+ config->lb_reset();170234171235 ret = ohci_setup(hcd);172236 if (ret < 0)
+4-4
fs/9p/cache.c
···2323 .version = 0,2424};25252626-/**2626+/*2727 * v9fs_random_cachetag - Generate a random tag to be associated2828 * with a new cache session.2929 *···233233 unlock_page(page);234234}235235236236-/**236236+/*237237 * __v9fs_readpage_from_fscache - read a page from cache238238 *239239 * Returns 0 if the pages are in cache and a BIO is submitted,···268268 }269269}270270271271-/**271271+/*272272 * __v9fs_readpages_from_fscache - read multiple pages from cache273273 *274274 * Returns 0 if the pages are in cache and a BIO is submitted,···308308 }309309}310310311311-/**311311+/*312312 * __v9fs_readpage_to_fscache - write a page to the cache313313 *314314 */
+7-7
fs/9p/fid.c
···1919#include "v9fs_vfs.h"2020#include "fid.h"21212222+static inline void __add_fid(struct dentry *dentry, struct p9_fid *fid)2323+{2424+ hlist_add_head(&fid->dlist, (struct hlist_head *)&dentry->d_fsdata);2525+}2626+2727+2228/**2329 * v9fs_fid_add - add a fid to a dentry2430 * @dentry: dentry that the fid is being added to2531 * @fid: fid to add2632 *2733 */2828-2929-static inline void __add_fid(struct dentry *dentry, struct p9_fid *fid)3030-{3131- hlist_add_head(&fid->dlist, (struct hlist_head *)&dentry->d_fsdata);3232-}3333-3434void v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid)3535{3636 spin_lock(&dentry->d_lock);···67676868/**6969 * v9fs_open_fid_add - add an open fid to an inode7070- * @dentry: inode that the fid is being added to7070+ * @inode: inode that the fid is being added to7171 * @fid: fid to add7272 *7373 */
+3-5
fs/9p/v9fs.c
···155155/**156156 * v9fs_parse_options - parse mount options into session structure157157 * @v9ses: existing v9fs session information158158+ * @opts: The mount option string158159 *159160 * Return 0 upon success, -ERRNO upon failure.160161 */···543542static struct kobject *v9fs_kobj;544543545544#ifdef CONFIG_9P_FSCACHE546546-/**547547- * caches_show - list caches associated with a session548548- *549549- * Returns the size of buffer written.545545+/*546546+ * List caches associated with a session550547 */551551-552548static ssize_t caches_show(struct kobject *kobj,553549 struct kobj_attribute *attr,554550 char *buf)
+9-5
fs/9p/vfs_addr.c
···30303131/**3232 * v9fs_fid_readpage - read an entire page in from 9P3333- *3434- * @fid: fid being read3333+ * @data: Opaque pointer to the fid being read3534 * @page: structure to page3635 *3736 */···115116116117/**117118 * v9fs_release_page - release the private state associated with a page119119+ * @page: The page to be released120120+ * @gfp: The caller's allocation restrictions118121 *119122 * Returns 1 if the page can be released, false otherwise.120123 */···130129131130/**132131 * v9fs_invalidate_page - Invalidate a page completely or partially133133- *134134- * @page: structure to page135135- * @offset: offset in the page132132+ * @page: The page to be invalidated133133+ * @offset: offset of the invalidated region134134+ * @length: length of the invalidated region136135 */137136138137static void v9fs_invalidate_page(struct page *page, unsigned int offset,···200199201200/**202201 * v9fs_launder_page - Writeback a dirty page202202+ * @page: The page to be cleaned up203203+ *203204 * Returns 0 on success.204205 */205206···222219/**223220 * v9fs_direct_IO - 9P address space operation for direct I/O224221 * @iocb: target I/O control block222222+ * @iter: The data/buffer to use225223 *226224 * The presence of v9fs_direct_IO() in the address space ops vector227225 * allowes open() O_DIRECT flags which would have failed otherwise.
+12-21
fs/9p/vfs_file.c
···359359}360360361361/**362362- * v9fs_file_read - read from a file363363- * @filp: file pointer to read364364- * @udata: user data buffer to read data into365365- * @count: size of buffer366366- * @offset: offset at which to read data362362+ * v9fs_file_read_iter - read from a file363363+ * @iocb: The operation parameters364364+ * @to: The buffer to read into367365 *368366 */369369-370367static ssize_t371368v9fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)372369{···385388}386389387390/**388388- * v9fs_file_write - write to a file389389- * @filp: file pointer to write390390- * @data: data buffer to write data from391391- * @count: size of buffer392392- * @offset: offset at which to write data391391+ * v9fs_file_write_iter - write to a file392392+ * @iocb: The operation parameters393393+ * @from: The data to write393394 *394395 */395396static ssize_t···556561}557562558563/**559559- * v9fs_mmap_file_read - read from a file560560- * @filp: file pointer to read561561- * @data: user data buffer to read data into562562- * @count: size of buffer563563- * @offset: offset at which to read data564564+ * v9fs_mmap_file_read_iter - read from a file565565+ * @iocb: The operation parameters566566+ * @to: The buffer to read into564567 *565568 */566569static ssize_t···569576}570577571578/**572572- * v9fs_mmap_file_write - write to a file573573- * @filp: file pointer to write574574- * @data: data buffer to write data from575575- * @count: size of buffer576576- * @offset: offset at which to write data579579+ * v9fs_mmap_file_write_iter - write to a file580580+ * @iocb: The operation parameters581581+ * @from: The data to write577582 *578583 */579584static ssize_t
+16-8
fs/9p/vfs_inode.c
···218218219219/**220220 * v9fs_alloc_inode - helper function to allocate an inode221221- *221221+ * @sb: The superblock to allocate the inode from222222 */223223struct inode *v9fs_alloc_inode(struct super_block *sb)224224{···238238239239/**240240 * v9fs_free_inode - destroy an inode241241- *241241+ * @inode: The inode to be freed242242 */243243244244void v9fs_free_inode(struct inode *inode)···343343 * v9fs_get_inode - helper function to setup an inode344344 * @sb: superblock345345 * @mode: mode to setup inode with346346- *346346+ * @rdev: The device numbers to set347347 */348348349349struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t rdev)···369369}370370371371/**372372- * v9fs_clear_inode - release an inode372372+ * v9fs_evict_inode - Remove an inode from the inode cache373373 * @inode: inode to release374374 *375375 */···665665666666/**667667 * v9fs_vfs_create - VFS hook to create a regular file668668+ * @mnt_userns: The user namespace of the mount669669+ * @dir: The parent directory670670+ * @dentry: The name of file to be created671671+ * @mode: The UNIX file mode to set672672+ * @excl: True if the file must not yet exist668673 *669674 * open(.., O_CREAT) is handled in v9fs_vfs_atomic_open(). This is only called670675 * for mknod(2).671671- *672672- * @dir: directory inode that is being created673673- * @dentry: dentry that is being deleted674674- * @mode: create permissions675676 *676677 */677678···697696698697/**699698 * v9fs_vfs_mkdir - VFS mkdir hook to create a directory699699+ * @mnt_userns: The user namespace of the mount700700 * @dir: inode that is being unlinked701701 * @dentry: dentry that is being unlinked702702 * @mode: mode for new directory···902900903901/**904902 * v9fs_vfs_rename - VFS hook to rename an inode903903+ * @mnt_userns: The user namespace of the mount905904 * @old_dir: old dir inode906905 * @old_dentry: old dentry907906 * @new_dir: new dir inode908907 * @new_dentry: new dentry908908+ * @flags: RENAME_* flags909909 *910910 */911911···1013100910141010/**10151011 * v9fs_vfs_getattr - retrieve file metadata10121012+ * @mnt_userns: The user namespace of the mount10161013 * @path: Object to query10171014 * @stat: metadata structure to populate10181015 * @request_mask: Mask of STATX_xxx flags indicating the caller's interests···1055105010561051/**10571052 * v9fs_vfs_setattr - set file metadata10531053+ * @mnt_userns: The user namespace of the mount10581054 * @dentry: file whose metadata to set10591055 * @iattr: metadata assignment structure10601056 *···1291128512921286/**12931287 * v9fs_vfs_symlink - helper function to create symlinks12881288+ * @mnt_userns: The user namespace of the mount12941289 * @dir: directory inode containing symlink12951290 * @dentry: dentry for symlink12961291 * @symname: symlink data···1347134013481341/**13491342 * v9fs_vfs_mknod - create a special file13431343+ * @mnt_userns: The user namespace of the mount13501344 * @dir: inode destination for new link13511345 * @dentry: dentry for file13521346 * @mode: mode for creation
+9-2
fs/9p/vfs_inode_dotl.c
···3737 struct dentry *dentry, umode_t omode, dev_t rdev);38383939/**4040- * v9fs_get_fsgid_for_create - Helper function to get the gid for creating a4040+ * v9fs_get_fsgid_for_create - Helper function to get the gid for a new object4141+ * @dir_inode: The directory inode4242+ *4343+ * Helper function to get the gid for creating a4144 * new file system object. This checks the S_ISGID to determine the owning4245 * group of the new file system object.4346 */···214211215212/**216213 * v9fs_vfs_create_dotl - VFS hook to create files for 9P2000.L protocol.214214+ * @mnt_userns: The user namespace of the mount217215 * @dir: directory inode that is being created218216 * @dentry: dentry that is being deleted219217 * @omode: create permissions218218+ * @excl: True if the file must not yet exist220219 *221220 */222222-223221static int224222v9fs_vfs_create_dotl(struct user_namespace *mnt_userns, struct inode *dir,225223 struct dentry *dentry, umode_t omode, bool excl)···365361366362/**367363 * v9fs_vfs_mkdir_dotl - VFS mkdir hook to create a directory364364+ * @mnt_userns: The user namespace of the mount368365 * @dir: inode that is being unlinked369366 * @dentry: dentry that is being unlinked370367 * @omode: mode for new directory···542537543538/**544539 * v9fs_vfs_setattr_dotl - set file metadata540540+ * @mnt_userns: The user namespace of the mount545541 * @dentry: file whose metadata to set546542 * @iattr: metadata assignment structure547543 *···822816823817/**824818 * v9fs_vfs_mknod_dotl - create a special file819819+ * @mnt_userns: The user namespace of the mount825820 * @dir: inode destination for new link826821 * @dentry: dentry for file827822 * @omode: mode for creation
+2-2
fs/afs/dir_silly.c
···8686 return afs_do_sync_operation(op);8787}88888989-/**9090- * afs_sillyrename - Perform a silly-rename of a dentry8989+/*9090+ * Perform silly-rename of a dentry.9191 *9292 * AFS is stateless and the server doesn't know when the client is holding a9393 * file open. To prevent application problems when a file is unlinked while
···59165916}5917591759185918/* Check if *cur is a hole and if it is, skip it */59195919-static void skip_hole(struct inode *inode, ext4_lblk_t *cur)59195919+static int skip_hole(struct inode *inode, ext4_lblk_t *cur)59205920{59215921 int ret;59225922 struct ext4_map_blocks map;···59255925 map.m_len = ((inode->i_size) >> inode->i_sb->s_blocksize_bits) - *cur;5926592659275927 ret = ext4_map_blocks(NULL, inode, &map, 0);59285928+ if (ret < 0)59295929+ return ret;59285930 if (ret != 0)59295929- return;59315931+ return 0;59305932 *cur = *cur + map.m_len;59335933+ return 0;59315934}5932593559335936/* Count number of blocks used by this inode and update i_blocks */···59795976 * iblocks by total number of differences found.59805977 */59815978 cur = 0;59825982- skip_hole(inode, &cur);59795979+ ret = skip_hole(inode, &cur);59805980+ if (ret < 0)59815981+ goto out;59835982 path = ext4_find_extent(inode, cur, NULL, 0);59845983 if (IS_ERR(path))59855984 goto out;···60005995 }60015996 cur = max(cur + 1, le32_to_cpu(ex->ee_block) +60025997 ext4_ext_get_actual_len(ex));60036003- skip_hole(inode, &cur);60046004-59985998+ ret = skip_hole(inode, &cur);59995999+ if (ret < 0) {60006000+ ext4_ext_drop_refs(path);60016001+ kfree(path);60026002+ break;60036003+ }60056004 path2 = ext4_find_extent(inode, cur, NULL, 0);60066005 if (IS_ERR(path2)) {60076006 ext4_ext_drop_refs(path);
+6
fs/ext4/fast_commit.c
···892892 sizeof(lrange), (u8 *)&lrange, crc))893893 return -ENOSPC;894894 } else {895895+ unsigned int max = (map.m_flags & EXT4_MAP_UNWRITTEN) ?896896+ EXT_UNWRITTEN_MAX_LEN : EXT_INIT_MAX_LEN;897897+898898+ /* Limit the number of blocks in one extent */899899+ map.m_len = min(max, map.m_len);900900+895901 fc_ext.fc_ino = cpu_to_le32(inode->i_ino);896902 ex = (struct ext4_extent *)&fc_ext.fc_ex;897903 ex->ee_block = cpu_to_le32(map.m_lblk);
+85-65
fs/ext4/inline.c
···77#include <linux/iomap.h>88#include <linux/fiemap.h>99#include <linux/iversion.h>1010+#include <linux/backing-dev.h>10111112#include "ext4_jbd2.h"1213#include "ext4.h"···734733int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len,735734 unsigned copied, struct page *page)736735{737737- int ret, no_expand;736736+ handle_t *handle = ext4_journal_current_handle();737737+ int no_expand;738738 void *kaddr;739739 struct ext4_iloc iloc;740740+ int ret = 0, ret2;740741741741- if (unlikely(copied < len)) {742742- if (!PageUptodate(page)) {743743- copied = 0;742742+ if (unlikely(copied < len) && !PageUptodate(page))743743+ copied = 0;744744+745745+ if (likely(copied)) {746746+ ret = ext4_get_inode_loc(inode, &iloc);747747+ if (ret) {748748+ unlock_page(page);749749+ put_page(page);750750+ ext4_std_error(inode->i_sb, ret);744751 goto out;745752 }746746- }753753+ ext4_write_lock_xattr(inode, &no_expand);754754+ BUG_ON(!ext4_has_inline_data(inode));747755748748- ret = ext4_get_inode_loc(inode, &iloc);749749- if (ret) {750750- ext4_std_error(inode->i_sb, ret);751751- copied = 0;752752- goto out;753753- }756756+ /*757757+ * ei->i_inline_off may have changed since758758+ * ext4_write_begin() called759759+ * ext4_try_to_write_inline_data()760760+ */761761+ (void) ext4_find_inline_data_nolock(inode);754762755755- ext4_write_lock_xattr(inode, &no_expand);756756- BUG_ON(!ext4_has_inline_data(inode));763763+ kaddr = kmap_atomic(page);764764+ ext4_write_inline_data(inode, &iloc, kaddr, pos, copied);765765+ kunmap_atomic(kaddr);766766+ SetPageUptodate(page);767767+ /* clear page dirty so that writepages wouldn't work for us. */768768+ ClearPageDirty(page);769769+770770+ ext4_write_unlock_xattr(inode, &no_expand);771771+ brelse(iloc.bh);772772+773773+ /*774774+ * It's important to update i_size while still holding page775775+ * lock: page writeout could otherwise come in and zero776776+ * beyond i_size.777777+ */778778+ ext4_update_inode_size(inode, pos + copied);779779+ }780780+ unlock_page(page);781781+ put_page(page);757782758783 /*759759- * ei->i_inline_off may have changed since ext4_write_begin()760760- * called ext4_try_to_write_inline_data()784784+ * Don't mark the inode dirty under page lock. First, it unnecessarily785785+ * makes the holding time of page lock longer. Second, it forces lock786786+ * ordering of page lock and transaction start for journaling787787+ * filesystems.761788 */762762- (void) ext4_find_inline_data_nolock(inode);763763-764764- kaddr = kmap_atomic(page);765765- ext4_write_inline_data(inode, &iloc, kaddr, pos, len);766766- kunmap_atomic(kaddr);767767- SetPageUptodate(page);768768- /* clear page dirty so that writepages wouldn't work for us. */769769- ClearPageDirty(page);770770-771771- ext4_write_unlock_xattr(inode, &no_expand);772772- brelse(iloc.bh);773773- mark_inode_dirty(inode);789789+ if (likely(copied))790790+ mark_inode_dirty(inode);774791out:775775- return copied;792792+ /*793793+ * If we didn't copy as much data as expected, we need to trim back794794+ * size of xattr containing inline data.795795+ */796796+ if (pos + len > inode->i_size && ext4_can_truncate(inode))797797+ ext4_orphan_add(handle, inode);798798+799799+ ret2 = ext4_journal_stop(handle);800800+ if (!ret)801801+ ret = ret2;802802+ if (pos + len > inode->i_size) {803803+ ext4_truncate_failed_write(inode);804804+ /*805805+ * If truncate failed early the inode might still be806806+ * on the orphan list; we need to make sure the inode807807+ * is removed from the orphan list in that case.808808+ */809809+ if (inode->i_nlink)810810+ ext4_orphan_del(NULL, inode);811811+ }812812+ return ret ? ret : copied;776813}777814778815struct buffer_head *···990951out:991952 brelse(iloc.bh);992953 return ret;993993-}994994-995995-int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos,996996- unsigned len, unsigned copied,997997- struct page *page)998998-{999999- int ret;10001000-10011001- ret = ext4_write_inline_data_end(inode, pos, len, copied, page);10021002- if (ret < 0) {10031003- unlock_page(page);10041004- put_page(page);10051005- return ret;10061006- }10071007- copied = ret;10081008-10091009- /*10101010- * No need to use i_size_read() here, the i_size10111011- * cannot change under us because we hold i_mutex.10121012- *10131013- * But it's important to update i_size while still holding page lock:10141014- * page writeout could otherwise come in and zero beyond i_size.10151015- */10161016- if (pos+copied > inode->i_size)10171017- i_size_write(inode, pos+copied);10181018- unlock_page(page);10191019- put_page(page);10201020-10211021- /*10221022- * Don't mark the inode dirty under page lock. First, it unnecessarily10231023- * makes the holding time of page lock longer. Second, it forces lock10241024- * ordering of page lock and transaction start for journaling10251025- * filesystems.10261026- */10271027- mark_inode_dirty(inode);10281028-10291029- return copied;1030954}10319551032956#ifdef INLINE_DIR_DEBUG···19191917 EXT4_I(inode)->i_disksize = i_size;1920191819211919 if (i_size < inline_size) {19201920+ /*19211921+ * if there's inline data to truncate and this file was19221922+ * converted to extents after that inline data was written,19231923+ * the extent status cache must be cleared to avoid leaving19241924+ * behind stale delayed allocated extent entries19251925+ */19261926+ if (!ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA)) {19271927+retry:19281928+ err = ext4_es_remove_extent(inode, 0, EXT_MAX_BLOCKS);19291929+ if (err == -ENOMEM) {19301930+ cond_resched();19311931+ congestion_wait(BLK_RW_ASYNC, HZ/50);19321932+ goto retry;19331933+ }19341934+ if (err)19351935+ goto out_error;19361936+ }19371937+19221938 /* Clear the content in the xattr space. */19231939 if (inline_size > EXT4_MIN_INLINE_DATA_SIZE) {19241940 if ((err = ext4_xattr_ibody_find(inode, &i, &is)) != 0)
+60-118
fs/ext4/inode.c
···12841284 loff_t old_size = inode->i_size;12851285 int ret = 0, ret2;12861286 int i_size_changed = 0;12871287- int inline_data = ext4_has_inline_data(inode);12881287 bool verity = ext4_verity_in_progress(inode);1289128812901289 trace_ext4_write_end(inode, pos, len, copied);12911291- if (inline_data) {12921292- ret = ext4_write_inline_data_end(inode, pos, len,12931293- copied, page);12941294- if (ret < 0) {12951295- unlock_page(page);12961296- put_page(page);12971297- goto errout;12981298- }12991299- copied = ret;13001300- } else13011301- copied = block_write_end(file, mapping, pos,13021302- len, copied, page, fsdata);12901290+12911291+ if (ext4_has_inline_data(inode))12921292+ return ext4_write_inline_data_end(inode, pos, len, copied, page);12931293+12941294+ copied = block_write_end(file, mapping, pos, len, copied, page, fsdata);13031295 /*13041296 * it's important to update i_size while still holding page lock:13051297 * page writeout could otherwise come in and zero beyond i_size.···13121320 * ordering of page lock and transaction start for journaling13131321 * filesystems.13141322 */13151315- if (i_size_changed || inline_data)13231323+ if (i_size_changed)13161324 ret = ext4_mark_inode_dirty(handle, inode);1317132513181326 if (pos + len > inode->i_size && !verity && ext4_can_truncate(inode))···13211329 * inode->i_size. So truncate them13221330 */13231331 ext4_orphan_add(handle, inode);13241324-errout:13321332+13251333 ret2 = ext4_journal_stop(handle);13261334 if (!ret)13271335 ret = ret2;···13871395 int partial = 0;13881396 unsigned from, to;13891397 int size_changed = 0;13901390- int inline_data = ext4_has_inline_data(inode);13911398 bool verity = ext4_verity_in_progress(inode);1392139913931400 trace_ext4_journalled_write_end(inode, pos, len, copied);···1395140413961405 BUG_ON(!ext4_handle_valid(handle));1397140613981398- if (inline_data) {13991399- ret = ext4_write_inline_data_end(inode, pos, len,14001400- copied, page);14011401- if (ret < 0) {14021402- unlock_page(page);14031403- put_page(page);14041404- goto errout;14051405- }14061406- copied = ret;14071407- } else if (unlikely(copied < len) && !PageUptodate(page)) {14071407+ if (ext4_has_inline_data(inode))14081408+ return ext4_write_inline_data_end(inode, pos, len, copied, page);14091409+14101410+ if (unlikely(copied < len) && !PageUptodate(page)) {14081411 copied = 0;14091412 ext4_journalled_zero_new_buffers(handle, inode, page, from, to);14101413 } else {···14211436 if (old_size < pos && !verity)14221437 pagecache_isize_extended(inode, old_size, pos);1423143814241424- if (size_changed || inline_data) {14391439+ if (size_changed) {14251440 ret2 = ext4_mark_inode_dirty(handle, inode);14261441 if (!ret)14271442 ret = ret2;···14341449 */14351450 ext4_orphan_add(handle, inode);1436145114371437-errout:14381452 ret2 = ext4_journal_stop(handle);14391453 if (!ret)14401454 ret = ret2;···16281644 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);16291645 int ret;16301646 bool allocated = false;16471647+ bool reserved = false;1631164816321649 /*16331650 * If the cluster containing lblk is shared with a delayed,···16451660 ret = ext4_da_reserve_space(inode);16461661 if (ret != 0) /* ENOSPC */16471662 goto errout;16631663+ reserved = true;16481664 } else { /* bigalloc */16491665 if (!ext4_es_scan_clu(inode, &ext4_es_is_delonly, lblk)) {16501666 if (!ext4_es_scan_clu(inode,···16581672 ret = ext4_da_reserve_space(inode);16591673 if (ret != 0) /* ENOSPC */16601674 goto errout;16751675+ reserved = true;16611676 } else {16621677 allocated = true;16631678 }···16691682 }1670168316711684 ret = ext4_es_insert_delayed_block(inode, lblk, allocated);16851685+ if (ret && reserved)16861686+ ext4_da_release_space(inode, 1);1672168716731688errout:16741689 return ret;···17111722 }1712172317131724 /*17141714- * Delayed extent could be allocated by fallocate.17151715- * So we need to check it.17251725+ * the buffer head associated with a delayed and not unwritten17261726+ * block found in the extent status cache must contain an17271727+ * invalid block number and have its BH_New and BH_Delay bits17281728+ * set, reflecting the state assigned when the block was17291729+ * initially delayed allocated17161730 */17171717- if (ext4_es_is_delayed(&es) && !ext4_es_is_unwritten(&es)) {17181718- map_bh(bh, inode->i_sb, invalid_block);17191719- set_buffer_new(bh);17201720- set_buffer_delay(bh);17311731+ if (ext4_es_is_delonly(&es)) {17321732+ BUG_ON(bh->b_blocknr != invalid_block);17331733+ BUG_ON(!buffer_new(bh));17341734+ BUG_ON(!buffer_delay(bh));17211735 return 0;17221736 }17231737···29242932 return 0;29252933}2926293429272927-/* We always reserve for an inode update; the superblock could be there too */29282928-static int ext4_da_write_credits(struct inode *inode, loff_t pos, unsigned len)29292929-{29302930- if (likely(ext4_has_feature_large_file(inode->i_sb)))29312931- return 1;29322932-29332933- if (pos + len <= 0x7fffffffULL)29342934- return 1;29352935-29362936- /* We might need to update the superblock to set LARGE_FILE */29372937- return 2;29382938-}29392939-29402935static int ext4_da_write_begin(struct file *file, struct address_space *mapping,29412936 loff_t pos, unsigned len, unsigned flags,29422937 struct page **pagep, void **fsdata)···29322953 struct page *page;29332954 pgoff_t index;29342955 struct inode *inode = mapping->host;29352935- handle_t *handle;2936295629372957 if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))29382958 return -EIO;···29572979 return 0;29582980 }2959298129602960- /*29612961- * grab_cache_page_write_begin() can take a long time if the29622962- * system is thrashing due to memory pressure, or if the page29632963- * is being written back. So grab it first before we start29642964- * the transaction handle. This also allows us to allocate29652965- * the page (if needed) without using GFP_NOFS.29662966- */29672967-retry_grab:29822982+retry:29682983 page = grab_cache_page_write_begin(mapping, index, flags);29692984 if (!page)29702985 return -ENOMEM;29712971- unlock_page(page);2972298629732973- /*29742974- * With delayed allocation, we don't log the i_disksize update29752975- * if there is delayed block allocation. But we still need29762976- * to journalling the i_disksize update if writes to the end29772977- * of file which has an already mapped buffer.29782978- */29792979-retry_journal:29802980- handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE,29812981- ext4_da_write_credits(inode, pos, len));29822982- if (IS_ERR(handle)) {29832983- put_page(page);29842984- return PTR_ERR(handle);29852985- }29862986-29872987- lock_page(page);29882988- if (page->mapping != mapping) {29892989- /* The page got truncated from under us */29902990- unlock_page(page);29912991- put_page(page);29922992- ext4_journal_stop(handle);29932993- goto retry_grab;29942994- }29952987 /* In case writeback began while the page was unlocked */29962988 wait_for_stable_page(page);29972989···29733025#endif29743026 if (ret < 0) {29753027 unlock_page(page);29762976- ext4_journal_stop(handle);30283028+ put_page(page);29773029 /*29783030 * block_write_begin may have instantiated a few blocks29793031 * outside i_size. Trim these off again. Don't need29802980- * i_size_read because we hold i_mutex.30323032+ * i_size_read because we hold inode lock.29813033 */29823034 if (pos + len > inode->i_size)29833035 ext4_truncate_failed_write(inode);2984303629853037 if (ret == -ENOSPC &&29863038 ext4_should_retry_alloc(inode->i_sb, &retries))29872987- goto retry_journal;29882988-29892989- put_page(page);30393039+ goto retry;29903040 return ret;29913041 }29923042···30213075 struct page *page, void *fsdata)30223076{30233077 struct inode *inode = mapping->host;30243024- int ret = 0, ret2;30253025- handle_t *handle = ext4_journal_current_handle();30263078 loff_t new_i_size;30273079 unsigned long start, end;30283080 int write_mode = (int)(unsigned long)fsdata;···30303086 len, copied, page, fsdata);3031308730323088 trace_ext4_da_write_end(inode, pos, len, copied);30333033- start = pos & (PAGE_SIZE - 1);30343034- end = start + copied - 1;30353035-30363036- /*30373037- * generic_write_end() will run mark_inode_dirty() if i_size30383038- * changes. So let's piggyback the i_disksize mark_inode_dirty30393039- * into that.30403040- */30413041- new_i_size = pos + copied;30423042- if (copied && new_i_size > EXT4_I(inode)->i_disksize) {30433043- if (ext4_has_inline_data(inode) ||30443044- ext4_da_should_update_i_disksize(page, end)) {30453045- ext4_update_i_disksize(inode, new_i_size);30463046- /* We need to mark inode dirty even if30473047- * new_i_size is less that inode->i_size30483048- * bu greater than i_disksize.(hint delalloc)30493049- */30503050- ret = ext4_mark_inode_dirty(handle, inode);30513051- }30523052- }3053308930543090 if (write_mode != CONVERT_INLINE_DATA &&30553091 ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA) &&30563092 ext4_has_inline_data(inode))30573057- ret2 = ext4_da_write_inline_data_end(inode, pos, len, copied,30583058- page);30593059- else30603060- ret2 = generic_write_end(file, mapping, pos, len, copied,30613061- page, fsdata);30933093+ return ext4_write_inline_data_end(inode, pos, len, copied, page);3062309430633063- copied = ret2;30643064- if (ret2 < 0)30653065- ret = ret2;30663066- ret2 = ext4_journal_stop(handle);30673067- if (unlikely(ret2 && !ret))30683068- ret = ret2;30953095+ start = pos & (PAGE_SIZE - 1);30963096+ end = start + copied - 1;3069309730703070- return ret ? ret : copied;30983098+ /*30993099+ * Since we are holding inode lock, we are sure i_disksize <=31003100+ * i_size. We also know that if i_disksize < i_size, there are31013101+ * delalloc writes pending in the range upto i_size. If the end of31023102+ * the current write is <= i_size, there's no need to touch31033103+ * i_disksize since writeback will push i_disksize upto i_size31043104+ * eventually. If the end of the current write is > i_size and31053105+ * inside an allocated block (ext4_da_should_update_i_disksize()31063106+ * check), we need to update i_disksize here as neither31073107+ * ext4_writepage() nor certain ext4_writepages() paths not31083108+ * allocating blocks update i_disksize.31093109+ *31103110+ * Note that we defer inode dirtying to generic_write_end() /31113111+ * ext4_da_write_inline_data_end().31123112+ */31133113+ new_i_size = pos + copied;31143114+ if (copied && new_i_size > inode->i_size &&31153115+ ext4_da_should_update_i_disksize(page, end))31163116+ ext4_update_i_disksize(inode, new_i_size);31173117+31183118+ return generic_write_end(file, mapping, pos, len, copied, page, fsdata);30713119}3072312030733121/*···42764340 goto has_buffer;4277434142784342 lock_buffer(bh);43434343+ if (ext4_buffer_uptodate(bh)) {43444344+ /* Someone brought it uptodate while we waited */43454345+ unlock_buffer(bh);43464346+ goto has_buffer;43474347+ }43484348+42794349 /*42804350 * If we have all information of the inode in memory and this42814351 * is the only valid inode in the block, we need not read the
+15-6
fs/ext4/super.c
···658658 * constraints, it may not be safe to do it right here so we659659 * defer superblock flushing to a workqueue.660660 */661661- if (continue_fs)661661+ if (continue_fs && journal)662662 schedule_work(&EXT4_SB(sb)->s_error_work);663663 else664664 ext4_commit_super(sb);···13501350 true);13511351 dump_stack();13521352 }13531353+13541354+ if (EXT4_I(inode)->i_reserved_data_blocks)13551355+ ext4_msg(inode->i_sb, KERN_ERR,13561356+ "Inode %lu (%p): i_reserved_data_blocks (%u) not cleared!",13571357+ inode->i_ino, EXT4_I(inode),13581358+ EXT4_I(inode)->i_reserved_data_blocks);13531359}1354136013551361static void init_once(void *foo)···30273021 */30283022static loff_t ext4_max_bitmap_size(int bits, int has_huge_files)30293023{30303030- loff_t res = EXT4_NDIR_BLOCKS;30243024+ unsigned long long upper_limit, res = EXT4_NDIR_BLOCKS;30313025 int meta_blocks;30323032- loff_t upper_limit;30333033- /* This is calculated to be the largest file size for a dense, block30263026+30273027+ /*30283028+ * This is calculated to be the largest file size for a dense, block30343029 * mapped file such that the file's total number of 512-byte sectors,30353030 * including data and all indirect blocks, does not exceed (2^48 - 1).30363031 *30373032 * __u32 i_blocks_lo and _u16 i_blocks_high represent the total30383033 * number of 512-byte sectors of the file.30393034 */30403040-30413035 if (!has_huge_files) {30423036 /*30433037 * !has_huge_files or implies that the inode i_block field···30803074 if (res > MAX_LFS_FILESIZE)30813075 res = MAX_LFS_FILESIZE;3082307630833083- return res;30773077+ return (loff_t)res;30843078}3085307930863080static ext4_fsblk_t descriptor_loc(struct super_block *sb,···50485042 sbi->s_ea_block_cache = NULL;5049504350505044 if (sbi->s_journal) {50455045+ /* flush s_error_work before journal destroy. */50465046+ flush_work(&sbi->s_error_work);50515047 jbd2_journal_destroy(sbi->s_journal);50525048 sbi->s_journal = NULL;50535049 }50545050failed_mount3a:50555051 ext4_es_unregister_shrinker(sbi);50565052failed_mount3:50535053+ /* flush s_error_work before sbi destroy */50575054 flush_work(&sbi->s_error_work);50585055 del_timer_sync(&sbi->s_err_report);50595056 ext4_stop_mmpd(sbi);
+1-1
fs/fscache/object.c
···7777static WORK_STATE(PARENT_READY, "PRDY", fscache_parent_ready);7878static WORK_STATE(ABORT_INIT, "ABRT", fscache_abort_initialisation);7979static WORK_STATE(LOOK_UP_OBJECT, "LOOK", fscache_look_up_object);8080-static WORK_STATE(CREATE_OBJECT, "CRTO", fscache_look_up_object);8180static WORK_STATE(OBJECT_AVAILABLE, "AVBL", fscache_object_available);8281static WORK_STATE(JUMPSTART_DEPS, "JUMP", fscache_jumpstart_dependents);8382···906907 * @object: The object to ask about907908 * @data: The auxiliary data for the object908909 * @datalen: The size of the auxiliary data910910+ * @object_size: The size of the object according to the server.909911 *910912 * This function consults the netfs about the coherency state of an object.911913 * The caller must be holding a ref on cookie->n_active (held by
+3
fs/fscache/operation.c
···22222323/**2424 * fscache_operation_init - Do basic initialisation of an operation2525+ * @cookie: The cookie to operate on2526 * @op: The operation to initialise2727+ * @processor: The function to perform the operation2828+ * @cancel: A function to handle operation cancellation2629 * @release: The release function to assign2730 *2831 * Do basic initialisation of an operation. The caller must still set flags,
+1-4
fs/io-wq.c
···584584585585 if (!get_signal(&ksig))586586 continue;587587- if (fatal_signal_pending(current) ||588588- signal_group_exit(current->signal))589589- break;590590- continue;587587+ break;591588 }592589 last_timeout = !ret;593590 }
+2-15
fs/io_uring.c
···403403 struct wait_queue_head cq_wait;404404 unsigned cq_extra;405405 atomic_t cq_timeouts;406406- struct fasync_struct *cq_fasync;407406 unsigned cq_last_tm_flush;408407 } ____cacheline_aligned_in_smp;409408···16131614 wake_up(&ctx->sq_data->wait);16141615 if (io_should_trigger_evfd(ctx))16151616 eventfd_signal(ctx->cq_ev_fd, 1);16161616- if (waitqueue_active(&ctx->poll_wait)) {16171617+ if (waitqueue_active(&ctx->poll_wait))16171618 wake_up_interruptible(&ctx->poll_wait);16181618- kill_fasync(&ctx->cq_fasync, SIGIO, POLL_IN);16191619- }16201619}1621162016221621static void io_cqring_ev_posted_iopoll(struct io_ring_ctx *ctx)···16281631 }16291632 if (io_should_trigger_evfd(ctx))16301633 eventfd_signal(ctx->cq_ev_fd, 1);16311631- if (waitqueue_active(&ctx->poll_wait)) {16341634+ if (waitqueue_active(&ctx->poll_wait))16321635 wake_up_interruptible(&ctx->poll_wait);16331633- kill_fasync(&ctx->cq_fasync, SIGIO, POLL_IN);16341634- }16351636}1636163716371638/* Returns true if there are no backlogged entries after the flush */···93409345 return mask;93419346}9342934793439343-static int io_uring_fasync(int fd, struct file *file, int on)93449344-{93459345- struct io_ring_ctx *ctx = file->private_data;93469346-93479347- return fasync_helper(fd, file, on, &ctx->cq_fasync);93489348-}93499349-93509348static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id)93519349{93529350 const struct cred *creds;···1013310145 .mmap_capabilities = io_uring_nommu_mmap_capabilities,1013410146#endif1013510147 .poll = io_uring_poll,1013610136- .fasync = io_uring_fasync,1013710148#ifdef CONFIG_PROC_FS1013810149 .show_fdinfo = io_uring_show_fdinfo,1013910150#endif
+7-2
fs/kernfs/dir.c
···11161116 if (!inode)11171117 inode = ERR_PTR(-ENOMEM);11181118 }11191119- /* Needed only for negative dentry validation */11201120- if (!inode)11191119+ /*11201120+ * Needed for negative dentry validation.11211121+ * The negative dentry can be created in kernfs_iop_lookup()11221122+ * or transforms from positive dentry in dentry_unlink_inode()11231123+ * called from vfs_rmdir().11241124+ */11251125+ if (!IS_ERR(inode))11211126 kernfs_set_rev(parent, dentry);11221127 up_read(&kernfs_rwsem);11231128
-205
fs/ksmbd/auth.c
···6868 memcpy(buf, NEGOTIATE_GSS_HEADER, AUTH_GSS_LENGTH);6969}70707171-static void7272-str_to_key(unsigned char *str, unsigned char *key)7373-{7474- int i;7575-7676- key[0] = str[0] >> 1;7777- key[1] = ((str[0] & 0x01) << 6) | (str[1] >> 2);7878- key[2] = ((str[1] & 0x03) << 5) | (str[2] >> 3);7979- key[3] = ((str[2] & 0x07) << 4) | (str[3] >> 4);8080- key[4] = ((str[3] & 0x0F) << 3) | (str[4] >> 5);8181- key[5] = ((str[4] & 0x1F) << 2) | (str[5] >> 6);8282- key[6] = ((str[5] & 0x3F) << 1) | (str[6] >> 7);8383- key[7] = str[6] & 0x7F;8484- for (i = 0; i < 8; i++)8585- key[i] = (key[i] << 1);8686-}8787-8888-static int8989-smbhash(unsigned char *out, const unsigned char *in, unsigned char *key)9090-{9191- unsigned char key2[8];9292- struct des_ctx ctx;9393-9494- if (fips_enabled) {9595- ksmbd_debug(AUTH, "FIPS compliance enabled: DES not permitted\n");9696- return -ENOENT;9797- }9898-9999- str_to_key(key, key2);100100- des_expand_key(&ctx, key2, DES_KEY_SIZE);101101- des_encrypt(&ctx, out, in);102102- memzero_explicit(&ctx, sizeof(ctx));103103- return 0;104104-}105105-106106-static int ksmbd_enc_p24(unsigned char *p21, const unsigned char *c8, unsigned char *p24)107107-{108108- int rc;109109-110110- rc = smbhash(p24, c8, p21);111111- if (rc)112112- return rc;113113- rc = smbhash(p24 + 8, c8, p21 + 7);114114- if (rc)115115- return rc;116116- return smbhash(p24 + 16, c8, p21 + 14);117117-}118118-119119-/* produce a md4 message digest from data of length n bytes */120120-static int ksmbd_enc_md4(unsigned char *md4_hash, unsigned char *link_str,121121- int link_len)122122-{123123- int rc;124124- struct ksmbd_crypto_ctx *ctx;125125-126126- ctx = ksmbd_crypto_ctx_find_md4();127127- if (!ctx) {128128- ksmbd_debug(AUTH, "Crypto md4 allocation error\n");129129- return -ENOMEM;130130- }131131-132132- rc = crypto_shash_init(CRYPTO_MD4(ctx));133133- if (rc) {134134- ksmbd_debug(AUTH, "Could not init md4 shash\n");135135- goto out;136136- }137137-138138- rc = crypto_shash_update(CRYPTO_MD4(ctx), link_str, link_len);139139- if (rc) {140140- ksmbd_debug(AUTH, "Could not update with link_str\n");141141- goto out;142142- }143143-144144- rc = crypto_shash_final(CRYPTO_MD4(ctx), md4_hash);145145- if (rc)146146- ksmbd_debug(AUTH, "Could not generate md4 hash\n");147147-out:148148- ksmbd_release_crypto_ctx(ctx);149149- return rc;150150-}151151-152152-static int ksmbd_enc_update_sess_key(unsigned char *md5_hash, char *nonce,153153- char *server_challenge, int len)154154-{155155- int rc;156156- struct ksmbd_crypto_ctx *ctx;157157-158158- ctx = ksmbd_crypto_ctx_find_md5();159159- if (!ctx) {160160- ksmbd_debug(AUTH, "Crypto md5 allocation error\n");161161- return -ENOMEM;162162- }163163-164164- rc = crypto_shash_init(CRYPTO_MD5(ctx));165165- if (rc) {166166- ksmbd_debug(AUTH, "Could not init md5 shash\n");167167- goto out;168168- }169169-170170- rc = crypto_shash_update(CRYPTO_MD5(ctx), server_challenge, len);171171- if (rc) {172172- ksmbd_debug(AUTH, "Could not update with challenge\n");173173- goto out;174174- }175175-176176- rc = crypto_shash_update(CRYPTO_MD5(ctx), nonce, len);177177- if (rc) {178178- ksmbd_debug(AUTH, "Could not update with nonce\n");179179- goto out;180180- }181181-182182- rc = crypto_shash_final(CRYPTO_MD5(ctx), md5_hash);183183- if (rc)184184- ksmbd_debug(AUTH, "Could not generate md5 hash\n");185185-out:186186- ksmbd_release_crypto_ctx(ctx);187187- return rc;188188-}189189-19071/**19172 * ksmbd_gen_sess_key() - function to generate session key19273 * @sess: session of connection···206325}207326208327/**209209- * ksmbd_auth_ntlm() - NTLM authentication handler210210- * @sess: session of connection211211- * @pw_buf: NTLM challenge response212212- * @passkey: user password213213- *214214- * Return: 0 on success, error number on error215215- */216216-int ksmbd_auth_ntlm(struct ksmbd_session *sess, char *pw_buf)217217-{218218- int rc;219219- unsigned char p21[21];220220- char key[CIFS_AUTH_RESP_SIZE];221221-222222- memset(p21, '\0', 21);223223- memcpy(p21, user_passkey(sess->user), CIFS_NTHASH_SIZE);224224- rc = ksmbd_enc_p24(p21, sess->ntlmssp.cryptkey, key);225225- if (rc) {226226- pr_err("password processing failed\n");227227- return rc;228228- }229229-230230- ksmbd_enc_md4(sess->sess_key, user_passkey(sess->user),231231- CIFS_SMB1_SESSKEY_SIZE);232232- memcpy(sess->sess_key + CIFS_SMB1_SESSKEY_SIZE, key,233233- CIFS_AUTH_RESP_SIZE);234234- sess->sequence_number = 1;235235-236236- if (strncmp(pw_buf, key, CIFS_AUTH_RESP_SIZE) != 0) {237237- ksmbd_debug(AUTH, "ntlmv1 authentication failed\n");238238- return -EINVAL;239239- }240240-241241- ksmbd_debug(AUTH, "ntlmv1 authentication pass\n");242242- return 0;243243-}244244-245245-/**246328 * ksmbd_auth_ntlmv2() - NTLMv2 authentication handler247329 * @sess: session of connection248330 * @ntlmv2: NTLMv2 challenge response···286442}287443288444/**289289- * __ksmbd_auth_ntlmv2() - NTLM2(extended security) authentication handler290290- * @sess: session of connection291291- * @client_nonce: client nonce from LM response.292292- * @ntlm_resp: ntlm response data from client.293293- *294294- * Return: 0 on success, error number on error295295- */296296-static int __ksmbd_auth_ntlmv2(struct ksmbd_session *sess, char *client_nonce,297297- char *ntlm_resp)298298-{299299- char sess_key[CIFS_SMB1_SESSKEY_SIZE] = {0};300300- int rc;301301- unsigned char p21[21];302302- char key[CIFS_AUTH_RESP_SIZE];303303-304304- rc = ksmbd_enc_update_sess_key(sess_key,305305- client_nonce,306306- (char *)sess->ntlmssp.cryptkey, 8);307307- if (rc) {308308- pr_err("password processing failed\n");309309- goto out;310310- }311311-312312- memset(p21, '\0', 21);313313- memcpy(p21, user_passkey(sess->user), CIFS_NTHASH_SIZE);314314- rc = ksmbd_enc_p24(p21, sess_key, key);315315- if (rc) {316316- pr_err("password processing failed\n");317317- goto out;318318- }319319-320320- if (memcmp(ntlm_resp, key, CIFS_AUTH_RESP_SIZE) != 0)321321- rc = -EINVAL;322322-out:323323- return rc;324324-}325325-326326-/**327445 * ksmbd_decode_ntlmssp_auth_blob() - helper function to construct328446 * authenticate blob329447 * @authblob: authenticate blob source pointer···317511 lm_off = le32_to_cpu(authblob->LmChallengeResponse.BufferOffset);318512 nt_off = le32_to_cpu(authblob->NtChallengeResponse.BufferOffset);319513 nt_len = le16_to_cpu(authblob->NtChallengeResponse.Length);320320-321321- /* process NTLM authentication */322322- if (nt_len == CIFS_AUTH_RESP_SIZE) {323323- if (le32_to_cpu(authblob->NegotiateFlags) &324324- NTLMSSP_NEGOTIATE_EXTENDED_SEC)325325- return __ksmbd_auth_ntlmv2(sess, (char *)authblob +326326- lm_off, (char *)authblob + nt_off);327327- else328328- return ksmbd_auth_ntlm(sess, (char *)authblob +329329- nt_off);330330- }331514332515 /* TODO : use domain name that imported from configuration file */333516 domain_name = smb_strndup_from_utf16((const char *)authblob +
···14511451 */14521452struct create_context *smb2_find_context_vals(void *open_req, const char *tag)14531453{14541454- char *data_offset;14551454 struct create_context *cc;14561455 unsigned int next = 0;14571456 char *name;14581457 struct smb2_create_req *req = (struct smb2_create_req *)open_req;14581458+ unsigned int remain_len, name_off, name_len, value_off, value_len,14591459+ cc_len;1459146014601460- data_offset = (char *)req + 4 + le32_to_cpu(req->CreateContextsOffset);14611461- cc = (struct create_context *)data_offset;14611461+ /*14621462+ * CreateContextsOffset and CreateContextsLength are guaranteed to14631463+ * be valid because of ksmbd_smb2_check_message().14641464+ */14651465+ cc = (struct create_context *)((char *)req + 4 +14661466+ le32_to_cpu(req->CreateContextsOffset));14671467+ remain_len = le32_to_cpu(req->CreateContextsLength);14621468 do {14631463- int val;14641464-14651469 cc = (struct create_context *)((char *)cc + next);14661466- name = le16_to_cpu(cc->NameOffset) + (char *)cc;14671467- val = le16_to_cpu(cc->NameLength);14681468- if (val < 4)14701470+ if (remain_len < offsetof(struct create_context, Buffer))14691471 return ERR_PTR(-EINVAL);1470147214711471- if (memcmp(name, tag, val) == 0)14721472- return cc;14731473 next = le32_to_cpu(cc->Next);14741474+ name_off = le16_to_cpu(cc->NameOffset);14751475+ name_len = le16_to_cpu(cc->NameLength);14761476+ value_off = le16_to_cpu(cc->DataOffset);14771477+ value_len = le32_to_cpu(cc->DataLength);14781478+ cc_len = next ? next : remain_len;14791479+14801480+ if ((next & 0x7) != 0 ||14811481+ next > remain_len ||14821482+ name_off != offsetof(struct create_context, Buffer) ||14831483+ name_len < 4 ||14841484+ name_off + name_len > cc_len ||14851485+ (value_off & 0x7) != 0 ||14861486+ (value_off && (value_off < name_off + name_len)) ||14871487+ ((u64)value_off + value_len > cc_len))14881488+ return ERR_PTR(-EINVAL);14891489+14901490+ name = (char *)cc + name_off;14911491+ if (memcmp(name, tag, name_len) == 0)14921492+ return cc;14931493+14941494+ remain_len -= next;14741495 } while (next != 0);1475149614761497 return NULL;
+197-61
fs/ksmbd/smb2pdu.c
···459459bool is_chained_smb2_message(struct ksmbd_work *work)460460{461461 struct smb2_hdr *hdr = work->request_buf;462462- unsigned int len;462462+ unsigned int len, next_cmd;463463464464 if (hdr->ProtocolId != SMB2_PROTO_NUMBER)465465 return false;466466467467 hdr = ksmbd_req_buf_next(work);468468- if (le32_to_cpu(hdr->NextCommand) > 0) {468468+ next_cmd = le32_to_cpu(hdr->NextCommand);469469+ if (next_cmd > 0) {470470+ if ((u64)work->next_smb2_rcv_hdr_off + next_cmd +471471+ __SMB2_HEADER_STRUCTURE_SIZE >472472+ get_rfc1002_len(work->request_buf)) {473473+ pr_err("next command(%u) offset exceeds smb msg size\n",474474+ next_cmd);475475+ return false;476476+ }477477+469478 ksmbd_debug(SMB, "got SMB2 chained command\n");470479 init_chained_smb2_rsp(work);471480 return true;···10671058 struct smb2_negotiate_req *req = work->request_buf;10681059 struct smb2_negotiate_rsp *rsp = work->response_buf;10691060 int rc = 0;10611061+ unsigned int smb2_buf_len, smb2_neg_size;10701062 __le32 status;1071106310721064 ksmbd_debug(SMB, "Received negotiate request\n");···10831073 rsp->hdr.Status = STATUS_INVALID_PARAMETER;10841074 rc = -EINVAL;10851075 goto err_out;10761076+ }10771077+10781078+ smb2_buf_len = get_rfc1002_len(work->request_buf);10791079+ smb2_neg_size = offsetof(struct smb2_negotiate_req, Dialects) - 4;10801080+ if (smb2_neg_size > smb2_buf_len) {10811081+ rsp->hdr.Status = STATUS_INVALID_PARAMETER;10821082+ rc = -EINVAL;10831083+ goto err_out;10841084+ }10851085+10861086+ if (conn->dialect == SMB311_PROT_ID) {10871087+ unsigned int nego_ctxt_off = le32_to_cpu(req->NegotiateContextOffset);10881088+10891089+ if (smb2_buf_len < nego_ctxt_off) {10901090+ rsp->hdr.Status = STATUS_INVALID_PARAMETER;10911091+ rc = -EINVAL;10921092+ goto err_out;10931093+ }10941094+10951095+ if (smb2_neg_size > nego_ctxt_off) {10961096+ rsp->hdr.Status = STATUS_INVALID_PARAMETER;10971097+ rc = -EINVAL;10981098+ goto err_out;10991099+ }11001100+11011101+ if (smb2_neg_size + le16_to_cpu(req->DialectCount) * sizeof(__le16) >11021102+ nego_ctxt_off) {11031103+ rsp->hdr.Status = STATUS_INVALID_PARAMETER;11041104+ rc = -EINVAL;11051105+ goto err_out;11061106+ }11071107+ } else {11081108+ if (smb2_neg_size + le16_to_cpu(req->DialectCount) * sizeof(__le16) >11091109+ smb2_buf_len) {11101110+ rsp->hdr.Status = STATUS_INVALID_PARAMETER;11111111+ rc = -EINVAL;11121112+ goto err_out;11131113+ }10861114 }1087111510881116 conn->cli_cap = le32_to_cpu(req->Capabilities);···21412093 * smb2_set_ea() - handler for setting extended attributes using set21422094 * info command21432095 * @eabuf: set info command buffer20962096+ * @buf_len: set info command buffer length21442097 * @path: dentry path for get ea21452098 *21462099 * Return: 0 on success, otherwise error21472100 */21482148-static int smb2_set_ea(struct smb2_ea_info *eabuf, struct path *path)21012101+static int smb2_set_ea(struct smb2_ea_info *eabuf, unsigned int buf_len,21022102+ struct path *path)21492103{21502104 struct user_namespace *user_ns = mnt_user_ns(path->mnt);21512105 char *attr_name = NULL, *value;21522106 int rc = 0;21532153- int next = 0;21072107+ unsigned int next = 0;21082108+21092109+ if (buf_len < sizeof(struct smb2_ea_info) + eabuf->EaNameLength +21102110+ le16_to_cpu(eabuf->EaValueLength))21112111+ return -EINVAL;2154211221552113 attr_name = kmalloc(XATTR_NAME_MAX + 1, GFP_KERNEL);21562114 if (!attr_name)···2221216722222168next:22232169 next = le32_to_cpu(eabuf->NextEntryOffset);21702170+ if (next == 0 || buf_len < next)21712171+ break;21722172+ buf_len -= next;22242173 eabuf = (struct smb2_ea_info *)((char *)eabuf + next);21742174+ if (next < (u32)eabuf->EaNameLength + le16_to_cpu(eabuf->EaValueLength))21752175+ break;21762176+22252177 } while (next != 0);2226217822272179 kfree(attr_name);···24272367 ksmbd_debug(SMB,24282368 "Set ACLs using SMB2_CREATE_SD_BUFFER context\n");24292369 sd_buf = (struct create_sd_buf_req *)context;23702370+ if (le16_to_cpu(context->DataOffset) +23712371+ le32_to_cpu(context->DataLength) <23722372+ sizeof(struct create_sd_buf_req))23732373+ return -EINVAL;24302374 return set_info_sec(work->conn, work->tcon, path, &sd_buf->ntsd,24312375 le32_to_cpu(sd_buf->ccontext.DataLength), true);24322376}···26252561 goto err_out1;26262562 } else if (context) {26272563 ea_buf = (struct create_ea_buf_req *)context;25642564+ if (le16_to_cpu(context->DataOffset) +25652565+ le32_to_cpu(context->DataLength) <25662566+ sizeof(struct create_ea_buf_req)) {25672567+ rc = -EINVAL;25682568+ goto err_out1;25692569+ }26282570 if (req->CreateOptions & FILE_NO_EA_KNOWLEDGE_LE) {26292571 rsp->hdr.Status = STATUS_ACCESS_DENIED;26302572 rc = -EACCES;···26692599 } else if (context) {26702600 struct create_posix *posix =26712601 (struct create_posix *)context;26022602+ if (le16_to_cpu(context->DataOffset) +26032603+ le32_to_cpu(context->DataLength) <26042604+ sizeof(struct create_posix)) {26052605+ rc = -EINVAL;26062606+ goto err_out1;26072607+ }26722608 ksmbd_debug(SMB, "get posix context\n");2673260926742610 posix_mode = le32_to_cpu(posix->Mode);···28242748 created = true;28252749 user_ns = mnt_user_ns(path.mnt);28262750 if (ea_buf) {28272827- rc = smb2_set_ea(&ea_buf->ea, &path);27512751+ if (le32_to_cpu(ea_buf->ccontext.DataLength) <27522752+ sizeof(struct smb2_ea_info)) {27532753+ rc = -EINVAL;27542754+ goto err_out;27552755+ }27562756+27572757+ rc = smb2_set_ea(&ea_buf->ea,27582758+ le32_to_cpu(ea_buf->ccontext.DataLength),27592759+ &path);28282760 if (rc == -EOPNOTSUPP)28292761 rc = 0;28302762 else if (rc)···30652981 rc = PTR_ERR(az_req);30662982 goto err_out;30672983 } else if (az_req) {30683068- loff_t alloc_size = le64_to_cpu(az_req->AllocationSize);29842984+ loff_t alloc_size;30692985 int err;3070298629872987+ if (le16_to_cpu(az_req->ccontext.DataOffset) +29882988+ le32_to_cpu(az_req->ccontext.DataLength) <29892989+ sizeof(struct create_alloc_size_req)) {29902990+ rc = -EINVAL;29912991+ goto err_out;29922992+ }29932993+ alloc_size = le64_to_cpu(az_req->AllocationSize);30712994 ksmbd_debug(SMB,30722995 "request smb2 create allocate size : %llu\n",30732996 alloc_size);···42434152static int get_file_basic_info(struct smb2_query_info_rsp *rsp,42444153 struct ksmbd_file *fp, void *rsp_org)42454154{42464246- struct smb2_file_all_info *basic_info;41554155+ struct smb2_file_basic_info *basic_info;42474156 struct kstat stat;42484157 u64 time;42494158···42534162 return -EACCES;42544163 }4255416442564256- basic_info = (struct smb2_file_all_info *)rsp->Buffer;41654165+ basic_info = (struct smb2_file_basic_info *)rsp->Buffer;42574166 generic_fillattr(file_mnt_user_ns(fp->filp), file_inode(fp->filp),42584167 &stat);42594168 basic_info->CreationTime = cpu_to_le64(fp->create_time);···42664175 basic_info->Attributes = fp->f_ci->m_fattr;42674176 basic_info->Pad1 = 0;42684177 rsp->OutputBufferLength =42694269- cpu_to_le32(offsetof(struct smb2_file_all_info, AllocationSize));42704270- inc_rfc1001_len(rsp_org, offsetof(struct smb2_file_all_info,42714271- AllocationSize));41784178+ cpu_to_le32(sizeof(struct smb2_file_basic_info));41794179+ inc_rfc1001_len(rsp_org, sizeof(struct smb2_file_basic_info));42724180 return 0;42734181}42744182···54235333static int smb2_create_link(struct ksmbd_work *work,54245334 struct ksmbd_share_config *share,54255335 struct smb2_file_link_info *file_info,54265426- struct file *filp,53365336+ unsigned int buf_len, struct file *filp,54275337 struct nls_table *local_nls)54285338{54295339 char *link_name = NULL, *target_name = NULL, *pathname = NULL;54305340 struct path path;54315341 bool file_present = true;54325342 int rc;53435343+53445344+ if (buf_len < (u64)sizeof(struct smb2_file_link_info) +53455345+ le32_to_cpu(file_info->FileNameLength))53465346+ return -EINVAL;5433534754345348 ksmbd_debug(SMB, "setting FILE_LINK_INFORMATION\n");54355349 pathname = kmalloc(PATH_MAX, GFP_KERNEL);···54945400 return rc;54955401}5496540254975497-static int set_file_basic_info(struct ksmbd_file *fp, char *buf,54035403+static int set_file_basic_info(struct ksmbd_file *fp,54045404+ struct smb2_file_basic_info *file_info,54985405 struct ksmbd_share_config *share)54995406{55005500- struct smb2_file_all_info *file_info;55015407 struct iattr attrs;55025408 struct timespec64 ctime;55035409 struct file *filp;···55085414 if (!(fp->daccess & FILE_WRITE_ATTRIBUTES_LE))55095415 return -EACCES;5510541655115511- file_info = (struct smb2_file_all_info *)buf;55125417 attrs.ia_valid = 0;55135418 filp = fp->filp;55145419 inode = file_inode(filp);···55845491}5585549255865493static int set_file_allocation_info(struct ksmbd_work *work,55875587- struct ksmbd_file *fp, char *buf)54945494+ struct ksmbd_file *fp,54955495+ struct smb2_file_alloc_info *file_alloc_info)55885496{55895497 /*55905498 * TODO : It's working fine only when store dos attributes···55935499 * properly with any smb.conf option55945500 */5595550155965596- struct smb2_file_alloc_info *file_alloc_info;55975502 loff_t alloc_blks;55985503 struct inode *inode;55995504 int rc;···56005507 if (!(fp->daccess & FILE_WRITE_DATA_LE))56015508 return -EACCES;5602550956035603- file_alloc_info = (struct smb2_file_alloc_info *)buf;56045510 alloc_blks = (le64_to_cpu(file_alloc_info->AllocationSize) + 511) >> 9;56055511 inode = file_inode(fp->filp);56065512···56355543}5636554456375545static int set_end_of_file_info(struct ksmbd_work *work, struct ksmbd_file *fp,56385638- char *buf)55465546+ struct smb2_file_eof_info *file_eof_info)56395547{56405640- struct smb2_file_eof_info *file_eof_info;56415548 loff_t newsize;56425549 struct inode *inode;56435550 int rc;···56445553 if (!(fp->daccess & FILE_WRITE_DATA_LE))56455554 return -EACCES;5646555556475647- file_eof_info = (struct smb2_file_eof_info *)buf;56485556 newsize = le64_to_cpu(file_eof_info->EndOfFile);56495557 inode = file_inode(fp->filp);56505558···56705580}5671558156725582static int set_rename_info(struct ksmbd_work *work, struct ksmbd_file *fp,56735673- char *buf)55835583+ struct smb2_file_rename_info *rename_info,55845584+ unsigned int buf_len)56745585{56755586 struct user_namespace *user_ns;56765587 struct ksmbd_file *parent_fp;···56835592 pr_err("no right to delete : 0x%x\n", fp->daccess);56845593 return -EACCES;56855594 }55955595+55965596+ if (buf_len < (u64)sizeof(struct smb2_file_rename_info) +55975597+ le32_to_cpu(rename_info->FileNameLength))55985598+ return -EINVAL;5686559956875600 user_ns = file_mnt_user_ns(fp->filp);56885601 if (ksmbd_stream_fd(fp))···57105615 }57115616 }57125617next:57135713- return smb2_rename(work, fp, user_ns,57145714- (struct smb2_file_rename_info *)buf,56185618+ return smb2_rename(work, fp, user_ns, rename_info,57155619 work->sess->conn->local_nls);57165620}5717562157185718-static int set_file_disposition_info(struct ksmbd_file *fp, char *buf)56225622+static int set_file_disposition_info(struct ksmbd_file *fp,56235623+ struct smb2_file_disposition_info *file_info)57195624{57205720- struct smb2_file_disposition_info *file_info;57215625 struct inode *inode;5722562657235627 if (!(fp->daccess & FILE_DELETE_LE)) {···57255631 }5726563257275633 inode = file_inode(fp->filp);57285728- file_info = (struct smb2_file_disposition_info *)buf;57295634 if (file_info->DeletePending) {57305635 if (S_ISDIR(inode->i_mode) &&57315636 ksmbd_vfs_empty_dir(fp) == -ENOTEMPTY)···57365643 return 0;57375644}5738564557395739-static int set_file_position_info(struct ksmbd_file *fp, char *buf)56465646+static int set_file_position_info(struct ksmbd_file *fp,56475647+ struct smb2_file_pos_info *file_info)57405648{57415741- struct smb2_file_pos_info *file_info;57425649 loff_t current_byte_offset;57435650 unsigned long sector_size;57445651 struct inode *inode;5745565257465653 inode = file_inode(fp->filp);57475747- file_info = (struct smb2_file_pos_info *)buf;57485654 current_byte_offset = le64_to_cpu(file_info->CurrentByteOffset);57495655 sector_size = inode->i_sb->s_blocksize;57505656···57595667 return 0;57605668}5761566957625762-static int set_file_mode_info(struct ksmbd_file *fp, char *buf)56705670+static int set_file_mode_info(struct ksmbd_file *fp,56715671+ struct smb2_file_mode_info *file_info)57635672{57645764- struct smb2_file_mode_info *file_info;57655673 __le32 mode;5766567457675767- file_info = (struct smb2_file_mode_info *)buf;57685675 mode = file_info->Mode;5769567657705677 if ((mode & ~FILE_MODE_INFO_MASK) ||···57935702 * TODO: need to implement an error handling for STATUS_INFO_LENGTH_MISMATCH57945703 */57955704static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,57965796- int info_class, char *buf,57055705+ struct smb2_set_info_req *req,57975706 struct ksmbd_share_config *share)57985707{57995799- switch (info_class) {57085708+ unsigned int buf_len = le32_to_cpu(req->BufferLength);57095709+57105710+ switch (req->FileInfoClass) {58005711 case FILE_BASIC_INFORMATION:58015801- return set_file_basic_info(fp, buf, share);57125712+ {57135713+ if (buf_len < sizeof(struct smb2_file_basic_info))57145714+ return -EINVAL;5802571557165716+ return set_file_basic_info(fp, (struct smb2_file_basic_info *)req->Buffer, share);57175717+ }58035718 case FILE_ALLOCATION_INFORMATION:58045804- return set_file_allocation_info(work, fp, buf);57195719+ {57205720+ if (buf_len < sizeof(struct smb2_file_alloc_info))57215721+ return -EINVAL;5805572257235723+ return set_file_allocation_info(work, fp,57245724+ (struct smb2_file_alloc_info *)req->Buffer);57255725+ }58065726 case FILE_END_OF_FILE_INFORMATION:58075807- return set_end_of_file_info(work, fp, buf);57275727+ {57285728+ if (buf_len < sizeof(struct smb2_file_eof_info))57295729+ return -EINVAL;5808573057315731+ return set_end_of_file_info(work, fp,57325732+ (struct smb2_file_eof_info *)req->Buffer);57335733+ }58095734 case FILE_RENAME_INFORMATION:57355735+ {58105736 if (!test_tree_conn_flag(work->tcon, KSMBD_TREE_CONN_FLAG_WRITABLE)) {58115737 ksmbd_debug(SMB,58125738 "User does not have write permission\n");58135739 return -EACCES;58145740 }58155815- return set_rename_info(work, fp, buf);5816574157425742+ if (buf_len < sizeof(struct smb2_file_rename_info))57435743+ return -EINVAL;57445744+57455745+ return set_rename_info(work, fp,57465746+ (struct smb2_file_rename_info *)req->Buffer,57475747+ buf_len);57485748+ }58175749 case FILE_LINK_INFORMATION:58185818- return smb2_create_link(work, work->tcon->share_conf,58195819- (struct smb2_file_link_info *)buf, fp->filp,58205820- work->sess->conn->local_nls);57505750+ {57515751+ if (buf_len < sizeof(struct smb2_file_link_info))57525752+ return -EINVAL;5821575357545754+ return smb2_create_link(work, work->tcon->share_conf,57555755+ (struct smb2_file_link_info *)req->Buffer,57565756+ buf_len, fp->filp,57575757+ work->sess->conn->local_nls);57585758+ }58225759 case FILE_DISPOSITION_INFORMATION:57605760+ {58235761 if (!test_tree_conn_flag(work->tcon, KSMBD_TREE_CONN_FLAG_WRITABLE)) {58245762 ksmbd_debug(SMB,58255763 "User does not have write permission\n");58265764 return -EACCES;58275765 }58285828- return set_file_disposition_info(fp, buf);5829576657675767+ if (buf_len < sizeof(struct smb2_file_disposition_info))57685768+ return -EINVAL;57695769+57705770+ return set_file_disposition_info(fp,57715771+ (struct smb2_file_disposition_info *)req->Buffer);57725772+ }58305773 case FILE_FULL_EA_INFORMATION:58315774 {58325775 if (!(fp->daccess & FILE_WRITE_EA_LE)) {···58695744 return -EACCES;58705745 }5871574658725872- return smb2_set_ea((struct smb2_ea_info *)buf,58735873- &fp->filp->f_path);58745874- }57475747+ if (buf_len < sizeof(struct smb2_ea_info))57485748+ return -EINVAL;5875574957505750+ return smb2_set_ea((struct smb2_ea_info *)req->Buffer,57515751+ buf_len, &fp->filp->f_path);57525752+ }58765753 case FILE_POSITION_INFORMATION:58775877- return set_file_position_info(fp, buf);57545754+ {57555755+ if (buf_len < sizeof(struct smb2_file_pos_info))57565756+ return -EINVAL;5878575757585758+ return set_file_position_info(fp, (struct smb2_file_pos_info *)req->Buffer);57595759+ }58795760 case FILE_MODE_INFORMATION:58805880- return set_file_mode_info(fp, buf);57615761+ {57625762+ if (buf_len < sizeof(struct smb2_file_mode_info))57635763+ return -EINVAL;57645764+57655765+ return set_file_mode_info(fp, (struct smb2_file_mode_info *)req->Buffer);57665766+ }58815767 }5882576858835883- pr_err("Unimplemented Fileinfoclass :%d\n", info_class);57695769+ pr_err("Unimplemented Fileinfoclass :%d\n", req->FileInfoClass);58845770 return -EOPNOTSUPP;58855771}58865772···59525816 switch (req->InfoType) {59535817 case SMB2_O_INFO_FILE:59545818 ksmbd_debug(SMB, "GOT SMB2_O_INFO_FILE\n");59555955- rc = smb2_set_info_file(work, fp, req->FileInfoClass,59565956- req->Buffer, work->tcon->share_conf);58195819+ rc = smb2_set_info_file(work, fp, req, work->tcon->share_conf);59575820 break;59585821 case SMB2_O_INFO_SECURITY:59595822 ksmbd_debug(SMB, "GOT SMB2_O_INFO_SECURITY\n");···8306817183078172 WORK_BUFFERS(work, req, rsp);8308817383098309- if (le16_to_cpu(req->Command) == SMB2_NEGOTIATE_HE)81748174+ if (le16_to_cpu(req->Command) == SMB2_NEGOTIATE_HE &&81758175+ conn->preauth_info)83108176 ksmbd_gen_preauth_integrity_hash(conn, (char *)rsp,83118177 conn->preauth_info->Preauth_HashValue);83128178···84148278 unsigned int buf_data_size = pdu_length + 4 -84158279 sizeof(struct smb2_transform_hdr);84168280 struct smb2_transform_hdr *tr_hdr = (struct smb2_transform_hdr *)buf;84178417- unsigned int orig_len = le32_to_cpu(tr_hdr->OriginalMessageSize);84188281 int rc = 0;84198419-84208420- sess = ksmbd_session_lookup_all(conn, le64_to_cpu(tr_hdr->SessionId));84218421- if (!sess) {84228422- pr_err("invalid session id(%llx) in transform header\n",84238423- le64_to_cpu(tr_hdr->SessionId));84248424- return -ECONNABORTED;84258425- }8426828284278283 if (pdu_length + 4 <84288284 sizeof(struct smb2_transform_hdr) + sizeof(struct smb2_hdr)) {···84238295 return -ECONNABORTED;84248296 }8425829784268426- if (pdu_length + 4 < orig_len + sizeof(struct smb2_transform_hdr)) {82988298+ if (pdu_length + 4 <82998299+ le32_to_cpu(tr_hdr->OriginalMessageSize) + sizeof(struct smb2_transform_hdr)) {84278300 pr_err("Transform message is broken\n");83018301+ return -ECONNABORTED;83028302+ }83038303+83048304+ sess = ksmbd_session_lookup_all(conn, le64_to_cpu(tr_hdr->SessionId));83058305+ if (!sess) {83068306+ pr_err("invalid session id(%llx) in transform header\n",83078307+ le64_to_cpu(tr_hdr->SessionId));84288308 return -ECONNABORTED;84298309 }84308310
+9
fs/ksmbd/smb2pdu.h
···14641464 char FileName[1];14651465} __packed; /* level 18 Query */1466146614671467+struct smb2_file_basic_info { /* data block encoding of response to level 18 */14681468+ __le64 CreationTime; /* Beginning of FILE_BASIC_INFO equivalent */14691469+ __le64 LastAccessTime;14701470+ __le64 LastWriteTime;14711471+ __le64 ChangeTime;14721472+ __le32 Attributes;14731473+ __u32 Pad1; /* End of FILE_BASIC_INFO_INFO equivalent */14741474+} __packed;14751475+14671476struct smb2_file_alt_name_info {14681477 __le32 FileNameLength;14691478 char FileName[0];
+28-19
fs/ksmbd/smb_common.c
···155155 */156156bool ksmbd_smb_request(struct ksmbd_conn *conn)157157{158158- int type = *(char *)conn->request_buf;159159-160160- switch (type) {161161- case RFC1002_SESSION_MESSAGE:162162- /* Regular SMB request */163163- return true;164164- case RFC1002_SESSION_KEEP_ALIVE:165165- ksmbd_debug(SMB, "RFC 1002 session keep alive\n");166166- break;167167- default:168168- ksmbd_debug(SMB, "RFC 1002 unknown request type 0x%x\n", type);169169- }170170-171171- return false;158158+ return conn->request_buf[0] == 0;172159}173160174161static bool supported_protocol(int idx)···169182 idx <= server_conf.max_protocol);170183}171184172172-static char *next_dialect(char *dialect, int *next_off)185185+static char *next_dialect(char *dialect, int *next_off, int bcount)173186{174187 dialect = dialect + *next_off;175175- *next_off = strlen(dialect);188188+ *next_off = strnlen(dialect, bcount);189189+ if (dialect[*next_off] != '\0')190190+ return NULL;176191 return dialect;177192}178193···189200 dialect = cli_dialects;190201 bcount = le16_to_cpu(byte_count);191202 do {192192- dialect = next_dialect(dialect, &next);203203+ dialect = next_dialect(dialect, &next, bcount);204204+ if (!dialect)205205+ break;193206 ksmbd_debug(SMB, "client requested dialect %s\n",194207 dialect);195208 if (!strcmp(dialect, smb1_protos[i].name)) {···239248240249static int ksmbd_negotiate_smb_dialect(void *buf)241250{242242- __le32 proto;251251+ int smb_buf_length = get_rfc1002_len(buf);252252+ __le32 proto = ((struct smb2_hdr *)buf)->ProtocolId;243253244244- proto = ((struct smb2_hdr *)buf)->ProtocolId;245254 if (proto == SMB2_PROTO_NUMBER) {246255 struct smb2_negotiate_req *req;256256+ int smb2_neg_size =257257+ offsetof(struct smb2_negotiate_req, Dialects) - 4;247258248259 req = (struct smb2_negotiate_req *)buf;260260+ if (smb2_neg_size > smb_buf_length)261261+ goto err_out;262262+263263+ if (smb2_neg_size + le16_to_cpu(req->DialectCount) * sizeof(__le16) >264264+ smb_buf_length)265265+ goto err_out;266266+249267 return ksmbd_lookup_dialect_by_id(req->Dialects,250268 req->DialectCount);251269 }···264264 struct smb_negotiate_req *req;265265266266 req = (struct smb_negotiate_req *)buf;267267+ if (le16_to_cpu(req->ByteCount) < 2)268268+ goto err_out;269269+270270+ if (offsetof(struct smb_negotiate_req, DialectsArray) - 4 +271271+ le16_to_cpu(req->ByteCount) > smb_buf_length) {272272+ goto err_out;273273+ }274274+267275 return ksmbd_lookup_dialect_by_name(req->DialectsArray,268276 req->ByteCount);269277 }270278279279+err_out:271280 return BAD_PROT_ID;272281}273282
-8
fs/ksmbd/smb_common.h
···4848#define CIFS_DEFAULT_IOSIZE (64 * 1024)4949#define MAX_CIFS_SMALL_BUFFER_SIZE 448 /* big enough for most */50505151-/* RFC 1002 session packet types */5252-#define RFC1002_SESSION_MESSAGE 0x005353-#define RFC1002_SESSION_REQUEST 0x815454-#define RFC1002_POSITIVE_SESSION_RESPONSE 0x825555-#define RFC1002_NEGATIVE_SESSION_RESPONSE 0x835656-#define RFC1002_RETARGET_SESSION_RESPONSE 0x845757-#define RFC1002_SESSION_KEEP_ALIVE 0x855858-5951/* Responses when opening a file. */6052#define F_SUPERSEDED 06153#define F_OPENED 1
+19-2
fs/ksmbd/smbacl.c
···380380{381381 int i, ret;382382 int num_aces = 0;383383- int acl_size;383383+ unsigned int acl_size;384384 char *acl_base;385385 struct smb_ace **ppace;386386 struct posix_acl_entry *cf_pace, *cf_pdace;···392392 return;393393394394 /* validate that we do not go past end of acl */395395- if (end_of_acl <= (char *)pdacl ||395395+ if (end_of_acl < (char *)pdacl + sizeof(struct smb_acl) ||396396 end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) {397397 pr_err("ACL too small to parse DACL\n");398398 return;···431431 * user/group/other have no permissions432432 */433433 for (i = 0; i < num_aces; ++i) {434434+ if (end_of_acl - acl_base < acl_size)435435+ break;436436+434437 ppace[i] = (struct smb_ace *)(acl_base + acl_size);435438 acl_base = (char *)ppace[i];439439+ acl_size = offsetof(struct smb_ace, sid) +440440+ offsetof(struct smb_sid, sub_auth);441441+442442+ if (end_of_acl - acl_base < acl_size ||443443+ ppace[i]->sid.num_subauth > SID_MAX_SUB_AUTHORITIES ||444444+ (end_of_acl - acl_base <445445+ acl_size + sizeof(__le32) * ppace[i]->sid.num_subauth) ||446446+ (le16_to_cpu(ppace[i]->size) <447447+ acl_size + sizeof(__le32) * ppace[i]->sid.num_subauth))448448+ break;449449+436450 acl_size = le16_to_cpu(ppace[i]->size);437451 ppace[i]->access_req =438452 smb_map_generic_desired_access(ppace[i]->access_req);···820806821807 if (!pntsd)822808 return -EIO;809809+810810+ if (acl_len < sizeof(struct smb_ntsd))811811+ return -EINVAL;823812824813 owner_sid_ptr = (struct smb_sid *)((char *)pntsd +825814 le32_to_cpu(pntsd->osidoffset));
+2-2
fs/ksmbd/transport_tcp.c
···215215 * ksmbd_kthread_fn() - listen to new SMB connections and callback server216216 * @p: arguments to forker thread217217 *218218- * Return: Returns a task_struct or ERR_PTR218218+ * Return: 0 on success, error number otherwise219219 */220220static int ksmbd_kthread_fn(void *p)221221{···387387/**388388 * create_socket - create socket for ksmbd/0389389 *390390- * Return: Returns a task_struct or ERR_PTR390390+ * Return: 0 on success, error number otherwise391391 */392392static int create_socket(struct interface *iface)393393{
···42424343/**4444 * locks_end_grace4545- * @net: net namespace that this lock manager belongs to4645 * @lm: who this grace period is for4746 *4847 * Call this function to state that the given lock manager is ready to
+1-1
fs/nfsd/filecache.c
···542542}543543544544/**545545- * nfsd_file_close_inode_sync - attempt to forcibly close a nfsd_file545545+ * nfsd_file_close_inode - attempt a delayed close of a nfsd_file546546 * @inode: inode of the file to attempt to remove547547 *548548 * Walk the whole hash bucket, looking for any files that correspond to "inode".
+11-8
fs/nfsd/nfs4xdr.c
···35443544 goto fail;35453545 cd->rd_maxcount -= entry_bytes;35463546 /*35473547- * RFC 3530 14.2.24 describes rd_dircount as only a "hint", so35483548- * let's always let through the first entry, at least:35473547+ * RFC 3530 14.2.24 describes rd_dircount as only a "hint", and35483548+ * notes that it could be zero. If it is zero, then the server35493549+ * should enforce only the rd_maxcount value.35493550 */35503550- if (!cd->rd_dircount)35513551- goto fail;35523552- name_and_cookie = 4 + 4 * XDR_QUADLEN(namlen) + 8;35533553- if (name_and_cookie > cd->rd_dircount && cd->cookie_offset)35543554- goto fail;35553555- cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie);35513551+ if (cd->rd_dircount) {35523552+ name_and_cookie = 4 + 4 * XDR_QUADLEN(namlen) + 8;35533553+ if (name_and_cookie > cd->rd_dircount && cd->cookie_offset)35543554+ goto fail;35553555+ cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie);35563556+ if (!cd->rd_dircount)35573557+ cd->rd_maxcount = 0;35583558+ }3556355935573560 cd->cookie_offset = cookie_offset;35583561skip_entry:
···2222 * LINKS_ADDED: The fwnode has already be parsed to add fwnode links.2323 * NOT_DEVICE: The fwnode will never be populated as a struct device.2424 * INITIALIZED: The hardware corresponding to fwnode has been initialized.2525+ * NEEDS_CHILD_BOUND_ON_ADD: For this fwnode/device to probe successfully, its2626+ * driver needs its child devices to be bound with2727+ * their respective drivers as soon as they are2828+ * added.2529 */2626-#define FWNODE_FLAG_LINKS_ADDED BIT(0)2727-#define FWNODE_FLAG_NOT_DEVICE BIT(1)2828-#define FWNODE_FLAG_INITIALIZED BIT(2)3030+#define FWNODE_FLAG_LINKS_ADDED BIT(0)3131+#define FWNODE_FLAG_NOT_DEVICE BIT(1)3232+#define FWNODE_FLAG_INITIALIZED BIT(2)3333+#define FWNODE_FLAG_NEEDS_CHILD_BOUND_ON_ADD BIT(3)29343035struct fwnode_handle {3136 struct fwnode_handle *secondary;
+3-1
include/linux/perf_event.h
···684684 /*685685 * timestamp shadows the actual context timing but it can686686 * be safely used in NMI interrupt context. It reflects the687687- * context time as it was when the event was last scheduled in.687687+ * context time as it was when the event was last scheduled in,688688+ * or when ctx_sched_in failed to schedule the event because we689689+ * run out of PMC.688690 *689691 * ctx_time already accounts for ctx->timestamp. Therefore to690692 * compute ctx_time for a sample, simply add perf_clock().
···1202120212031203void nft_obj_notify(struct net *net, const struct nft_table *table,12041204 struct nft_object *obj, u32 portid, u32 seq,12051205- int event, int family, int report, gfp_t gfp);12051205+ int event, u16 flags, int family, int report, gfp_t gfp);1206120612071207/**12081208 * struct nft_object_type - stateful object type
+6
include/net/netns/netfilter.h
···2727#if IS_ENABLED(CONFIG_DECNET)2828 struct nf_hook_entries __rcu *hooks_decnet[NF_DN_NUMHOOKS];2929#endif3030+#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4)3131+ unsigned int defrag_ipv4_users;3232+#endif3333+#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)3434+ unsigned int defrag_ipv6_users;3535+#endif3036};3137#endif
+1
include/net/sock.h
···307307 * @sk_priority: %SO_PRIORITY setting308308 * @sk_type: socket type (%SOCK_STREAM, etc)309309 * @sk_protocol: which protocol this socket belongs in this network family310310+ * @sk_peer_lock: lock protecting @sk_peer_pid and @sk_peer_cred310311 * @sk_peer_pid: &struct pid for this socket's peer311312 * @sk_peer_cred: %SO_PEERCRED setting312313 * @sk_rcvlowat: %SO_RCVLOWAT setting
···173173 size_t cnt, loff_t *ppos)174174{175175 char buf[16];176176+ unsigned int scaling;176177177178 if (cnt > 15)178179 cnt = 15;179180180181 if (copy_from_user(&buf, ubuf, cnt))181182 return -EFAULT;183183+ buf[cnt] = '\0';182184183183- if (kstrtouint(buf, 10, &sysctl_sched_tunable_scaling))185185+ if (kstrtouint(buf, 10, &scaling))184186 return -EINVAL;185187188188+ if (scaling >= SCHED_TUNABLESCALING_END)189189+ return -EINVAL;190190+191191+ sysctl_sched_tunable_scaling = scaling;186192 if (sched_update_scaling())187193 return -EINVAL;188194
+5-1
kernel/sched/fair.c
···49364936 /* update hierarchical throttle state */49374937 walk_tg_tree_from(cfs_rq->tg, tg_nop, tg_unthrottle_up, (void *)rq);4938493849394939- if (!cfs_rq->load.weight)49394939+ /* Nothing to run but something to decay (on_list)? Complete the branch */49404940+ if (!cfs_rq->load.weight) {49414941+ if (cfs_rq->on_list)49424942+ goto unthrottle_throttle;49404943 return;49444944+ }4941494549424946 task_delta = cfs_rq->h_nr_running;49434947 idle_task_delta = cfs_rq->idle_h_nr_running;
···594594595595 /* We need to ensure that the socket is hashed and visible. */596596 smp_wmb();597597- nlk_sk(sk)->bound = portid;597597+ /* Paired with lockless reads from netlink_bind(),598598+ * netlink_connect() and netlink_sendmsg().599599+ */600600+ WRITE_ONCE(nlk_sk(sk)->bound, portid);598601599602err:600603 release_sock(sk);···10151012 if (nlk->ngroups < BITS_PER_LONG)10161013 groups &= (1UL << nlk->ngroups) - 1;1017101410181018- bound = nlk->bound;10151015+ /* Paired with WRITE_ONCE() in netlink_insert() */10161016+ bound = READ_ONCE(nlk->bound);10191017 if (bound) {10201018 /* Ensure nlk->portid is up-to-date. */10211019 smp_rmb();···1102109811031099 /* No need for barriers here as we return to user-space without11041100 * using any of the bound attributes.11011101+ * Paired with WRITE_ONCE() in netlink_insert().11051102 */11061106- if (!nlk->bound)11031103+ if (!READ_ONCE(nlk->bound))11071104 err = netlink_autobind(sock);1108110511091106 if (err == 0) {···18741869 dst_group = nlk->dst_group;18751870 }1876187118771877- if (!nlk->bound) {18721872+ /* Paired with WRITE_ONCE() in netlink_insert() */18731873+ if (!READ_ONCE(nlk->bound)) {18781874 err = netlink_autobind(sock);18791875 if (err)18801876 goto out;
+3
net/sched/sch_fifo.c
···233233 if (strncmp(q->ops->id + 1, "fifo", 4) != 0)234234 return 0;235235236236+ if (!q->ops->change)237237+ return 0;238238+236239 nla = kmalloc(nla_attr_size(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);237240 if (nla) {238241 nla->nla_type = RTM_NEWQDISC;
+4
net/sched/sch_taprio.c
···16411641 list_del(&q->taprio_list);16421642 spin_unlock(&taprio_list_lock);1643164316441644+ /* Note that taprio_reset() might not be called if an error16451645+ * happens in qdisc_create(), after taprio_init() has been called.16461646+ */16471647+ hrtimer_cancel(&q->advance_timer);1644164816451649 taprio_disable_offload(dev, q, NULL);16461650
···7024702470257025 if (obj->gen_loader) {70267026 /* reset FDs */70277027- btf__set_fd(obj->btf, -1);70277027+ if (obj->btf)70287028+ btf__set_fd(obj->btf, -1);70287029 for (i = 0; i < obj->nr_maps; i++)70297030 obj->maps[i].fd = -1;70307031 if (!err)
···1010#include <signal.h>1111#include <syscall.h>1212#include <sys/ioctl.h>1313+#include <sys/sysinfo.h>1314#include <asm/barrier.h>1415#include <linux/atomic.h>1516#include <linux/rseq.h>···40394140static pthread_t migration_thread;4241static cpu_set_t possible_mask;4242+static int min_cpu, max_cpu;4343static bool done;44444545static atomic_t seq_cnt;···5957 TEST_ASSERT(!r, "rseq failed, errno = %d (%s)", errno, strerror(errno));6058}61596060+static int next_cpu(int cpu)6161+{6262+ /*6363+ * Advance to the next CPU, skipping those that weren't in the original6464+ * affinity set. Sadly, there is no CPU_SET_FOR_EACH, and cpu_set_t's6565+ * data storage is considered as opaque. Note, if this task is pinned6666+ * to a small set of discontigous CPUs, e.g. 2 and 1023, this loop will6767+ * burn a lot cycles and the test will take longer than normal to6868+ * complete.6969+ */7070+ do {7171+ cpu++;7272+ if (cpu > max_cpu) {7373+ cpu = min_cpu;7474+ TEST_ASSERT(CPU_ISSET(cpu, &possible_mask),7575+ "Min CPU = %d must always be usable", cpu);7676+ break;7777+ }7878+ } while (!CPU_ISSET(cpu, &possible_mask));7979+8080+ return cpu;8181+}8282+6283static void *migration_worker(void *ign)6384{6485 cpu_set_t allowed_mask;6565- int r, i, nr_cpus, cpu;8686+ int r, i, cpu;66876788 CPU_ZERO(&allowed_mask);68896969- nr_cpus = CPU_COUNT(&possible_mask);7070-7171- for (i = 0; i < NR_TASK_MIGRATIONS; i++) {7272- cpu = i % nr_cpus;7373- if (!CPU_ISSET(cpu, &possible_mask))7474- continue;7575-9090+ for (i = 0, cpu = min_cpu; i < NR_TASK_MIGRATIONS; i++, cpu = next_cpu(cpu)) {7691 CPU_SET(cpu, &allowed_mask);77927893 /*···173154 return NULL;174155}175156157157+static int calc_min_max_cpu(void)158158+{159159+ int i, cnt, nproc;160160+161161+ if (CPU_COUNT(&possible_mask) < 2)162162+ return -EINVAL;163163+164164+ /*165165+ * CPU_SET doesn't provide a FOR_EACH helper, get the min/max CPU that166166+ * this task is affined to in order to reduce the time spent querying167167+ * unusable CPUs, e.g. if this task is pinned to a small percentage of168168+ * total CPUs.169169+ */170170+ nproc = get_nprocs_conf();171171+ min_cpu = -1;172172+ max_cpu = -1;173173+ cnt = 0;174174+175175+ for (i = 0; i < nproc; i++) {176176+ if (!CPU_ISSET(i, &possible_mask))177177+ continue;178178+ if (min_cpu == -1)179179+ min_cpu = i;180180+ max_cpu = i;181181+ cnt++;182182+ }183183+184184+ return (cnt < 2) ? -EINVAL : 0;185185+}186186+176187int main(int argc, char *argv[])177188{178189 int r, i, snapshot;···216167 TEST_ASSERT(!r, "sched_getaffinity failed, errno = %d (%s)", errno,217168 strerror(errno));218169219219- if (CPU_COUNT(&possible_mask) < 2) {220220- print_skip("Only one CPU, task migration not possible\n");170170+ if (calc_min_max_cpu()) {171171+ print_skip("Only one usable CPU, task migration not possible");221172 exit(KSFT_SKIP);222173 }223174