···79097909F: scripts/leaking_addresses.pl7910791079117911LED SUBSYSTEM79127912-M: Richard Purdie <rpurdie@rpsys.net>79137912M: Jacek Anaszewski <jacek.anaszewski@gmail.com>79147913M: Pavel Machek <pavel@ucw.cz>79157914L: linux-leds@vger.kernel.org
+2-1
arch/arc/include/asm/bug.h
···23232424#define BUG() do { \2525 pr_warn("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \2626- dump_stack(); \2626+ barrier_before_unreachable(); \2727+ __builtin_trap(); \2728} while (0)28292930#define HAVE_ARCH_BUG
-35
arch/arm/mach-ux500/cpu-db8500.c
···2323#include <linux/of.h>2424#include <linux/of_address.h>2525#include <linux/of_platform.h>2626-#include <linux/perf/arm_pmu.h>2726#include <linux/regulator/machine.h>28272928#include <asm/outercache.h>···111112 prcmu_system_reset(0);112113}113114114114-/*115115- * The PMU IRQ lines of two cores are wired together into a single interrupt.116116- * Bounce the interrupt to the other core if it's not ours.117117- */118118-static irqreturn_t db8500_pmu_handler(int irq, void *dev, irq_handler_t handler)119119-{120120- irqreturn_t ret = handler(irq, dev);121121- int other = !smp_processor_id();122122-123123- if (ret == IRQ_NONE && cpu_online(other))124124- irq_set_affinity(irq, cpumask_of(other));125125-126126- /*127127- * We should be able to get away with the amount of IRQ_NONEs we give,128128- * while still having the spurious IRQ detection code kick in if the129129- * interrupt really starts hitting spuriously.130130- */131131- return ret;132132-}133133-134134-static struct arm_pmu_platdata db8500_pmu_platdata = {135135- .handle_irq = db8500_pmu_handler,136136- .irq_flags = IRQF_NOBALANCING | IRQF_NO_THREAD,137137-};138138-139139-static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {140140- /* Requires call-back bindings. */141141- OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata),142142- {},143143-};144144-145115static struct of_dev_auxdata u8540_auxdata_lookup[] __initdata = {146116 OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", NULL),147117 {},···133165 if (of_machine_is_compatible("st-ericsson,u8540"))134166 of_platform_populate(NULL, u8500_local_bus_nodes,135167 u8540_auxdata_lookup, NULL);136136- else137137- of_platform_populate(NULL, u8500_local_bus_nodes,138138- u8500_auxdata_lookup, NULL);139168}140169141170static const char * stericsson_dt_platform_compat[] = {
···5959#ifdef CONFIG_FUNCTION_GRAPH_TRACER6060 if (tsk->ret_stack &&6161 (frame->pc == (unsigned long)return_to_handler)) {6262+ if (WARN_ON_ONCE(frame->graph == -1))6363+ return -EINVAL;6464+ if (frame->graph < -1)6565+ frame->graph += FTRACE_NOTRACE_DEPTH;6666+6267 /*6368 * This is a case where function graph tracer has6469 * modified a return address (LR) in a stack frame
+1-1
arch/arm64/kernel/sys_compat.c
···5757 if (end < start || flags)5858 return -EINVAL;59596060- if (!access_ok(VERIFY_READ, start, end - start))6060+ if (!access_ok(VERIFY_READ, (const void __user *)start, end - start))6161 return -EFAULT;62626363 return __do_compat_cache_op(start, end);
+1-1
arch/arm64/kernel/time.c
···5252 frame.fp = regs->regs[29];5353 frame.pc = regs->pc;5454#ifdef CONFIG_FUNCTION_GRAPH_TRACER5555- frame.graph = -1; /* no task info */5555+ frame.graph = current->curr_ret_stack;5656#endif5757 do {5858 int ret = unwind_frame(NULL, &frame);
···4444 * not be used like this with newer versions of gcc.4545 */4646#define BUG() \4747+do { \4748 __asm__ __volatile__ ("clear.d [" __stringify(BUG_MAGIC) "]\n\t"\4849 "movu.w " __stringify(__LINE__) ",$r0\n\t"\4950 "jump 0f\n\t" \5051 ".section .rodata\n" \5152 "0:\t.string \"" __FILE__ "\"\n\t" \5252- ".previous")5353+ ".previous"); \5454+ unreachable(); \5555+} while (0)5356#endif54575558#else56595760/* This just causes an oops. */5858-#define BUG() (*(int *)0 = 0)6161+#define BUG() \6262+do { \6363+ barrier_before_unreachable(); \6464+ __builtin_trap(); \6565+} while (0)59666067#endif6168
+5-1
arch/ia64/include/asm/bug.h
···4455#ifdef CONFIG_BUG66#define ia64_abort() __builtin_trap()77-#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); ia64_abort(); } while (0)77+#define BUG() do { \88+ printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \99+ barrier_before_unreachable(); \1010+ ia64_abort(); \1111+} while (0)812913/* should this BUG be made generic? */1014#define HAVE_ARCH_BUG
+3
arch/m68k/include/asm/bug.h
···88#ifndef CONFIG_SUN399#define BUG() do { \1010 pr_crit("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \1111+ barrier_before_unreachable(); \1112 __builtin_trap(); \1213} while (0)1314#else1415#define BUG() do { \1516 pr_crit("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \1717+ barrier_before_unreachable(); \1618 panic("BUG!"); \1719} while (0)1820#endif1921#else2022#define BUG() do { \2323+ barrier_before_unreachable(); \2124 __builtin_trap(); \2225} while (0)2326#endif
···542542 goto overflow;543543 break;544544 case R_X86_64_PC32:545545+ case R_X86_64_PLT32:545546 value -= (u64)address;546547 *(u32 *)location = value;547548 break;
+1
arch/x86/kernel/module.c
···191191 goto overflow;192192 break;193193 case R_X86_64_PC32:194194+ case R_X86_64_PLT32:194195 if (*(u32 *)loc != 0)195196 goto invalid_relocation;196197 val -= (u64)loc;
···770770 break;771771772772 case R_X86_64_PC32:773773+ case R_X86_64_PLT32:773774 /*774775 * PC relative relocations don't need to be adjusted unless775776 * referencing a percpu symbol.777777+ *778778+ * NB: R_X86_64_PLT32 can be treated as R_X86_64_PC32.776779 */777780 if (is_percpu_sym(sym, symname))778781 add_reloc(&relocs32neg, offset);
···106106 pr_devel("sinfo %u: Direct signer is key %x\n",107107 sinfo->index, key_serial(key));108108 x509 = NULL;109109+ sig = sinfo->sig;109110 goto matched;110111 }111112 if (PTR_ERR(key) != -ENOKEY)
+7-5
crypto/asymmetric_keys/pkcs7_verify.c
···270270 sinfo->index);271271 return 0;272272 }273273- ret = public_key_verify_signature(p->pub, p->sig);273273+ ret = public_key_verify_signature(p->pub, x509->sig);274274 if (ret < 0)275275 return ret;276276 x509->signer = p;···366366 *367367 * (*) -EBADMSG if some part of the message was invalid, or:368368 *369369- * (*) 0 if no signature chains were found to be blacklisted or to contain370370- * unsupported crypto, or:369369+ * (*) 0 if a signature chain passed verification, or:371370 *372371 * (*) -EKEYREJECTED if a blacklisted key was encountered, or:373372 *···422423423424 for (sinfo = pkcs7->signed_infos; sinfo; sinfo = sinfo->next) {424425 ret = pkcs7_verify_one(pkcs7, sinfo);425425- if (sinfo->blacklisted && actual_ret == -ENOPKG)426426- actual_ret = -EKEYREJECTED;426426+ if (sinfo->blacklisted) {427427+ if (actual_ret == -ENOPKG)428428+ actual_ret = -EKEYREJECTED;429429+ continue;430430+ }427431 if (ret < 0) {428432 if (ret == -ENOPKG) {429433 sinfo->unsupported_crypto = true;
+3-1
crypto/asymmetric_keys/public_key.c
···79798080 BUG_ON(!pkey);8181 BUG_ON(!sig);8282- BUG_ON(!sig->digest);8382 BUG_ON(!sig->s);8383+8484+ if (!sig->digest)8585+ return -ENOPKG;84868587 alg_name = sig->pkey_algo;8688 if (strcmp(sig->pkey_algo, "rsa") == 0) {
+13-8
crypto/asymmetric_keys/restrict.c
···6767 *6868 * Returns 0 if the new certificate was accepted, -ENOKEY if we couldn't find a6969 * matching parent certificate in the trusted list, -EKEYREJECTED if the7070- * signature check fails or the key is blacklisted and some other error if7171- * there is a matching certificate but the signature check cannot be performed.7070+ * signature check fails or the key is blacklisted, -ENOPKG if the signature7171+ * uses unsupported crypto, or some other error if there is a matching7272+ * certificate but the signature check cannot be performed.7273 */7374int restrict_link_by_signature(struct key *dest_keyring,7475 const struct key_type *type,···8988 return -EOPNOTSUPP;90899190 sig = payload->data[asym_auth];9191+ if (!sig)9292+ return -ENOPKG;9293 if (!sig->auth_ids[0] && !sig->auth_ids[1])9394 return -ENOKEY;9495···142139 return -EOPNOTSUPP;143140144141 sig = payload->data[asym_auth];142142+ if (!sig)143143+ return -ENOPKG;145144 if (!sig->auth_ids[0] && !sig->auth_ids[1])146145 return -ENOKEY;147146···227222 *228223 * Returns 0 if the new certificate was accepted, -ENOKEY if we229224 * couldn't find a matching parent certificate in the trusted list,230230- * -EKEYREJECTED if the signature check fails, and some other error if231231- * there is a matching certificate but the signature check cannot be232232- * performed.225225+ * -EKEYREJECTED if the signature check fails, -ENOPKG if the signature uses226226+ * unsupported crypto, or some other error if there is a matching certificate227227+ * but the signature check cannot be performed.233228 */234229int restrict_link_by_key_or_keyring(struct key *dest_keyring,235230 const struct key_type *type,···254249 *255250 * Returns 0 if the new certificate was accepted, -ENOKEY if we256251 * couldn't find a matching parent certificate in the trusted list,257257- * -EKEYREJECTED if the signature check fails, and some other error if258258- * there is a matching certificate but the signature check cannot be259259- * performed.252252+ * -EKEYREJECTED if the signature check fails, -ENOPKG if the signature uses253253+ * unsupported crypto, or some other error if there is a matching certificate254254+ * but the signature check cannot be performed.260255 */261256int restrict_link_by_key_or_keyring_chain(struct key *dest_keyring,262257 const struct key_type *type,
+23-6
drivers/android/binder.c
···19911991 &target_thread->reply_error.work);19921992 wake_up_interruptible(&target_thread->wait);19931993 } else {19941994- WARN(1, "Unexpected reply error: %u\n",19951995- target_thread->reply_error.cmd);19941994+ /*19951995+ * Cannot get here for normal operation, but19961996+ * we can if multiple synchronous transactions19971997+ * are sent without blocking for responses.19981998+ * Just ignore the 2nd error in this case.19991999+ */20002000+ pr_warn("Unexpected reply error: %u\n",20012001+ target_thread->reply_error.cmd);19962002 }19972003 binder_inner_proc_unlock(target_thread->proc);19982004 binder_thread_dec_tmpref(target_thread);···21992193 int debug_id = buffer->debug_id;2200219422012195 binder_debug(BINDER_DEBUG_TRANSACTION,22022202- "%d buffer release %d, size %zd-%zd, failed at %p\n",21962196+ "%d buffer release %d, size %zd-%zd, failed at %pK\n",22032197 proc->pid, buffer->debug_id,22042198 buffer->data_size, buffer->offsets_size, failed_at);22052199···37113705 }37123706 }37133707 binder_debug(BINDER_DEBUG_DEAD_BINDER,37143714- "%d:%d BC_DEAD_BINDER_DONE %016llx found %p\n",37083708+ "%d:%d BC_DEAD_BINDER_DONE %016llx found %pK\n",37153709 proc->pid, thread->pid, (u64)cookie,37163710 death);37173711 if (death == NULL) {···4382437643834377 binder_inner_proc_unlock(thread->proc);4384437843794379+ /*43804380+ * This is needed to avoid races between wake_up_poll() above and43814381+ * and ep_remove_waitqueue() called for other reasons (eg the epoll file43824382+ * descriptor being closed); ep_remove_waitqueue() holds an RCU read43834383+ * lock, so we can be sure it's done after calling synchronize_rcu().43844384+ */43854385+ if (thread->looper & BINDER_LOOPER_STATE_POLL)43864386+ synchronize_rcu();43874387+43854388 if (send_reply)43864389 binder_send_failed_reply(send_reply, BR_DEAD_REPLY);43874390 binder_release_work(proc, &thread->todo);···44064391 bool wait_for_proc_work;4407439244084393 thread = binder_get_thread(proc);43944394+ if (!thread)43954395+ return POLLERR;4409439644104397 binder_inner_proc_lock(thread->proc);44114398 thread->looper |= BINDER_LOOPER_STATE_POLL;···50515034 spin_lock(&t->lock);50525035 to_proc = t->to_proc;50535036 seq_printf(m,50545054- "%s %d: %p from %d:%d to %d:%d code %x flags %x pri %ld r%d",50375037+ "%s %d: %pK from %d:%d to %d:%d code %x flags %x pri %ld r%d",50555038 prefix, t->debug_id, t,50565039 t->from ? t->from->proc->pid : 0,50575040 t->from ? t->from->pid : 0,···50755058 }50765059 if (buffer->target_node)50775060 seq_printf(m, " node %d", buffer->target_node->debug_id);50785078- seq_printf(m, " size %zd:%zd data %p\n",50615061+ seq_printf(m, " size %zd:%zd data %pK\n",50795062 buffer->data_size, buffer->offsets_size,50805063 buffer->data);50815064}
+9-3
drivers/crypto/s5p-sss.c
···19221922 uint32_t aes_control;19231923 unsigned long flags;19241924 int err;19251925+ u8 *iv;1925192619261927 aes_control = SSS_AES_KEY_CHANGE_MODE;19271928 if (mode & FLAGS_AES_DECRYPT)19281929 aes_control |= SSS_AES_MODE_DECRYPT;1929193019301930- if ((mode & FLAGS_AES_MODE_MASK) == FLAGS_AES_CBC)19311931+ if ((mode & FLAGS_AES_MODE_MASK) == FLAGS_AES_CBC) {19311932 aes_control |= SSS_AES_CHAIN_MODE_CBC;19321932- else if ((mode & FLAGS_AES_MODE_MASK) == FLAGS_AES_CTR)19331933+ iv = req->info;19341934+ } else if ((mode & FLAGS_AES_MODE_MASK) == FLAGS_AES_CTR) {19331935 aes_control |= SSS_AES_CHAIN_MODE_CTR;19361936+ iv = req->info;19371937+ } else {19381938+ iv = NULL; /* AES_ECB */19391939+ }1934194019351941 if (dev->ctx->keylen == AES_KEYSIZE_192)19361942 aes_control |= SSS_AES_KEY_SIZE_192;···19671961 goto outdata_error;1968196219691963 SSS_AES_WRITE(dev, AES_CONTROL, aes_control);19701970- s5p_set_aes(dev, dev->ctx->aes_key, req->info, dev->ctx->keylen);19641964+ s5p_set_aes(dev, dev->ctx->aes_key, iv, dev->ctx->keylen);1971196519721966 s5p_set_dma_indata(dev, dev->sg_src);19731967 s5p_set_dma_outdata(dev, dev->sg_dst);
+4-32
drivers/extcon/extcon-axp288.c
···11/*22 * extcon-axp288.c - X-Power AXP288 PMIC extcon cable detection driver33 *44- * Copyright (C) 2016-2017 Hans de Goede <hdegoede@redhat.com>54 * Copyright (C) 2015 Intel Corporation65 * Author: Ramakrishna Pallala <ramakrishna.pallala@intel.com>76 *···9798 struct device *dev;9899 struct regmap *regmap;99100 struct regmap_irq_chip_data *regmap_irqc;100100- struct delayed_work det_work;101101 int irq[EXTCON_IRQ_END];102102 struct extcon_dev *edev;103103 unsigned int previous_cable;104104- bool first_detect_done;105104};106105107106/* Power up/down reason string array */108108-static char *axp288_pwr_up_down_info[] = {107107+static const char * const axp288_pwr_up_down_info[] = {109108 "Last wake caused by user pressing the power button",110109 "Last wake caused by a charger insertion",111110 "Last wake caused by a battery insertion",···121124 */122125static void axp288_extcon_log_rsi(struct axp288_extcon_info *info)123126{124124- char **rsi;127127+ const char * const *rsi;125128 unsigned int val, i, clear_mask = 0;126129 int ret;127130···135138136139 /* Clear the register value for next reboot (write 1 to clear bit) */137140 regmap_write(info->regmap, AXP288_PS_BOOT_REASON_REG, clear_mask);138138-}139139-140140-static void axp288_chrg_detect_complete(struct axp288_extcon_info *info)141141-{142142- /*143143- * We depend on other drivers to do things like mux the data lines,144144- * enable/disable vbus based on the id-pin, etc. Sometimes the BIOS has145145- * not set these things up correctly resulting in the initial charger146146- * cable type detection giving a wrong result and we end up not charging147147- * or charging at only 0.5A.148148- *149149- * So we schedule a second cable type detection after 2 seconds to150150- * give the other drivers time to load and do their thing.151151- */152152- if (!info->first_detect_done) {153153- queue_delayed_work(system_wq, &info->det_work,154154- msecs_to_jiffies(2000));155155- info->first_detect_done = true;156156- }157141}158142159143static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info)···201223 info->previous_cable = cable;202224 }203225204204- axp288_chrg_detect_complete(info);205205-206226 return 0;207227208228dev_det_ret:···222246 return IRQ_HANDLED;223247}224248225225-static void axp288_extcon_det_work(struct work_struct *work)249249+static void axp288_extcon_enable(struct axp288_extcon_info *info)226250{227227- struct axp288_extcon_info *info =228228- container_of(work, struct axp288_extcon_info, det_work.work);229229-230251 regmap_update_bits(info->regmap, AXP288_BC_GLOBAL_REG,231252 BC_GLOBAL_RUN, 0);232253 /* Enable the charger detection logic */···245272 info->regmap = axp20x->regmap;246273 info->regmap_irqc = axp20x->regmap_irqc;247274 info->previous_cable = EXTCON_NONE;248248- INIT_DELAYED_WORK(&info->det_work, axp288_extcon_det_work);249275250276 platform_set_drvdata(pdev, info);251277···290318 }291319292320 /* Start charger cable type detection */293293- queue_delayed_work(system_wq, &info->det_work, 0);321321+ axp288_extcon_enable(info);294322295323 return 0;296324}
+2-1
drivers/extcon/extcon-intel-int3496.c
···153153 return ret;154154 }155155156156- /* queue initial processing of id-pin */156156+ /* process id-pin so that we start with the right status */157157 queue_delayed_work(system_wq, &data->work, 0);158158+ flush_delayed_work(&data->work);158159159160 platform_set_drvdata(pdev, data);160161
+38-20
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
···736736 enum drm_connector_status ret = connector_status_disconnected;737737 int r;738738739739- r = pm_runtime_get_sync(connector->dev->dev);740740- if (r < 0)741741- return connector_status_disconnected;739739+ if (!drm_kms_helper_is_poll_worker()) {740740+ r = pm_runtime_get_sync(connector->dev->dev);741741+ if (r < 0)742742+ return connector_status_disconnected;743743+ }742744743745 if (encoder) {744746 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);···759757 /* check acpi lid status ??? */760758761759 amdgpu_connector_update_scratch_regs(connector, ret);762762- pm_runtime_mark_last_busy(connector->dev->dev);763763- pm_runtime_put_autosuspend(connector->dev->dev);760760+761761+ if (!drm_kms_helper_is_poll_worker()) {762762+ pm_runtime_mark_last_busy(connector->dev->dev);763763+ pm_runtime_put_autosuspend(connector->dev->dev);764764+ }765765+764766 return ret;765767}766768···874868 enum drm_connector_status ret = connector_status_disconnected;875869 int r;876870877877- r = pm_runtime_get_sync(connector->dev->dev);878878- if (r < 0)879879- return connector_status_disconnected;871871+ if (!drm_kms_helper_is_poll_worker()) {872872+ r = pm_runtime_get_sync(connector->dev->dev);873873+ if (r < 0)874874+ return connector_status_disconnected;875875+ }880876881877 encoder = amdgpu_connector_best_single_encoder(connector);882878 if (!encoder)···932924 amdgpu_connector_update_scratch_regs(connector, ret);933925934926out:935935- pm_runtime_mark_last_busy(connector->dev->dev);936936- pm_runtime_put_autosuspend(connector->dev->dev);927927+ if (!drm_kms_helper_is_poll_worker()) {928928+ pm_runtime_mark_last_busy(connector->dev->dev);929929+ pm_runtime_put_autosuspend(connector->dev->dev);930930+ }937931938932 return ret;939933}···998988 enum drm_connector_status ret = connector_status_disconnected;999989 bool dret = false, broken_edid = false;100099010011001- r = pm_runtime_get_sync(connector->dev->dev);10021002- if (r < 0)10031003- return connector_status_disconnected;991991+ if (!drm_kms_helper_is_poll_worker()) {992992+ r = pm_runtime_get_sync(connector->dev->dev);993993+ if (r < 0)994994+ return connector_status_disconnected;995995+ }10049961005997 if (!force && amdgpu_connector_check_hpd_status_unchanged(connector)) {1006998 ret = connector->status;···11271115 amdgpu_connector_update_scratch_regs(connector, ret);1128111611291117exit:11301130- pm_runtime_mark_last_busy(connector->dev->dev);11311131- pm_runtime_put_autosuspend(connector->dev->dev);11181118+ if (!drm_kms_helper_is_poll_worker()) {11191119+ pm_runtime_mark_last_busy(connector->dev->dev);11201120+ pm_runtime_put_autosuspend(connector->dev->dev);11211121+ }1132112211331123 return ret;11341124}···13731359 struct drm_encoder *encoder = amdgpu_connector_best_single_encoder(connector);13741360 int r;1375136113761376- r = pm_runtime_get_sync(connector->dev->dev);13771377- if (r < 0)13781378- return connector_status_disconnected;13621362+ if (!drm_kms_helper_is_poll_worker()) {13631363+ r = pm_runtime_get_sync(connector->dev->dev);13641364+ if (r < 0)13651365+ return connector_status_disconnected;13661366+ }1379136713801368 if (!force && amdgpu_connector_check_hpd_status_unchanged(connector)) {13811369 ret = connector->status;···1445142914461430 amdgpu_connector_update_scratch_regs(connector, ret);14471431out:14481448- pm_runtime_mark_last_busy(connector->dev->dev);14491449- pm_runtime_put_autosuspend(connector->dev->dev);14321432+ if (!drm_kms_helper_is_poll_worker()) {14331433+ pm_runtime_mark_last_busy(connector->dev->dev);14341434+ pm_runtime_put_autosuspend(connector->dev->dev);14351435+ }1450143614511437 return ret;14521438}
+23-17
drivers/gpu/drm/cirrus/cirrus_mode.c
···294294{295295}296296297297-/*298298- * This is called after a mode is programmed. It should reverse anything done299299- * by the prepare function300300- */301301-static void cirrus_crtc_commit(struct drm_crtc *crtc)302302-{303303-}304304-305305-/*306306- * The core can pass us a set of gamma values to program. We actually only307307- * use this for 8-bit mode so can't perform smooth fades on deeper modes,308308- * but it's a requirement that we provide the function309309- */310310-static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,311311- u16 *blue, uint32_t size,312312- struct drm_modeset_acquire_ctx *ctx)297297+static void cirrus_crtc_load_lut(struct drm_crtc *crtc)313298{314299 struct drm_device *dev = crtc->dev;315300 struct cirrus_device *cdev = dev->dev_private;···302317 int i;303318304319 if (!crtc->enabled)305305- return 0;320320+ return;306321307322 r = crtc->gamma_store;308323 g = r + crtc->gamma_size;···315330 WREG8(PALETTE_DATA, *g++ >> 8);316331 WREG8(PALETTE_DATA, *b++ >> 8);317332 }333333+}334334+335335+/*336336+ * This is called after a mode is programmed. It should reverse anything done337337+ * by the prepare function338338+ */339339+static void cirrus_crtc_commit(struct drm_crtc *crtc)340340+{341341+ cirrus_crtc_load_lut(crtc);342342+}343343+344344+/*345345+ * The core can pass us a set of gamma values to program. We actually only346346+ * use this for 8-bit mode so can't perform smooth fades on deeper modes,347347+ * but it's a requirement that we provide the function348348+ */349349+static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,350350+ u16 *blue, uint32_t size,351351+ struct drm_modeset_acquire_ctx *ctx)352352+{353353+ cirrus_crtc_load_lut(crtc);318354319355 return 0;320356}
+15
drivers/gpu/drm/drm_atomic_helper.c
···18781878 new_crtc_state->event->base.completion = &commit->flip_done;18791879 new_crtc_state->event->base.completion_release = release_crtc_commit;18801880 drm_crtc_commit_get(commit);18811881+18821882+ commit->abort_completion = true;18811883 }1882188418831885 for_each_oldnew_connector_in_state(state, conn, old_conn_state, new_conn_state, i) {···34233421void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state)34243422{34253423 if (state->commit) {34243424+ /*34253425+ * In the event that a non-blocking commit returns34263426+ * -ERESTARTSYS before the commit_tail work is queued, we will34273427+ * have an extra reference to the commit object. Release it, if34283428+ * the event has not been consumed by the worker.34293429+ *34303430+ * state->event may be freed, so we can't directly look at34313431+ * state->event->base.completion.34323432+ */34333433+ if (state->event && state->commit->abort_completion)34343434+ drm_crtc_commit_put(state->commit);34353435+34263436 kfree(state->commit->event);34273437 state->commit->event = NULL;34383438+34283439 drm_crtc_commit_put(state->commit);34293440 }34303441
···836836 if (!mm->color_adjust)837837 return NULL;838838839839- hole = list_first_entry(&mm->hole_stack, typeof(*hole), hole_stack);840840- hole_start = __drm_mm_hole_node_start(hole);841841- hole_end = hole_start + hole->hole_size;839839+ /*840840+ * The hole found during scanning should ideally be the first element841841+ * in the hole_stack list, but due to side-effects in the driver it842842+ * may not be.843843+ */844844+ list_for_each_entry(hole, &mm->hole_stack, hole_stack) {845845+ hole_start = __drm_mm_hole_node_start(hole);846846+ hole_end = hole_start + hole->hole_size;847847+848848+ if (hole_start <= scan->hit_start &&849849+ hole_end >= scan->hit_end)850850+ break;851851+ }852852+853853+ /* We should only be called after we found the hole previously */854854+ DRM_MM_BUG_ON(&hole->hole_stack == &mm->hole_stack);855855+ if (unlikely(&hole->hole_stack == &mm->hole_stack))856856+ return NULL;842857843858 DRM_MM_BUG_ON(hole_start > scan->hit_start);844859 DRM_MM_BUG_ON(hole_end < scan->hit_end);
+20
drivers/gpu/drm/drm_probe_helper.c
···654654}655655656656/**657657+ * drm_kms_helper_is_poll_worker - is %current task an output poll worker?658658+ *659659+ * Determine if %current task is an output poll worker. This can be used660660+ * to select distinct code paths for output polling versus other contexts.661661+ *662662+ * One use case is to avoid a deadlock between the output poll worker and663663+ * the autosuspend worker wherein the latter waits for polling to finish664664+ * upon calling drm_kms_helper_poll_disable(), while the former waits for665665+ * runtime suspend to finish upon calling pm_runtime_get_sync() in a666666+ * connector ->detect hook.667667+ */668668+bool drm_kms_helper_is_poll_worker(void)669669+{670670+ struct work_struct *work = current_work();671671+672672+ return work && work->func == output_poll_execute;673673+}674674+EXPORT_SYMBOL(drm_kms_helper_is_poll_worker);675675+676676+/**657677 * drm_kms_helper_poll_disable - disable output polling658678 * @dev: drm_device659679 *
···11-/*22- * Copyright (c) 2012 Samsung Electronics Co., Ltd.33- *44- * Authors:55- * YoungJun Cho <yj44.cho@samsung.com>66- * Eunchul Kim <chulspro.kim@samsung.com>77- *88- * This program is free software; you can redistribute it and/or modify it99- * under the terms of the GNU General Public License as published by the1010- * Free Software Foundation; either version 2 of the License, or (at your1111- * option) any later version.1212- */1313-1414-#ifndef _EXYNOS_DRM_ROTATOR_H_1515-#define _EXYNOS_DRM_ROTATOR_H_1616-1717-/* TODO */1818-1919-#endif
···570570 nv_connector->edid = NULL;571571 }572572573573- ret = pm_runtime_get_sync(connector->dev->dev);574574- if (ret < 0 && ret != -EACCES)575575- return conn_status;573573+ /* Outputs are only polled while runtime active, so acquiring a574574+ * runtime PM ref here is unnecessary (and would deadlock upon575575+ * runtime suspend because it waits for polling to finish).576576+ */577577+ if (!drm_kms_helper_is_poll_worker()) {578578+ ret = pm_runtime_get_sync(connector->dev->dev);579579+ if (ret < 0 && ret != -EACCES)580580+ return conn_status;581581+ }576582577583 nv_encoder = nouveau_connector_ddc_detect(connector);578584 if (nv_encoder && (i2c = nv_encoder->i2c) != NULL) {···653647654648 out:655649656656- pm_runtime_mark_last_busy(connector->dev->dev);657657- pm_runtime_put_autosuspend(connector->dev->dev);650650+ if (!drm_kms_helper_is_poll_worker()) {651651+ pm_runtime_mark_last_busy(connector->dev->dev);652652+ pm_runtime_put_autosuspend(connector->dev->dev);653653+ }658654659655 return conn_status;660656}
+49-25
drivers/gpu/drm/radeon/radeon_connectors.c
···899899 enum drm_connector_status ret = connector_status_disconnected;900900 int r;901901902902- r = pm_runtime_get_sync(connector->dev->dev);903903- if (r < 0)904904- return connector_status_disconnected;902902+ if (!drm_kms_helper_is_poll_worker()) {903903+ r = pm_runtime_get_sync(connector->dev->dev);904904+ if (r < 0)905905+ return connector_status_disconnected;906906+ }905907906908 if (encoder) {907909 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);···926924 /* check acpi lid status ??? */927925928926 radeon_connector_update_scratch_regs(connector, ret);929929- pm_runtime_mark_last_busy(connector->dev->dev);930930- pm_runtime_put_autosuspend(connector->dev->dev);927927+928928+ if (!drm_kms_helper_is_poll_worker()) {929929+ pm_runtime_mark_last_busy(connector->dev->dev);930930+ pm_runtime_put_autosuspend(connector->dev->dev);931931+ }932932+931933 return ret;932934}933935···10451039 enum drm_connector_status ret = connector_status_disconnected;10461040 int r;1047104110481048- r = pm_runtime_get_sync(connector->dev->dev);10491049- if (r < 0)10501050- return connector_status_disconnected;10421042+ if (!drm_kms_helper_is_poll_worker()) {10431043+ r = pm_runtime_get_sync(connector->dev->dev);10441044+ if (r < 0)10451045+ return connector_status_disconnected;10461046+ }1051104710521048 encoder = radeon_best_single_encoder(connector);10531049 if (!encoder)···11161108 radeon_connector_update_scratch_regs(connector, ret);1117110911181110out:11191119- pm_runtime_mark_last_busy(connector->dev->dev);11201120- pm_runtime_put_autosuspend(connector->dev->dev);11111111+ if (!drm_kms_helper_is_poll_worker()) {11121112+ pm_runtime_mark_last_busy(connector->dev->dev);11131113+ pm_runtime_put_autosuspend(connector->dev->dev);11141114+ }1121111511221116 return ret;11231117}···11831173 if (!radeon_connector->dac_load_detect)11841174 return ret;1185117511861186- r = pm_runtime_get_sync(connector->dev->dev);11871187- if (r < 0)11881188- return connector_status_disconnected;11761176+ if (!drm_kms_helper_is_poll_worker()) {11771177+ r = pm_runtime_get_sync(connector->dev->dev);11781178+ if (r < 0)11791179+ return connector_status_disconnected;11801180+ }1189118111901182 encoder = radeon_best_single_encoder(connector);11911183 if (!encoder)···11991187 if (ret == connector_status_connected)12001188 ret = radeon_connector_analog_encoder_conflict_solve(connector, encoder, ret, false);12011189 radeon_connector_update_scratch_regs(connector, ret);12021202- pm_runtime_mark_last_busy(connector->dev->dev);12031203- pm_runtime_put_autosuspend(connector->dev->dev);11901190+11911191+ if (!drm_kms_helper_is_poll_worker()) {11921192+ pm_runtime_mark_last_busy(connector->dev->dev);11931193+ pm_runtime_put_autosuspend(connector->dev->dev);11941194+ }11951195+12041196 return ret;12051197}12061198···12671251 enum drm_connector_status ret = connector_status_disconnected;12681252 bool dret = false, broken_edid = false;1269125312701270- r = pm_runtime_get_sync(connector->dev->dev);12711271- if (r < 0)12721272- return connector_status_disconnected;12541254+ if (!drm_kms_helper_is_poll_worker()) {12551255+ r = pm_runtime_get_sync(connector->dev->dev);12561256+ if (r < 0)12571257+ return connector_status_disconnected;12581258+ }1273125912741260 if (radeon_connector->detected_hpd_without_ddc) {12751261 force = true;···14541436 }1455143714561438exit:14571457- pm_runtime_mark_last_busy(connector->dev->dev);14581458- pm_runtime_put_autosuspend(connector->dev->dev);14391439+ if (!drm_kms_helper_is_poll_worker()) {14401440+ pm_runtime_mark_last_busy(connector->dev->dev);14411441+ pm_runtime_put_autosuspend(connector->dev->dev);14421442+ }1459144314601444 return ret;14611445}···17081688 if (radeon_dig_connector->is_mst)17091689 return connector_status_disconnected;1710169017111711- r = pm_runtime_get_sync(connector->dev->dev);17121712- if (r < 0)17131713- return connector_status_disconnected;16911691+ if (!drm_kms_helper_is_poll_worker()) {16921692+ r = pm_runtime_get_sync(connector->dev->dev);16931693+ if (r < 0)16941694+ return connector_status_disconnected;16951695+ }1714169617151697 if (!force && radeon_check_hpd_status_unchanged(connector)) {17161698 ret = connector->status;···17991777 }1800177818011779out:18021802- pm_runtime_mark_last_busy(connector->dev->dev);18031803- pm_runtime_put_autosuspend(connector->dev->dev);17801780+ if (!drm_kms_helper_is_poll_worker()) {17811781+ pm_runtime_mark_last_busy(connector->dev->dev);17821782+ pm_runtime_put_autosuspend(connector->dev->dev);17831783+ }1804178418051785 return ret;18061786}
···788788 case V4L2_PIX_FMT_SGBRG8:789789 case V4L2_PIX_FMT_SGRBG8:790790 case V4L2_PIX_FMT_SRGGB8:791791+ case V4L2_PIX_FMT_GREY:791792 offset = image->rect.left + image->rect.top * pix->bytesperline;792793 break;793794 case V4L2_PIX_FMT_SBGGR16:794795 case V4L2_PIX_FMT_SGBRG16:795796 case V4L2_PIX_FMT_SGRBG16:796797 case V4L2_PIX_FMT_SRGGB16:798798+ case V4L2_PIX_FMT_Y16:797799 offset = image->rect.left * 2 +798800 image->rect.top * pix->bytesperline;799801 break;
+2
drivers/gpu/ipu-v3/ipu-csi.c
···288288 case MEDIA_BUS_FMT_SGBRG10_1X10:289289 case MEDIA_BUS_FMT_SGRBG10_1X10:290290 case MEDIA_BUS_FMT_SRGGB10_1X10:291291+ case MEDIA_BUS_FMT_Y10_1X10:291292 cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_BAYER;292293 cfg->mipi_dt = MIPI_DT_RAW10;293294 cfg->data_width = IPU_CSI_DATA_WIDTH_10;···297296 case MEDIA_BUS_FMT_SGBRG12_1X12:298297 case MEDIA_BUS_FMT_SGRBG12_1X12:299298 case MEDIA_BUS_FMT_SRGGB12_1X12:299299+ case MEDIA_BUS_FMT_Y12_1X12:300300 cfg->data_fmt = CSI_SENS_CONF_DATA_FMT_BAYER;301301 cfg->mipi_dt = MIPI_DT_RAW12;302302 cfg->data_width = IPU_CSI_DATA_WIDTH_12;
···5050#define BCM2835_I2C_S_CLKT BIT(9)5151#define BCM2835_I2C_S_LEN BIT(10) /* Fake bit for SW error reporting */52525353+#define BCM2835_I2C_FEDL_SHIFT 165454+#define BCM2835_I2C_REDL_SHIFT 05555+5356#define BCM2835_I2C_CDIV_MIN 0x00025457#define BCM2835_I2C_CDIV_MAX 0xFFFE5558···84818582static int bcm2835_i2c_set_divider(struct bcm2835_i2c_dev *i2c_dev)8683{8787- u32 divider;8484+ u32 divider, redl, fedl;88858986 divider = DIV_ROUND_UP(clk_get_rate(i2c_dev->clk),9087 i2c_dev->bus_clk_rate);···103100104101 bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DIV, divider);105102103103+ /*104104+ * Number of core clocks to wait after falling edge before105105+ * outputting the next data bit. Note that both FEDL and REDL106106+ * can't be greater than CDIV/2.107107+ */108108+ fedl = max(divider / 16, 1u);109109+110110+ /*111111+ * Number of core clocks to wait after rising edge before112112+ * sampling the next incoming data bit.113113+ */114114+ redl = max(divider / 4, 1u);115115+116116+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_DEL,117117+ (fedl << BCM2835_I2C_FEDL_SHIFT) |118118+ (redl << BCM2835_I2C_REDL_SHIFT));106119 return 0;107120}108121
+2-2
drivers/i2c/busses/i2c-designware-master.c
···209209 i2c_dw_disable_int(dev);210210211211 /* Enable the adapter */212212- __i2c_dw_enable(dev, true);212212+ __i2c_dw_enable_and_wait(dev, true);213213214214 /* Clear and enable interrupts */215215 dw_readl(dev, DW_IC_CLR_INTR);···644644 gpio = devm_gpiod_get(dev->dev, "scl", GPIOD_OUT_HIGH);645645 if (IS_ERR(gpio)) {646646 r = PTR_ERR(gpio);647647- if (r == -ENOENT)647647+ if (r == -ENOENT || r == -ENOSYS)648648 return 0;649649 return r;650650 }
+1
drivers/i2c/busses/i2c-i801.c
···5858 * Wildcat Point (PCH) 0x8ca2 32 hard yes yes yes5959 * Wildcat Point-LP (PCH) 0x9ca2 32 hard yes yes yes6060 * BayTrail (SOC) 0x0f12 32 hard yes yes yes6161+ * Braswell (SOC) 0x2292 32 hard yes yes yes6162 * Sunrise Point-H (PCH) 0xa123 32 hard yes yes yes6263 * Sunrise Point-LP (PCH) 0x9d23 32 hard yes yes yes6364 * DNV (SOC) 0x19df 32 hard yes yes yes
+2-2
drivers/i2c/busses/i2c-sirf.c
···341341 platform_set_drvdata(pdev, adap);342342 init_completion(&siic->done);343343344344- /* Controller Initalisation */344344+ /* Controller initialisation */345345346346 writel(SIRFSOC_I2C_RESET, siic->base + SIRFSOC_I2C_CTRL);347347 while (readl(siic->base + SIRFSOC_I2C_CTRL) & SIRFSOC_I2C_RESET)···369369 * but they start to affect the speed when clock is set to faster370370 * frequencies.371371 * Through the actual tests, use the different user_div value(which372372- * in the divider formular 'Fio / (Fi2c * user_div)') to adapt372372+ * in the divider formula 'Fio / (Fi2c * user_div)') to adapt373373 * the different ranges of i2c bus clock frequency, to make the SCL374374 * more accurate.375375 */
+4-3
drivers/iio/adc/aspeed_adc.c
···243243 ASPEED_ADC_INIT_POLLING_TIME,244244 ASPEED_ADC_INIT_TIMEOUT);245245 if (ret)246246- goto scaler_error;246246+ goto poll_timeout_error;247247 }248248249249 /* Start all channels in normal mode. */···274274 writel(ASPEED_OPERATION_MODE_POWER_DOWN,275275 data->base + ASPEED_REG_ENGINE_CONTROL);276276 clk_disable_unprepare(data->clk_scaler->clk);277277-reset_error:278278- reset_control_assert(data->rst);279277clk_enable_error:278278+poll_timeout_error:279279+ reset_control_assert(data->rst);280280+reset_error:280281 clk_hw_unregister_divider(data->clk_scaler);281282scaler_error:282283 clk_hw_unregister_divider(data->clk_prescaler);
+4-3
drivers/iio/adc/stm32-adc.c
···722722 int ret;723723 u32 val;724724725725- /* Clear ADRDY by writing one, then enable ADC */726726- stm32_adc_set_bits(adc, STM32H7_ADC_ISR, STM32H7_ADRDY);727725 stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADEN);728726729727 /* Poll for ADRDY to be set (after adc startup time) */···729731 val & STM32H7_ADRDY,730732 100, STM32_ADC_TIMEOUT_US);731733 if (ret) {732732- stm32_adc_clr_bits(adc, STM32H7_ADC_CR, STM32H7_ADEN);734734+ stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADDIS);733735 dev_err(&indio_dev->dev, "Failed to enable ADC\n");736736+ } else {737737+ /* Clear ADRDY by writing one */738738+ stm32_adc_set_bits(adc, STM32H7_ADC_ISR, STM32H7_ADRDY);734739 }735740736741 return ret;
+4-3
drivers/iio/imu/adis_trigger.c
···4646 if (adis->trig == NULL)4747 return -ENOMEM;48484949+ adis->trig->dev.parent = &adis->spi->dev;5050+ adis->trig->ops = &adis_trigger_ops;5151+ iio_trigger_set_drvdata(adis->trig, adis);5252+4953 ret = request_irq(adis->spi->irq,5054 &iio_trigger_generic_data_rdy_poll,5155 IRQF_TRIGGER_RISING,···5854 if (ret)5955 goto error_free_trig;60566161- adis->trig->dev.parent = &adis->spi->dev;6262- adis->trig->ops = &adis_trigger_ops;6363- iio_trigger_set_drvdata(adis->trig, adis);6457 ret = iio_trigger_register(adis->trig);65586659 indio_dev->trig = iio_trigger_get(adis->trig);
···68686969config SRF087070 tristate "Devantech SRF02/SRF08/SRF10 ultrasonic ranger sensor"7171+ select IIO_BUFFER7272+ select IIO_TRIGGERED_BUFFER7173 depends on I2C7274 help7375 Say Y here to build a driver for Devantech SRF02/SRF08/SRF10
+6-1
drivers/infiniband/core/core_priv.h
···305305static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,306306 struct ib_pd *pd,307307 struct ib_qp_init_attr *attr,308308- struct ib_udata *udata)308308+ struct ib_udata *udata,309309+ struct ib_uobject *uobj)309310{310311 struct ib_qp *qp;312312+313313+ if (!dev->create_qp)314314+ return ERR_PTR(-EOPNOTSUPP);311315312316 qp = dev->create_qp(pd, attr, udata);313317 if (IS_ERR(qp))···319315320316 qp->device = dev;321317 qp->pd = pd;318318+ qp->uobject = uobj;322319 /*323320 * We don't track XRC QPs for now, because they don't have PD324321 * and more importantly they are created internaly by driver,
+28-10
drivers/infiniband/core/rdma_core.c
···141141 */142142 uobj->context = context;143143 uobj->type = type;144144- atomic_set(&uobj->usecnt, 0);144144+ /*145145+ * Allocated objects start out as write locked to deny any other146146+ * syscalls from accessing them until they are committed. See147147+ * rdma_alloc_commit_uobject148148+ */149149+ atomic_set(&uobj->usecnt, -1);145150 kref_init(&uobj->ref);146151147152 return uobj;···201196 goto free;202197 }203198204204- uverbs_uobject_get(uobj);199199+ /*200200+ * The idr_find is guaranteed to return a pointer to something that201201+ * isn't freed yet, or NULL, as the free after idr_remove goes through202202+ * kfree_rcu(). However the object may still have been released and203203+ * kfree() could be called at any time.204204+ */205205+ if (!kref_get_unless_zero(&uobj->ref))206206+ uobj = ERR_PTR(-ENOENT);207207+205208free:206209 rcu_read_unlock();207210 return uobj;···412399 return ret;413400}414401415415-static void lockdep_check(struct ib_uobject *uobj, bool exclusive)402402+static void assert_uverbs_usecnt(struct ib_uobject *uobj, bool exclusive)416403{417404#ifdef CONFIG_LOCKDEP418405 if (exclusive)419419- WARN_ON(atomic_read(&uobj->usecnt) > 0);406406+ WARN_ON(atomic_read(&uobj->usecnt) != -1);420407 else421421- WARN_ON(atomic_read(&uobj->usecnt) == -1);408408+ WARN_ON(atomic_read(&uobj->usecnt) <= 0);422409#endif423410}424411···457444 WARN(true, "ib_uverbs: Cleanup is running while removing an uobject\n");458445 return 0;459446 }460460- lockdep_check(uobj, true);447447+ assert_uverbs_usecnt(uobj, true);461448 ret = _rdma_remove_commit_uobject(uobj, RDMA_REMOVE_DESTROY);462449463450 up_read(&ucontext->cleanup_rwsem);···487474 WARN(true, "ib_uverbs: Cleanup is running while removing an uobject\n");488475 return 0;489476 }490490- lockdep_check(uobject, true);477477+ assert_uverbs_usecnt(uobject, true);491478 ret = uobject->type->type_class->remove_commit(uobject,492479 RDMA_REMOVE_DESTROY);493480 if (ret)494494- return ret;481481+ goto out;495482496483 uobject->type = &null_obj_type;497484485485+out:498486 up_read(&ucontext->cleanup_rwsem);499499- return 0;487487+ return ret;500488}501489502490static void alloc_commit_idr_uobject(struct ib_uobject *uobj)···541527 return ret;542528 }543529530530+ /* matches atomic_set(-1) in alloc_uobj */531531+ assert_uverbs_usecnt(uobj, true);532532+ atomic_set(&uobj->usecnt, 0);533533+544534 uobj->type->type_class->alloc_commit(uobj);545535 up_read(&uobj->context->cleanup_rwsem);546536···579561580562void rdma_lookup_put_uobject(struct ib_uobject *uobj, bool exclusive)581563{582582- lockdep_check(uobj, exclusive);564564+ assert_uverbs_usecnt(uobj, exclusive);583565 uobj->type->type_class->lookup_put(uobj, exclusive);584566 /*585567 * In order to unlock an object, either decrease its usecnt for
···562562 if (f.file)563563 fdput(f);564564565565+ mutex_unlock(&file->device->xrcd_tree_mutex);566566+565567 uobj_alloc_commit(&obj->uobject);566568567567- mutex_unlock(&file->device->xrcd_tree_mutex);568569 return in_len;569570570571err_copy:···604603605604 uobj = uobj_get_write(uobj_get_type(xrcd), cmd.xrcd_handle,606605 file->ucontext);607607- if (IS_ERR(uobj)) {608608- mutex_unlock(&file->device->xrcd_tree_mutex);606606+ if (IS_ERR(uobj))609607 return PTR_ERR(uobj);610610- }611608612609 ret = uobj_remove_commit(uobj);613610 return ret ?: in_len;···978979 struct ib_uverbs_ex_create_cq_resp resp;979980 struct ib_cq_init_attr attr = {};980981982982+ if (!ib_dev->create_cq)983983+ return ERR_PTR(-EOPNOTSUPP);984984+981985 if (cmd->comp_vector >= file->device->num_comp_vectors)982986 return ERR_PTR(-EINVAL);983987···10321030 resp.response_length = offsetof(typeof(resp), response_length) +10331031 sizeof(resp.response_length);1034103210331033+ cq->res.type = RDMA_RESTRACK_CQ;10341034+ rdma_restrack_add(&cq->res);10351035+10351036 ret = cb(file, obj, &resp, ucore, context);10361037 if (ret)10371038 goto err_cb;1038103910391040 uobj_alloc_commit(&obj->uobject);10401040- cq->res.type = RDMA_RESTRACK_CQ;10411041- rdma_restrack_add(&cq->res);10421042-10431041 return obj;1044104210451043err_cb:···15201518 if (cmd->qp_type == IB_QPT_XRC_TGT)15211519 qp = ib_create_qp(pd, &attr);15221520 else15231523- qp = _ib_create_qp(device, pd, &attr, uhw);15211521+ qp = _ib_create_qp(device, pd, &attr, uhw,15221522+ &obj->uevent.uobject);1524152315251524 if (IS_ERR(qp)) {15261525 ret = PTR_ERR(qp);···15531550 atomic_inc(&attr.srq->usecnt);15541551 if (ind_tbl)15551552 atomic_inc(&ind_tbl->usecnt);15531553+ } else {15541554+ /* It is done in _ib_create_qp for other QP types */15551555+ qp->uobject = &obj->uevent.uobject;15561556 }15571557- qp->uobject = &obj->uevent.uobject;1558155715591558 obj->uevent.uobject.object = qp;15601559···19761971 goto release_qp;19771972 }1978197319741974+ if ((cmd->base.attr_mask & IB_QP_AV) &&19751975+ !rdma_is_port_valid(qp->device, cmd->base.dest.port_num)) {19761976+ ret = -EINVAL;19771977+ goto release_qp;19781978+ }19791979+19791980 if ((cmd->base.attr_mask & IB_QP_ALT_PATH) &&19801980- !rdma_is_port_valid(qp->device, cmd->base.alt_port_num)) {19811981+ (!rdma_is_port_valid(qp->device, cmd->base.alt_port_num) ||19821982+ !rdma_is_port_valid(qp->device, cmd->base.alt_dest.port_num))) {19811983 ret = -EINVAL;19821984 goto release_qp;19831985 }···29532941 wq_init_attr.create_flags = cmd.create_flags;29542942 obj->uevent.events_reported = 0;29552943 INIT_LIST_HEAD(&obj->uevent.event_list);29442944+29452945+ if (!pd->device->create_wq) {29462946+ err = -EOPNOTSUPP;29472947+ goto err_put_cq;29482948+ }29562949 wq = pd->device->create_wq(pd, &wq_init_attr, uhw);29572950 if (IS_ERR(wq)) {29582951 err = PTR_ERR(wq);···31013084 wq_attr.flags = cmd.flags;31023085 wq_attr.flags_mask = cmd.flags_mask;31033086 }30873087+ if (!wq->device->modify_wq) {30883088+ ret = -EOPNOTSUPP;30893089+ goto out;30903090+ }31043091 ret = wq->device->modify_wq(wq, &wq_attr, cmd.attr_mask, uhw);30923092+out:31053093 uobj_put_obj_read(wq);31063094 return ret;31073095}···3203318132043182 init_attr.log_ind_tbl_size = cmd.log_ind_tbl_size;32053183 init_attr.ind_tbl = wqs;31843184+31853185+ if (!ib_dev->create_rwq_ind_table) {31863186+ err = -EOPNOTSUPP;31873187+ goto err_uobj;31883188+ }32063189 rwq_ind_tbl = ib_dev->create_rwq_ind_table(ib_dev, &init_attr, uhw);3207319032083191 if (IS_ERR(rwq_ind_tbl)) {···37963769 struct ib_uverbs_ex_query_device cmd;37973770 struct ib_device_attr attr = {0};37983771 int err;37723772+37733773+ if (!ib_dev->query_device)37743774+ return -EOPNOTSUPP;3799377538003776 if (ucore->inlen < sizeof(cmd))38013777 return -EINVAL;
+3
drivers/infiniband/core/uverbs_ioctl.c
···5959 return 0;6060 }61616262+ if (test_bit(attr_id, attr_bundle_h->valid_bitmap))6363+ return -EINVAL;6464+6265 spec = &attr_spec_bucket->attrs[attr_id];6366 e = &elements[attr_id];6467 e->uattr = uattr_ptr;
+9-9
drivers/infiniband/core/uverbs_ioctl_merge.c
···114114 short min = SHRT_MAX;115115 const void *elem;116116 int i, j, last_stored = -1;117117+ unsigned int equal_min = 0;117118118119 for_each_element(elem, i, j, elements, num_elements, num_offset,119120 data_offset) {···137136 */138137 iters[last_stored == i ? num_iters - 1 : num_iters++] = elem;139138 last_stored = i;139139+ if (min == GET_ID(id))140140+ equal_min++;141141+ else142142+ equal_min = 1;140143 min = GET_ID(id);141144 }142145···151146 * Therefore, we need to clean the beginning of the array to make sure152147 * all ids of final elements are equal to min.153148 */154154- for (i = num_iters - 1; i >= 0 &&155155- GET_ID(*(u16 *)(iters[i] + id_offset)) == min; i--)156156- ;157157-158158- num_iters -= i + 1;159159- memmove(iters, iters + i + 1, sizeof(*iters) * num_iters);149149+ memmove(iters, iters + num_iters - equal_min, sizeof(*iters) * equal_min);160150161151 *min_id = min;162162- return num_iters;152152+ return equal_min;163153}164154165155#define find_max_element_entry_id(num_elements, elements, num_objects_fld, \···322322 hash = kzalloc(sizeof(*hash) +323323 ALIGN(sizeof(*hash->attrs) * (attr_max_bucket + 1),324324 sizeof(long)) +325325- BITS_TO_LONGS(attr_max_bucket) * sizeof(long),325325+ BITS_TO_LONGS(attr_max_bucket + 1) * sizeof(long),326326 GFP_KERNEL);327327 if (!hash) {328328 res = -ENOMEM;···509509 * first handler which != NULL. This also defines the510510 * set of flags used for this handler.511511 */512512- for (i = num_object_defs - 1;512512+ for (i = num_method_defs - 1;513513 i >= 0 && !method_defs[i]->handler; i--)514514 ;515515 hash->methods[min_id++] = method;
···548548 goto out;549549 }550550551551- if (bus->dev_state == MEI_DEV_POWER_DOWN) {552552- dev_dbg(bus->dev, "Device is powering down, don't bother with disconnection\n");553553- err = 0;554554- goto out;555555- }556556-557551 err = mei_cl_disconnect(cl);558552 if (err < 0)559553 dev_err(bus->dev, "Could not disconnect from the ME client\n");
+6
drivers/misc/mei/client.c
···945945 return 0;946946 }947947948948+ if (dev->dev_state == MEI_DEV_POWER_DOWN) {949949+ cl_dbg(dev, cl, "Device is powering down, don't bother with disconnection\n");950950+ mei_cl_set_disconnected(cl);951951+ return 0;952952+ }953953+948954 rets = pm_runtime_get(dev->dev);949955 if (rets < 0 && rets != -EINPROGRESS) {950956 pm_runtime_put_noidle(dev->dev);
+5
drivers/misc/mei/hw-me-regs.h
···132132#define MEI_DEV_ID_KBP 0xA2BA /* Kaby Point */133133#define MEI_DEV_ID_KBP_2 0xA2BB /* Kaby Point 2 */134134135135+#define MEI_DEV_ID_CNP_LP 0x9DE0 /* Cannon Point LP */136136+#define MEI_DEV_ID_CNP_LP_4 0x9DE4 /* Cannon Point LP 4 (iTouch) */137137+#define MEI_DEV_ID_CNP_H 0xA360 /* Cannon Point H */138138+#define MEI_DEV_ID_CNP_H_4 0xA364 /* Cannon Point H 4 (iTouch) */139139+135140/*136141 * MEI HW Section137142 */
···29342934{29352935 int size = lstatus & BD_LENGTH_MASK;29362936 struct page *page = rxb->page;29372937- bool last = !!(lstatus & BD_LFLAG(RXBD_LAST));29382938-29392939- /* Remove the FCS from the packet length */29402940- if (last)29412941- size -= ETH_FCS_LEN;2942293729432938 if (likely(first)) {29442939 skb_put(skb, size);29452940 } else {29462941 /* the last fragments' length contains the full frame length */29472947- if (last)29422942+ if (lstatus & BD_LFLAG(RXBD_LAST))29482943 size -= skb->len;2949294429502950- /* Add the last fragment if it contains something other than29512951- * the FCS, otherwise drop it and trim off any part of the FCS29522952- * that was already received.29532953- */29542954- if (size > 0)29552955- skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,29562956- rxb->page_offset + RXBUF_ALIGNMENT,29572957- size, GFAR_RXB_TRUESIZE);29582958- else if (size < 0)29592959- pskb_trim(skb, skb->len + size);29452945+ skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page,29462946+ rxb->page_offset + RXBUF_ALIGNMENT,29472947+ size, GFAR_RXB_TRUESIZE);29602948 }2961294929622950 /* try reuse page */···3056306830573069 if (priv->padding)30583070 skb_pull(skb, priv->padding);30713071+30723072+ /* Trim off the FCS */30733073+ pskb_trim(skb, skb->len - ETH_FCS_LEN);3059307430603075 if (ndev->features & NETIF_F_RXCSUM)30613076 gfar_rx_checksum(skb, fcb);
···1529152915301530 esw_debug(esw->dev, "Enabling VPORT(%d)\n", vport_num);1531153115321532+ /* Create steering drop counters for ingress and egress ACLs */15331533+ if (vport_num && esw->mode == SRIOV_LEGACY)15341534+ esw_vport_create_drop_counters(vport);15351535+15321536 /* Restore old vport configuration */15331537 esw_apply_vport_conf(esw, vport);15341538···15481544 /* only PF is trusted by default */15491545 if (!vport_num)15501546 vport->info.trusted = true;15511551-15521552- /* create steering drop counters for ingress and egress ACLs */15531553- if (vport_num && esw->mode == SRIOV_LEGACY)15541554- esw_vport_create_drop_counters(vport);1555154715561548 esw_vport_change_handle_locked(vport);15571549
+10-3
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
···1429142914301430 if (xored_actions & (MLX5_FLOW_CONTEXT_ACTION_DROP |14311431 MLX5_FLOW_CONTEXT_ACTION_ENCAP |14321432- MLX5_FLOW_CONTEXT_ACTION_DECAP))14321432+ MLX5_FLOW_CONTEXT_ACTION_DECAP |14331433+ MLX5_FLOW_CONTEXT_ACTION_MOD_HDR))14331434 return true;1434143514351436 return false;···1759175817601759 /* Collect all fgs which has a matching match_criteria */17611760 err = build_match_list(&match_head, ft, spec);17621762- if (err)17611761+ if (err) {17621762+ if (take_write)17631763+ up_write_ref_node(&ft->node);17631764 return ERR_PTR(err);17651765+ }1764176617651767 if (!take_write)17661768 up_read_ref_node(&ft->node);···17721768 dest_num, version);17731769 free_match_list(&match_head);17741770 if (!IS_ERR(rule) ||17751775- (PTR_ERR(rule) != -ENOENT && PTR_ERR(rule) != -EAGAIN))17711771+ (PTR_ERR(rule) != -ENOENT && PTR_ERR(rule) != -EAGAIN)) {17721772+ if (take_write)17731773+ up_write_ref_node(&ft->node);17761774 return rule;17751775+ }1777177617781777 if (!take_write) {17791778 nested_down_write_ref_node(&ft->node, FS_LOCK_GRANDPARENT);
···20202121config SMC91942222 tristate "SMC 9194 support"2323- depends on (ISA || MAC && BROKEN)2323+ depends on ISA2424 select CRC322525 ---help---2626 This is support for the SMC9xxx based Ethernet cards. Choose this
+1-1
drivers/net/macvlan.c
···14511451 /* the macvlan port may be freed by macvlan_uninit when fail to register.14521452 * so we destroy the macvlan port only when it's valid.14531453 */14541454- if (create && macvlan_port_get_rtnl(dev))14541454+ if (create && macvlan_port_get_rtnl(lowerdev))14551455 macvlan_port_destroy(port->dev);14561456 return err;14571457}
+4-3
drivers/net/usb/smsc75xx.c
···954954 /* it's racing here! */955955956956 ret = smsc75xx_write_reg(dev, RFE_CTL, pdata->rfe_ctl);957957- if (ret < 0)957957+ if (ret < 0) {958958 netdev_warn(dev->net, "Error writing RFE_CTL\n");959959-960960- return ret;959959+ return ret;960960+ }961961+ return 0;961962}962963963964static int smsc75xx_wait_ready(struct usbnet *dev, int in_pm)
+34-24
drivers/net/virtio_net.c
···443443 sg_init_one(sq->sg, xdp->data, xdp->data_end - xdp->data);444444445445 err = virtqueue_add_outbuf(sq->vq, sq->sg, 1, xdp->data, GFP_ATOMIC);446446- if (unlikely(err)) {447447- struct page *page = virt_to_head_page(xdp->data);448448-449449- put_page(page);450450- return false;451451- }446446+ if (unlikely(err))447447+ return false; /* Caller handle free/refcnt */452448453449 return true;454450}···452456static int virtnet_xdp_xmit(struct net_device *dev, struct xdp_buff *xdp)453457{454458 struct virtnet_info *vi = netdev_priv(dev);455455- bool sent = __virtnet_xdp_xmit(vi, xdp);459459+ struct receive_queue *rq = vi->rq;460460+ struct bpf_prog *xdp_prog;461461+ bool sent;456462463463+ /* Only allow ndo_xdp_xmit if XDP is loaded on dev, as this464464+ * indicate XDP resources have been successfully allocated.465465+ */466466+ xdp_prog = rcu_dereference(rq->xdp_prog);467467+ if (!xdp_prog)468468+ return -ENXIO;469469+470470+ sent = __virtnet_xdp_xmit(vi, xdp);457471 if (!sent)458472 return -ENOSPC;459473 return 0;···552546 unsigned int buflen = SKB_DATA_ALIGN(GOOD_PACKET_LEN + headroom) +553547 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));554548 struct page *page = virt_to_head_page(buf);555555- unsigned int delta = 0, err;549549+ unsigned int delta = 0;556550 struct page *xdp_page;551551+ bool sent;552552+ int err;553553+557554 len -= vi->hdr_len;558555559556 rcu_read_lock();···567558 void *orig_data;568559 u32 act;569560570570- if (unlikely(hdr->hdr.gso_type || hdr->hdr.flags))561561+ if (unlikely(hdr->hdr.gso_type))571562 goto err_xdp;572563573564 if (unlikely(xdp_headroom < virtnet_get_headroom(vi))) {···605596 delta = orig_data - xdp.data;606597 break;607598 case XDP_TX:608608- if (unlikely(!__virtnet_xdp_xmit(vi, &xdp)))599599+ sent = __virtnet_xdp_xmit(vi, &xdp);600600+ if (unlikely(!sent)) {609601 trace_xdp_exception(vi->dev, xdp_prog, act);610610- else611611- *xdp_xmit = true;602602+ goto err_xdp;603603+ }604604+ *xdp_xmit = true;612605 rcu_read_unlock();613606 goto xdp_xmit;614607 case XDP_REDIRECT:615608 err = xdp_do_redirect(dev, &xdp, xdp_prog);616616- if (!err)617617- *xdp_xmit = true;609609+ if (err)610610+ goto err_xdp;611611+ *xdp_xmit = true;618612 rcu_read_unlock();619613 goto xdp_xmit;620614 default:···689677 struct bpf_prog *xdp_prog;690678 unsigned int truesize;691679 unsigned int headroom = mergeable_ctx_to_headroom(ctx);692692- int err;680680+ bool sent;693681694682 head_skb = NULL;695683···758746 }759747 break;760748 case XDP_TX:761761- if (unlikely(!__virtnet_xdp_xmit(vi, &xdp)))749749+ sent = __virtnet_xdp_xmit(vi, &xdp);750750+ if (unlikely(!sent)) {762751 trace_xdp_exception(vi->dev, xdp_prog, act);763763- else764764- *xdp_xmit = true;752752+ if (unlikely(xdp_page != page))753753+ put_page(xdp_page);754754+ goto err_xdp;755755+ }756756+ *xdp_xmit = true;765757 if (unlikely(xdp_page != page))766758 goto err_xdp;767767- rcu_read_unlock();768768- goto xdp_xmit;769769- case XDP_REDIRECT:770770- err = xdp_do_redirect(dev, &xdp, xdp_prog);771771- if (!err)772772- *xdp_xmit = true;773759 rcu_read_unlock();774760 goto xdp_xmit;775761 default:
···1717#include <linux/export.h>1818#include <linux/kernel.h>1919#include <linux/perf/arm_pmu.h>2020-#include <linux/platform_device.h>2120#include <linux/slab.h>2221#include <linux/sched/clock.h>2322#include <linux/spinlock.h>···2425#include <linux/irqdesc.h>25262627#include <asm/irq_regs.h>2828+2929+static DEFINE_PER_CPU(struct arm_pmu *, cpu_armpmu);3030+static DEFINE_PER_CPU(int, cpu_irq);27312832static int2933armpmu_map_cache_event(const unsigned (*cache_map)···322320 return 0;323321}324322325325-static struct arm_pmu_platdata *armpmu_get_platdata(struct arm_pmu *armpmu)326326-{327327- struct platform_device *pdev = armpmu->plat_device;328328-329329- return pdev ? dev_get_platdata(&pdev->dev) : NULL;330330-}331331-332323static irqreturn_t armpmu_dispatch_irq(int irq, void *dev)333324{334325 struct arm_pmu *armpmu;335335- struct arm_pmu_platdata *plat;336326 int ret;337327 u64 start_clock, finish_clock;338328···335341 * dereference.336342 */337343 armpmu = *(void **)dev;338338-339339- plat = armpmu_get_platdata(armpmu);344344+ if (WARN_ON_ONCE(!armpmu))345345+ return IRQ_NONE;340346341347 start_clock = sched_clock();342342- if (plat && plat->handle_irq)343343- ret = plat->handle_irq(irq, armpmu, armpmu->handle_irq);344344- else345345- ret = armpmu->handle_irq(irq, armpmu);348348+ ret = armpmu->handle_irq(irq, armpmu);346349 finish_clock = sched_clock();347350348351 perf_sample_event_took(finish_clock - start_clock);···522531}523532EXPORT_SYMBOL_GPL(perf_num_counters);524533525525-void armpmu_free_irq(struct arm_pmu *armpmu, int cpu)534534+static int armpmu_count_irq_users(const int irq)526535{527527- struct pmu_hw_events __percpu *hw_events = armpmu->hw_events;528528- int irq = per_cpu(hw_events->irq, cpu);536536+ int cpu, count = 0;529537530530- if (!cpumask_test_and_clear_cpu(cpu, &armpmu->active_irqs))531531- return;532532-533533- if (irq_is_percpu_devid(irq)) {534534- free_percpu_irq(irq, &hw_events->percpu_pmu);535535- cpumask_clear(&armpmu->active_irqs);536536- return;538538+ for_each_possible_cpu(cpu) {539539+ if (per_cpu(cpu_irq, cpu) == irq)540540+ count++;537541 }538542539539- free_irq(irq, per_cpu_ptr(&hw_events->percpu_pmu, cpu));543543+ return count;540544}541545542542-void armpmu_free_irqs(struct arm_pmu *armpmu)546546+void armpmu_free_irq(int irq, int cpu)543547{544544- int cpu;548548+ if (per_cpu(cpu_irq, cpu) == 0)549549+ return;550550+ if (WARN_ON(irq != per_cpu(cpu_irq, cpu)))551551+ return;545552546546- for_each_cpu(cpu, &armpmu->supported_cpus)547547- armpmu_free_irq(armpmu, cpu);553553+ if (!irq_is_percpu_devid(irq))554554+ free_irq(irq, per_cpu_ptr(&cpu_armpmu, cpu));555555+ else if (armpmu_count_irq_users(irq) == 1)556556+ free_percpu_irq(irq, &cpu_armpmu);557557+558558+ per_cpu(cpu_irq, cpu) = 0;548559}549560550550-int armpmu_request_irq(struct arm_pmu *armpmu, int cpu)561561+int armpmu_request_irq(int irq, int cpu)551562{552563 int err = 0;553553- struct pmu_hw_events __percpu *hw_events = armpmu->hw_events;554564 const irq_handler_t handler = armpmu_dispatch_irq;555555- int irq = per_cpu(hw_events->irq, cpu);556565 if (!irq)557566 return 0;558567559559- if (irq_is_percpu_devid(irq) && cpumask_empty(&armpmu->active_irqs)) {560560- err = request_percpu_irq(irq, handler, "arm-pmu",561561- &hw_events->percpu_pmu);562562- } else if (irq_is_percpu_devid(irq)) {563563- int other_cpu = cpumask_first(&armpmu->active_irqs);564564- int other_irq = per_cpu(hw_events->irq, other_cpu);565565-566566- if (irq != other_irq) {567567- pr_warn("mismatched PPIs detected.\n");568568- err = -EINVAL;569569- goto err_out;570570- }571571- } else {572572- struct arm_pmu_platdata *platdata = armpmu_get_platdata(armpmu);568568+ if (!irq_is_percpu_devid(irq)) {573569 unsigned long irq_flags;574570575571 err = irq_force_affinity(irq, cpumask_of(cpu));···567589 goto err_out;568590 }569591570570- if (platdata && platdata->irq_flags) {571571- irq_flags = platdata->irq_flags;572572- } else {573573- irq_flags = IRQF_PERCPU |574574- IRQF_NOBALANCING |575575- IRQF_NO_THREAD;576576- }592592+ irq_flags = IRQF_PERCPU |593593+ IRQF_NOBALANCING |594594+ IRQF_NO_THREAD;577595596596+ irq_set_status_flags(irq, IRQ_NOAUTOEN);578597 err = request_irq(irq, handler, irq_flags, "arm-pmu",579579- per_cpu_ptr(&hw_events->percpu_pmu, cpu));598598+ per_cpu_ptr(&cpu_armpmu, cpu));599599+ } else if (armpmu_count_irq_users(irq) == 0) {600600+ err = request_percpu_irq(irq, handler, "arm-pmu",601601+ &cpu_armpmu);580602 }581603582604 if (err)583605 goto err_out;584606585585- cpumask_set_cpu(cpu, &armpmu->active_irqs);607607+ per_cpu(cpu_irq, cpu) = irq;586608 return 0;587609588610err_out:589611 pr_err("unable to request IRQ%d for ARM PMU counters\n", irq);590590- return err;591591-}592592-593593-int armpmu_request_irqs(struct arm_pmu *armpmu)594594-{595595- int cpu, err;596596-597597- for_each_cpu(cpu, &armpmu->supported_cpus) {598598- err = armpmu_request_irq(armpmu, cpu);599599- if (err)600600- break;601601- }602602-603612 return err;604613}605614···612647 if (pmu->reset)613648 pmu->reset(pmu);614649650650+ per_cpu(cpu_armpmu, cpu) = pmu;651651+615652 irq = armpmu_get_cpu_irq(pmu, cpu);616653 if (irq) {617617- if (irq_is_percpu_devid(irq)) {654654+ if (irq_is_percpu_devid(irq))618655 enable_percpu_irq(irq, IRQ_TYPE_NONE);619619- return 0;620620- }656656+ else657657+ enable_irq(irq);621658 }622659623660 return 0;···634667 return 0;635668636669 irq = armpmu_get_cpu_irq(pmu, cpu);637637- if (irq && irq_is_percpu_devid(irq))638638- disable_percpu_irq(irq);670670+ if (irq) {671671+ if (irq_is_percpu_devid(irq))672672+ disable_percpu_irq(irq);673673+ else674674+ disable_irq(irq);675675+ }676676+677677+ per_cpu(cpu_armpmu, cpu) = NULL;639678640679 return 0;641680}···773800 &cpu_pmu->node);774801}775802776776-struct arm_pmu *armpmu_alloc(void)803803+static struct arm_pmu *__armpmu_alloc(gfp_t flags)777804{778805 struct arm_pmu *pmu;779806 int cpu;780807781781- pmu = kzalloc(sizeof(*pmu), GFP_KERNEL);808808+ pmu = kzalloc(sizeof(*pmu), flags);782809 if (!pmu) {783810 pr_info("failed to allocate PMU device!\n");784811 goto out;785812 }786813787787- pmu->hw_events = alloc_percpu(struct pmu_hw_events);814814+ pmu->hw_events = alloc_percpu_gfp(struct pmu_hw_events, flags);788815 if (!pmu->hw_events) {789816 pr_info("failed to allocate per-cpu PMU data.\n");790817 goto out_free_pmu;···829856out:830857 return NULL;831858}859859+860860+struct arm_pmu *armpmu_alloc(void)861861+{862862+ return __armpmu_alloc(GFP_KERNEL);863863+}864864+865865+struct arm_pmu *armpmu_alloc_atomic(void)866866+{867867+ return __armpmu_alloc(GFP_ATOMIC);868868+}869869+832870833871void armpmu_free(struct arm_pmu *pmu)834872{
+44-17
drivers/perf/arm_pmu_acpi.c
···1111#include <linux/acpi.h>1212#include <linux/cpumask.h>1313#include <linux/init.h>1414+#include <linux/irq.h>1515+#include <linux/irqdesc.h>1416#include <linux/percpu.h>1517#include <linux/perf/arm_pmu.h>1618···8987 pr_warn("No ACPI PMU IRQ for CPU%d\n", cpu);9088 }91899090+ /*9191+ * Log and request the IRQ so the core arm_pmu code can manage9292+ * it. We'll have to sanity-check IRQs later when we associate9393+ * them with their PMUs.9494+ */9295 per_cpu(pmu_irqs, cpu) = irq;9696+ armpmu_request_irq(irq, cpu);9397 }94989599 return 0;···135127 return pmu;136128 }137129138138- pmu = armpmu_alloc();130130+ pmu = armpmu_alloc_atomic();139131 if (!pmu) {140132 pr_warn("Unable to allocate PMU for CPU%d\n",141133 smp_processor_id());···145137 pmu->acpi_cpuid = cpuid;146138147139 return pmu;140140+}141141+142142+/*143143+ * Check whether the new IRQ is compatible with those already associated with144144+ * the PMU (e.g. we don't have mismatched PPIs).145145+ */146146+static bool pmu_irq_matches(struct arm_pmu *pmu, int irq)147147+{148148+ struct pmu_hw_events __percpu *hw_events = pmu->hw_events;149149+ int cpu;150150+151151+ if (!irq)152152+ return true;153153+154154+ for_each_cpu(cpu, &pmu->supported_cpus) {155155+ int other_irq = per_cpu(hw_events->irq, cpu);156156+ if (!other_irq)157157+ continue;158158+159159+ if (irq == other_irq)160160+ continue;161161+ if (!irq_is_percpu_devid(irq) && !irq_is_percpu_devid(other_irq))162162+ continue;163163+164164+ pr_warn("mismatched PPIs detected\n");165165+ return false;166166+ }167167+168168+ return true;148169}149170150171/*···201164 if (!pmu)202165 return -ENOMEM;203166204204- cpumask_set_cpu(cpu, &pmu->supported_cpus);205205-206167 per_cpu(probed_pmus, cpu) = pmu;207168208208- /*209209- * Log and request the IRQ so the core arm_pmu code can manage it. In210210- * some situations (e.g. mismatched PPIs), we may fail to request the211211- * IRQ. However, it may be too late for us to do anything about it.212212- * The common ARM PMU code will log a warning in this case.213213- */214214- hw_events = pmu->hw_events;215215- per_cpu(hw_events->irq, cpu) = irq;216216- armpmu_request_irq(pmu, cpu);169169+ if (pmu_irq_matches(pmu, irq)) {170170+ hw_events = pmu->hw_events;171171+ per_cpu(hw_events->irq, cpu) = irq;172172+ }173173+174174+ cpumask_set_cpu(cpu, &pmu->supported_cpus);217175218176 /*219177 * Ideally, we'd probe the PMU here when we find the first matching···279247 if (acpi_disabled)280248 return 0;281249282282- /*283283- * We can't request IRQs yet, since we don't know the cookie value284284- * until we know which CPUs share the same logical PMU. We'll handle285285- * that in arm_pmu_acpi_cpu_starting().286286- */287250 ret = arm_pmu_acpi_parse_irqs();288251 if (ret)289252 return ret;
+30-7
drivers/perf/arm_pmu_platform.c
···127127 pdev->dev.of_node);128128 }129129130130- /*131131- * Some platforms have all PMU IRQs OR'd into a single IRQ, with a132132- * special platdata function that attempts to demux them.133133- */134134- if (dev_get_platdata(&pdev->dev))135135- cpumask_setall(&pmu->supported_cpus);136136-137130 for (i = 0; i < num_irqs; i++) {138131 int cpu, irq;139132···155162 }156163157164 return 0;165165+}166166+167167+static int armpmu_request_irqs(struct arm_pmu *armpmu)168168+{169169+ struct pmu_hw_events __percpu *hw_events = armpmu->hw_events;170170+ int cpu, err;171171+172172+ for_each_cpu(cpu, &armpmu->supported_cpus) {173173+ int irq = per_cpu(hw_events->irq, cpu);174174+ if (!irq)175175+ continue;176176+177177+ err = armpmu_request_irq(irq, cpu);178178+ if (err)179179+ break;180180+ }181181+182182+ return err;183183+}184184+185185+static void armpmu_free_irqs(struct arm_pmu *armpmu)186186+{187187+ int cpu;188188+ struct pmu_hw_events __percpu *hw_events = armpmu->hw_events;189189+190190+ for_each_cpu(cpu, &armpmu->supported_cpus) {191191+ int irq = per_cpu(hw_events->irq, cpu);192192+193193+ armpmu_free_irq(irq, cpu);194194+ }158195}159196160197int arm_pmu_device_probe(struct platform_device *pdev,
-1
drivers/scsi/Makefile
···185185CFLAGS_ncr53c8xx.o := $(ncr53c8xx-flags-y) $(ncr53c8xx-flags-m)186186zalon7xx-objs := zalon.o ncr53c8xx.o187187NCR_Q720_mod-objs := NCR_Q720.o ncr53c8xx.o188188-oktagon_esp_mod-objs := oktagon_esp.o oktagon_io.o189188190189# Files generated that shall be removed upon make clean191190clean-files := 53c700_d.h 53c700_u.h
+3-1
drivers/scsi/aacraid/linit.c
···16931693 * Map in the registers from the adapter.16941694 */16951695 aac->base_size = AAC_MIN_FOOTPRINT_SIZE;16961696- if ((*aac_drivers[index].init)(aac))16961696+ if ((*aac_drivers[index].init)(aac)) {16971697+ error = -ENODEV;16971698 goto out_unmap;16991699+ }1698170016991701 if (aac->sync_mode) {17001702 if (aac_sync_mode)
-34
drivers/scsi/aic7xxx/aiclib.c
···11-/*22- * Implementation of Utility functions for all SCSI device types.33- *44- * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs.55- * Copyright (c) 1997, 1998 Kenneth D. Merry.66- * All rights reserved.77- *88- * Redistribution and use in source and binary forms, with or without99- * modification, are permitted provided that the following conditions1010- * are met:1111- * 1. Redistributions of source code must retain the above copyright1212- * notice, this list of conditions, and the following disclaimer,1313- * without modification, immediately at the beginning of the file.1414- * 2. The name of the author may not be used to endorse or promote products1515- * derived from this software without specific prior written permission.1616- *1717- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND1818- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE1919- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE2020- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR2121- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL2222- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS2323- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)2424- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT2525- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY2626- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF2727- * SUCH DAMAGE.2828- *2929- * $FreeBSD: src/sys/cam/scsi/scsi_all.c,v 1.38 2002/09/23 04:56:35 mjacob Exp $3030- * $Id$3131- */3232-3333-#include "aiclib.h"3434-
+1
drivers/scsi/bnx2fc/bnx2fc_io.c
···18891889 /* we will not receive ABTS response for this IO */18901890 BNX2FC_IO_DBG(io_req, "Timer context finished processing "18911891 "this scsi cmd\n");18921892+ return;18921893 }1893189418941895 /* Cancel the timeout_work, as we received IO completion */
···876876877877/**878878 * alua_rtpg_queue() - cause RTPG to be submitted asynchronously879879+ * @pg: ALUA port group associated with @sdev.880880+ * @sdev: SCSI device for which to submit an RTPG.881881+ * @qdata: Information about the callback to invoke after the RTPG.882882+ * @force: Whether or not to submit an RTPG if a work item that will submit an883883+ * RTPG already has been scheduled.879884 *880885 * Returns true if and only if alua_rtpg_work() will be called asynchronously.881886 * That function is responsible for calling @qdata->fn().
···36253625 }36263626 qla2x00_wait_for_hba_ready(base_vha);3627362736283628+ qla2x00_wait_for_sess_deletion(base_vha);36293629+36283630 /*36293631 * if UNLOAD flag is already set, then continue unload,36303632 * where it was set first.
···168168#define DEV_DB_NON_PERSISTENT 0169169#define DEV_DB_PERSISTENT 1170170171171+#define QL4_ISP_REG_DISCONNECT 0xffffffffU172172+171173#define COPY_ISID(dst_isid, src_isid) { \172174 int i, j; \173175 for (i = 0, j = ISID_SIZE - 1; i < ISID_SIZE;) \
+46
drivers/scsi/qla4xxx/ql4_os.c
···262262263263static struct scsi_transport_template *qla4xxx_scsi_transport;264264265265+static int qla4xxx_isp_check_reg(struct scsi_qla_host *ha)266266+{267267+ u32 reg_val = 0;268268+ int rval = QLA_SUCCESS;269269+270270+ if (is_qla8022(ha))271271+ reg_val = readl(&ha->qla4_82xx_reg->host_status);272272+ else if (is_qla8032(ha) || is_qla8042(ha))273273+ reg_val = qla4_8xxx_rd_direct(ha, QLA8XXX_PEG_ALIVE_COUNTER);274274+ else275275+ reg_val = readw(&ha->reg->ctrl_status);276276+277277+ if (reg_val == QL4_ISP_REG_DISCONNECT)278278+ rval = QLA_ERROR;279279+280280+ return rval;281281+}282282+265283static int qla4xxx_send_ping(struct Scsi_Host *shost, uint32_t iface_num,266284 uint32_t iface_type, uint32_t payload_size,267285 uint32_t pid, struct sockaddr *dst_addr)···92049186 struct srb *srb = NULL;92059187 int ret = SUCCESS;92069188 int wait = 0;91899189+ int rval;9207919092089191 ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%llu: Abort command issued cmd=%p, cdb=0x%x\n",92099192 ha->host_no, id, lun, cmd, cmd->cmnd[0]);91939193+91949194+ rval = qla4xxx_isp_check_reg(ha);91959195+ if (rval != QLA_SUCCESS) {91969196+ ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");91979197+ return FAILED;91989198+ }9210919992119200 spin_lock_irqsave(&ha->hardware_lock, flags);92129201 srb = (struct srb *) CMD_SP(cmd);···92669241 struct scsi_qla_host *ha = to_qla_host(cmd->device->host);92679242 struct ddb_entry *ddb_entry = cmd->device->hostdata;92689243 int ret = FAILED, stat;92449244+ int rval;9269924592709246 if (!ddb_entry)92719247 return ret;···92859259 "dpc_flags=%lx, status=%x allowed=%d\n", ha->host_no,92869260 cmd, jiffies, cmd->request->timeout / HZ,92879261 ha->dpc_flags, cmd->result, cmd->allowed));92629262+92639263+ rval = qla4xxx_isp_check_reg(ha);92649264+ if (rval != QLA_SUCCESS) {92659265+ ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");92669266+ return FAILED;92679267+ }9288926892899269 /* FIXME: wait for hba to go online */92909270 stat = qla4xxx_reset_lun(ha, ddb_entry, cmd->device->lun);···93359303 struct scsi_qla_host *ha = to_qla_host(cmd->device->host);93369304 struct ddb_entry *ddb_entry = cmd->device->hostdata;93379305 int stat, ret;93069306+ int rval;9338930793399308 if (!ddb_entry)93409309 return FAILED;···93529319 "to=%x,dpc_flags=%lx, status=%x allowed=%d\n",93539320 ha->host_no, cmd, jiffies, cmd->request->timeout / HZ,93549321 ha->dpc_flags, cmd->result, cmd->allowed));93229322+93239323+ rval = qla4xxx_isp_check_reg(ha);93249324+ if (rval != QLA_SUCCESS) {93259325+ ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");93269326+ return FAILED;93279327+ }9355932893569329 stat = qla4xxx_reset_target(ha, ddb_entry);93579330 if (stat != QLA_SUCCESS) {···94139374{94149375 int return_status = FAILED;94159376 struct scsi_qla_host *ha;93779377+ int rval;9416937894179379 ha = to_qla_host(cmd->device->host);93809380+93819381+ rval = qla4xxx_isp_check_reg(ha);93829382+ if (rval != QLA_SUCCESS) {93839383+ ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");93849384+ return FAILED;93859385+ }9418938694199387 if ((is_qla8032(ha) || is_qla8042(ha)) && ql4xdontresethba)94209388 qla4_83xx_set_idc_dontreset(ha);
+1-1
drivers/scsi/storvsc_drv.c
···16571657 .eh_timed_out = storvsc_eh_timed_out,16581658 .slave_alloc = storvsc_device_alloc,16591659 .slave_configure = storvsc_device_configure,16601660- .cmd_per_lun = 255,16601660+ .cmd_per_lun = 2048,16611661 .this_id = -1,16621662 .use_clustering = ENABLE_CLUSTERING,16631663 /* Make sure we dont get a sg segment crosses a page boundary */
+1-1
drivers/scsi/sym53c8xx_2/sym_hipd.c
···536536 * Look for the greatest clock divisor that allows an 537537 * input speed faster than the period.538538 */539539- while (div-- > 0)539539+ while (--div > 0)540540 if (kpc >= (div_10M[div] << 2)) break;541541542542 /*
+2
drivers/scsi/ufs/ufshcd.c
···43524352 /* REPORT SUPPORTED OPERATION CODES is not supported */43534353 sdev->no_report_opcodes = 1;4354435443554355+ /* WRITE_SAME command is not supported */43564356+ sdev->no_write_same = 1;4355435743564358 ufshcd_set_queue_depth(sdev);43574359
+12-9
drivers/staging/android/ashmem.c
···702702 size_t pgstart, pgend;703703 int ret = -EINVAL;704704705705- if (unlikely(!asma->file))706706- return -EINVAL;705705+ mutex_lock(&ashmem_mutex);707706708708- if (unlikely(copy_from_user(&pin, p, sizeof(pin))))709709- return -EFAULT;707707+ if (unlikely(!asma->file))708708+ goto out_unlock;709709+710710+ if (unlikely(copy_from_user(&pin, p, sizeof(pin)))) {711711+ ret = -EFAULT;712712+ goto out_unlock;713713+ }710714711715 /* per custom, you can pass zero for len to mean "everything onward" */712716 if (!pin.len)713717 pin.len = PAGE_ALIGN(asma->size) - pin.offset;714718715719 if (unlikely((pin.offset | pin.len) & ~PAGE_MASK))716716- return -EINVAL;720720+ goto out_unlock;717721718722 if (unlikely(((__u32)-1) - pin.offset < pin.len))719719- return -EINVAL;723723+ goto out_unlock;720724721725 if (unlikely(PAGE_ALIGN(asma->size) < pin.offset + pin.len))722722- return -EINVAL;726726+ goto out_unlock;723727724728 pgstart = pin.offset / PAGE_SIZE;725729 pgend = pgstart + (pin.len / PAGE_SIZE) - 1;726726-727727- mutex_lock(&ashmem_mutex);728730729731 switch (cmd) {730732 case ASHMEM_PIN:···740738 break;741739 }742740741741+out_unlock:743742 mutex_unlock(&ashmem_mutex);744743745744 return ret;
···7788config FSL_MC_BUS99 bool "QorIQ DPAA2 fsl-mc bus driver"1010- depends on OF && (ARCH_LAYERSCAPE || (COMPILE_TEST && (ARM || ARM64 || X86 || PPC)))1010+ depends on OF && (ARCH_LAYERSCAPE || (COMPILE_TEST && (ARM || ARM64 || X86_LOCAL_APIC || PPC)))1111 select GENERIC_MSI_IRQ_DOMAIN1212 help1313 Driver to enable the bus infrastructure for the QorIQ DPAA2
+19-8
drivers/staging/iio/adc/ad7192.c
···141141#define AD7192_GPOCON_P1DAT BIT(1) /* P1 state */142142#define AD7192_GPOCON_P0DAT BIT(0) /* P0 state */143143144144+#define AD7192_EXT_FREQ_MHZ_MIN 2457600145145+#define AD7192_EXT_FREQ_MHZ_MAX 5120000144146#define AD7192_INT_FREQ_MHZ 4915200145147146148/* NOTE:···220218 ARRAY_SIZE(ad7192_calib_arr));221219}222220221221+static inline bool ad7192_valid_external_frequency(u32 freq)222222+{223223+ return (freq >= AD7192_EXT_FREQ_MHZ_MIN &&224224+ freq <= AD7192_EXT_FREQ_MHZ_MAX);225225+}226226+223227static int ad7192_setup(struct ad7192_state *st,224228 const struct ad7192_platform_data *pdata)225229{···251243 id);252244253245 switch (pdata->clock_source_sel) {254254- case AD7192_CLK_EXT_MCLK1_2:255255- case AD7192_CLK_EXT_MCLK2:256256- st->mclk = AD7192_INT_FREQ_MHZ;257257- break;258246 case AD7192_CLK_INT:259247 case AD7192_CLK_INT_CO:260260- if (pdata->ext_clk_hz)261261- st->mclk = pdata->ext_clk_hz;262262- else263263- st->mclk = AD7192_INT_FREQ_MHZ;248248+ st->mclk = AD7192_INT_FREQ_MHZ;264249 break;250250+ case AD7192_CLK_EXT_MCLK1_2:251251+ case AD7192_CLK_EXT_MCLK2:252252+ if (ad7192_valid_external_frequency(pdata->ext_clk_hz)) {253253+ st->mclk = pdata->ext_clk_hz;254254+ break;255255+ }256256+ dev_err(&st->sd.spi->dev, "Invalid frequency setting %u\n",257257+ pdata->ext_clk_hz);258258+ ret = -EINVAL;259259+ goto out;265260 default:266261 ret = -EINVAL;267262 goto out;
···19171917 /* Not specific buffer needed for ep0 ZLP */19181918 dma_addr_t dma = hs_ep->desc_list_dma;1919191919201920- dwc2_gadget_set_ep0_desc_chain(hsotg, hs_ep);19201920+ if (!index)19211921+ dwc2_gadget_set_ep0_desc_chain(hsotg, hs_ep);19221922+19211923 dwc2_gadget_config_nonisoc_xfer_ddma(hs_ep, dma, 0);19221924 } else {19231925 dwc2_writel(DXEPTSIZ_MC(1) | DXEPTSIZ_PKTCNT(1) |···29762974 if (ints & DXEPINT_STSPHSERCVD) {29772975 dev_dbg(hsotg->dev, "%s: StsPhseRcvd\n", __func__);2978297629792979- /* Move to STATUS IN for DDMA */29802980- if (using_desc_dma(hsotg))29812981- dwc2_hsotg_ep0_zlp(hsotg, true);29772977+ /* Safety check EP0 state when STSPHSERCVD asserted */29782978+ if (hsotg->ep0_state == DWC2_EP0_DATA_OUT) {29792979+ /* Move to STATUS IN for DDMA */29802980+ if (using_desc_dma(hsotg))29812981+ dwc2_hsotg_ep0_zlp(hsotg, true);29822982+ }29832983+29822984 }2983298529842986 if (ints & DXEPINT_BACK2BACKSETUP)···33813375 dwc2_writel(dwc2_hsotg_ep0_mps(hsotg->eps_out[0]->ep.maxpacket) |33823376 DXEPCTL_USBACTEP, hsotg->regs + DIEPCTL0);3383337733843384- dwc2_hsotg_enqueue_setup(hsotg);33853385-33863386- dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n",33873387- dwc2_readl(hsotg->regs + DIEPCTL0),33883388- dwc2_readl(hsotg->regs + DOEPCTL0));33893389-33903378 /* clear global NAKs */33913379 val = DCTL_CGOUTNAK | DCTL_CGNPINNAK;33923380 if (!is_usb_reset)···33913391 mdelay(3);3392339233933393 hsotg->lx_state = DWC2_L0;33943394+33953395+ dwc2_hsotg_enqueue_setup(hsotg);33963396+33973397+ dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n",33983398+ dwc2_readl(hsotg->regs + DIEPCTL0),33993399+ dwc2_readl(hsotg->regs + DOEPCTL0));33943400}3395340133963402static void dwc2_hsotg_core_disconnect(struct dwc2_hsotg *hsotg)
+63-27
drivers/usb/dwc3/core.c
···100100 reg &= ~(DWC3_GCTL_PRTCAPDIR(DWC3_GCTL_PRTCAP_OTG));101101 reg |= DWC3_GCTL_PRTCAPDIR(mode);102102 dwc3_writel(dwc->regs, DWC3_GCTL, reg);103103+104104+ dwc->current_dr_role = mode;103105}104106105107static void __dwc3_set_mode(struct work_struct *work)···134132 spin_lock_irqsave(&dwc->lock, flags);135133136134 dwc3_set_prtcap(dwc, dwc->desired_dr_role);137137-138138- dwc->current_dr_role = dwc->desired_dr_role;139135140136 spin_unlock_irqrestore(&dwc->lock, flags);141137···219219 * XHCI driver will reset the host block. If dwc3 was configured for220220 * host-only mode, then we can return early.221221 */222222- if (dwc->dr_mode == USB_DR_MODE_HOST)222222+ if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST)223223 return 0;224224225225 reg = dwc3_readl(dwc->regs, DWC3_DCTL);···233233234234 udelay(1);235235 } while (--retries);236236+237237+ phy_exit(dwc->usb3_generic_phy);238238+ phy_exit(dwc->usb2_generic_phy);236239237240 return -ETIMEDOUT;238241}···486483 parms->hwparams8 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS8);487484}488485486486+static int dwc3_core_ulpi_init(struct dwc3 *dwc)487487+{488488+ int intf;489489+ int ret = 0;490490+491491+ intf = DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3);492492+493493+ if (intf == DWC3_GHWPARAMS3_HSPHY_IFC_ULPI ||494494+ (intf == DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI &&495495+ dwc->hsphy_interface &&496496+ !strncmp(dwc->hsphy_interface, "ulpi", 4)))497497+ ret = dwc3_ulpi_init(dwc);498498+499499+ return ret;500500+}501501+489502/**490503 * dwc3_phy_setup - Configure USB PHY Interface of DWC3 Core491504 * @dwc: Pointer to our controller context structure···513494static int dwc3_phy_setup(struct dwc3 *dwc)514495{515496 u32 reg;516516- int ret;517497518498 reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));519499···583565 }584566 /* FALLTHROUGH */585567 case DWC3_GHWPARAMS3_HSPHY_IFC_ULPI:586586- ret = dwc3_ulpi_init(dwc);587587- if (ret)588588- return ret;589568 /* FALLTHROUGH */590569 default:591570 break;···739724}740725741726static int dwc3_core_get_phy(struct dwc3 *dwc);727727+static int dwc3_core_ulpi_init(struct dwc3 *dwc);742728743729/**744730 * dwc3_core_init - Low-level initialization of DWC3 Core···771755 dwc->maximum_speed = USB_SPEED_HIGH;772756 }773757774774- ret = dwc3_core_get_phy(dwc);775775- if (ret)776776- goto err0;777777-778778- ret = dwc3_core_soft_reset(dwc);779779- if (ret)780780- goto err0;781781-782758 ret = dwc3_phy_setup(dwc);783759 if (ret)784760 goto err0;761761+762762+ if (!dwc->ulpi_ready) {763763+ ret = dwc3_core_ulpi_init(dwc);764764+ if (ret)765765+ goto err0;766766+ dwc->ulpi_ready = true;767767+ }768768+769769+ if (!dwc->phys_ready) {770770+ ret = dwc3_core_get_phy(dwc);771771+ if (ret)772772+ goto err0a;773773+ dwc->phys_ready = true;774774+ }775775+776776+ ret = dwc3_core_soft_reset(dwc);777777+ if (ret)778778+ goto err0a;785779786780 dwc3_core_setup_global_control(dwc);787781 dwc3_core_num_eps(dwc);···863837 usb_phy_shutdown(dwc->usb3_phy);864838 phy_exit(dwc->usb2_generic_phy);865839 phy_exit(dwc->usb3_generic_phy);840840+841841+err0a:842842+ dwc3_ulpi_exit(dwc);866843867844err0:868845 return ret;···945916946917 switch (dwc->dr_mode) {947918 case USB_DR_MODE_PERIPHERAL:948948- dwc->current_dr_role = DWC3_GCTL_PRTCAP_DEVICE;949919 dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE);950920951921 if (dwc->usb2_phy)···960932 }961933 break;962934 case USB_DR_MODE_HOST:963963- dwc->current_dr_role = DWC3_GCTL_PRTCAP_HOST;964935 dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST);965936966937 if (dwc->usb2_phy)···1261123412621235err3:12631236 dwc3_free_event_buffers(dwc);12641264- dwc3_ulpi_exit(dwc);1265123712661238err2:12671239 pm_runtime_allow(&pdev->dev);···13101284}1311128513121286#ifdef CONFIG_PM13131313-static int dwc3_suspend_common(struct dwc3 *dwc)12871287+static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg)13141288{13151289 unsigned long flags;13161290···13221296 dwc3_core_exit(dwc);13231297 break;13241298 case DWC3_GCTL_PRTCAP_HOST:12991299+ /* do nothing during host runtime_suspend */13001300+ if (!PMSG_IS_AUTO(msg))13011301+ dwc3_core_exit(dwc);13021302+ break;13251303 default:13261304 /* do nothing */13271305 break;···13341304 return 0;13351305}1336130613371337-static int dwc3_resume_common(struct dwc3 *dwc)13071307+static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg)13381308{13391309 unsigned long flags;13401310 int ret;···13501320 spin_unlock_irqrestore(&dwc->lock, flags);13511321 break;13521322 case DWC3_GCTL_PRTCAP_HOST:13231323+ /* nothing to do on host runtime_resume */13241324+ if (!PMSG_IS_AUTO(msg)) {13251325+ ret = dwc3_core_init(dwc);13261326+ if (ret)13271327+ return ret;13281328+ }13291329+ break;13531330 default:13541331 /* do nothing */13551332 break;···13681331static int dwc3_runtime_checks(struct dwc3 *dwc)13691332{13701333 switch (dwc->current_dr_role) {13711371- case USB_DR_MODE_PERIPHERAL:13721372- case USB_DR_MODE_OTG:13341334+ case DWC3_GCTL_PRTCAP_DEVICE:13731335 if (dwc->connected)13741336 return -EBUSY;13751337 break;13761376- case USB_DR_MODE_HOST:13381338+ case DWC3_GCTL_PRTCAP_HOST:13771339 default:13781340 /* do nothing */13791341 break;···13891353 if (dwc3_runtime_checks(dwc))13901354 return -EBUSY;1391135513921392- ret = dwc3_suspend_common(dwc);13561356+ ret = dwc3_suspend_common(dwc, PMSG_AUTO_SUSPEND);13931357 if (ret)13941358 return ret;13951359···1405136914061370 device_init_wakeup(dev, false);1407137114081408- ret = dwc3_resume_common(dwc);13721372+ ret = dwc3_resume_common(dwc, PMSG_AUTO_RESUME);14091373 if (ret)14101374 return ret;14111375···14521416 struct dwc3 *dwc = dev_get_drvdata(dev);14531417 int ret;1454141814551455- ret = dwc3_suspend_common(dwc);14191419+ ret = dwc3_suspend_common(dwc, PMSG_SUSPEND);14561420 if (ret)14571421 return ret;14581422···1468143214691433 pinctrl_pm_select_default_state(dev);1470143414711471- ret = dwc3_resume_common(dwc);14351435+ ret = dwc3_resume_common(dwc, PMSG_RESUME);14721436 if (ret)14731437 return ret;14741438
+14-7
drivers/usb/dwc3/core.h
···158158#define DWC3_GDBGFIFOSPACE_TYPE(n) (((n) << 5) & 0x1e0)159159#define DWC3_GDBGFIFOSPACE_SPACE_AVAILABLE(n) (((n) >> 16) & 0xffff)160160161161-#define DWC3_TXFIFOQ 1162162-#define DWC3_RXFIFOQ 3163163-#define DWC3_TXREQQ 5164164-#define DWC3_RXREQQ 7165165-#define DWC3_RXINFOQ 9166166-#define DWC3_DESCFETCHQ 13167167-#define DWC3_EVENTQ 15161161+#define DWC3_TXFIFOQ 0162162+#define DWC3_RXFIFOQ 1163163+#define DWC3_TXREQQ 2164164+#define DWC3_RXREQQ 3165165+#define DWC3_RXINFOQ 4166166+#define DWC3_PSTATQ 5167167+#define DWC3_DESCFETCHQ 6168168+#define DWC3_EVENTQ 7169169+#define DWC3_AUXEVENTQ 8168170169171/* Global RX Threshold Configuration Register */170172#define DWC3_GRXTHRCFG_MAXRXBURSTSIZE(n) (((n) & 0x1f) << 19)···797795 * @usb3_phy: pointer to USB3 PHY798796 * @usb2_generic_phy: pointer to USB2 PHY799797 * @usb3_generic_phy: pointer to USB3 PHY798798+ * @phys_ready: flag to indicate that PHYs are ready800799 * @ulpi: pointer to ulpi interface800800+ * @ulpi_ready: flag to indicate that ULPI is initialized801801 * @u2sel: parameter from Set SEL request.802802 * @u2pel: parameter from Set SEL request.803803 * @u1sel: parameter from Set SEL request.···897893 struct phy *usb2_generic_phy;898894 struct phy *usb3_generic_phy;899895896896+ bool phys_ready;897897+900898 struct ulpi *ulpi;899899+ bool ulpi_ready;901900902901 void __iomem *regs;903902 size_t regs_size;
···10191019 * have modified this list. normally it's just prepending10201020 * entries (which we'd ignore), but paranoia won't hurt.10211021 */10221022+ *last = ed->ed_next;10231023+ ed->ed_next = NULL;10221024 modified = 0;1023102510241026 /* unlink urbs as requested, but rescan the list after···10791077 goto rescan_this;1080107810811079 /*10821082- * If no TDs are queued, take ED off the ed_rm_list.10801080+ * If no TDs are queued, ED is now idle.10831081 * Otherwise, if the HC is running, reschedule.10841084- * If not, leave it on the list for further dequeues.10821082+ * If the HC isn't running, add ED back to the10831083+ * start of the list for later processing.10851084 */10861085 if (list_empty(&ed->td_list)) {10871087- *last = ed->ed_next;10881088- ed->ed_next = NULL;10891086 ed->state = ED_IDLE;10901087 list_del(&ed->in_use_list);10911088 } else if (ohci->rh_state == OHCI_RH_RUNNING) {10921092- *last = ed->ed_next;10931093- ed->ed_next = NULL;10941089 ed_schedule(ohci, ed);10951090 } else {10961096- last = &ed->ed_next;10911091+ ed->ed_next = ohci->ed_rm_list;10921092+ ohci->ed_rm_list = ed;10931093+ /* Don't loop on the same ED */10941094+ if (last == &ohci->ed_rm_list)10951095+ last = &ed->ed_next;10971096 }1098109710991098 if (modified)
+109
drivers/usb/host/pci-quirks.c
···6666#define AX_INDXC 0x306767#define AX_DATAC 0x3468686969+#define PT_ADDR_INDX 0xE87070+#define PT_READ_INDX 0xE47171+#define PT_SIG_1_ADDR 0xA5207272+#define PT_SIG_2_ADDR 0xA5217373+#define PT_SIG_3_ADDR 0xA5227474+#define PT_SIG_4_ADDR 0xA5237575+#define PT_SIG_1_DATA 0x787676+#define PT_SIG_2_DATA 0x567777+#define PT_SIG_3_DATA 0x347878+#define PT_SIG_4_DATA 0x127979+#define PT4_P1_REG 0xB5218080+#define PT4_P2_REG 0xB5228181+#define PT2_P1_REG 0xD5208282+#define PT2_P2_REG 0xD5218383+#define PT1_P1_REG 0xD5228484+#define PT1_P2_REG 0xD5238585+6986#define NB_PCIE_INDX_ADDR 0xe07087#define NB_PCIE_INDX_DATA 0xe47188#define PCIE_P_CNTL 0x10040···528511 pci_dev_put(smbus);529512}530513EXPORT_SYMBOL_GPL(usb_amd_dev_put);514514+515515+/*516516+ * Check if port is disabled in BIOS on AMD Promontory host.517517+ * BIOS Disabled ports may wake on connect/disconnect and need518518+ * driver workaround to keep them disabled.519519+ * Returns true if port is marked disabled.520520+ */521521+bool usb_amd_pt_check_port(struct device *device, int port)522522+{523523+ unsigned char value, port_shift;524524+ struct pci_dev *pdev;525525+ u16 reg;526526+527527+ pdev = to_pci_dev(device);528528+ pci_write_config_word(pdev, PT_ADDR_INDX, PT_SIG_1_ADDR);529529+530530+ pci_read_config_byte(pdev, PT_READ_INDX, &value);531531+ if (value != PT_SIG_1_DATA)532532+ return false;533533+534534+ pci_write_config_word(pdev, PT_ADDR_INDX, PT_SIG_2_ADDR);535535+536536+ pci_read_config_byte(pdev, PT_READ_INDX, &value);537537+ if (value != PT_SIG_2_DATA)538538+ return false;539539+540540+ pci_write_config_word(pdev, PT_ADDR_INDX, PT_SIG_3_ADDR);541541+542542+ pci_read_config_byte(pdev, PT_READ_INDX, &value);543543+ if (value != PT_SIG_3_DATA)544544+ return false;545545+546546+ pci_write_config_word(pdev, PT_ADDR_INDX, PT_SIG_4_ADDR);547547+548548+ pci_read_config_byte(pdev, PT_READ_INDX, &value);549549+ if (value != PT_SIG_4_DATA)550550+ return false;551551+552552+ /* Check disabled port setting, if bit is set port is enabled */553553+ switch (pdev->device) {554554+ case 0x43b9:555555+ case 0x43ba:556556+ /*557557+ * device is AMD_PROMONTORYA_4(0x43b9) or PROMONTORYA_3(0x43ba)558558+ * PT4_P1_REG bits[7..1] represents USB2.0 ports 6 to 0559559+ * PT4_P2_REG bits[6..0] represents ports 13 to 7560560+ */561561+ if (port > 6) {562562+ reg = PT4_P2_REG;563563+ port_shift = port - 7;564564+ } else {565565+ reg = PT4_P1_REG;566566+ port_shift = port + 1;567567+ }568568+ break;569569+ case 0x43bb:570570+ /*571571+ * device is AMD_PROMONTORYA_2(0x43bb)572572+ * PT2_P1_REG bits[7..5] represents USB2.0 ports 2 to 0573573+ * PT2_P2_REG bits[5..0] represents ports 9 to 3574574+ */575575+ if (port > 2) {576576+ reg = PT2_P2_REG;577577+ port_shift = port - 3;578578+ } else {579579+ reg = PT2_P1_REG;580580+ port_shift = port + 5;581581+ }582582+ break;583583+ case 0x43bc:584584+ /*585585+ * device is AMD_PROMONTORYA_1(0x43bc)586586+ * PT1_P1_REG[7..4] represents USB2.0 ports 3 to 0587587+ * PT1_P2_REG[5..0] represents ports 9 to 4588588+ */589589+ if (port > 3) {590590+ reg = PT1_P2_REG;591591+ port_shift = port - 4;592592+ } else {593593+ reg = PT1_P1_REG;594594+ port_shift = port + 4;595595+ }596596+ break;597597+ default:598598+ return false;599599+ }600600+ pci_write_config_word(pdev, PT_ADDR_INDX, reg);601601+ pci_read_config_byte(pdev, PT_READ_INDX, &value);602602+603603+ return !(value & BIT(port_shift));604604+}605605+EXPORT_SYMBOL_GPL(usb_amd_pt_check_port);531606532607/*533608 * Make sure the controller is completely inactive, unable to
···211211static int xhci_ring_trb_show(struct seq_file *s, void *unused)212212{213213 int i;214214- struct xhci_ring *ring = s->private;214214+ struct xhci_ring *ring = *(struct xhci_ring **)s->private;215215 struct xhci_segment *seg = ring->first_seg;216216217217 for (i = 0; i < ring->num_segs; i++) {···387387388388 snprintf(epriv->name, sizeof(epriv->name), "ep%02d", ep_index);389389 epriv->root = xhci_debugfs_create_ring_dir(xhci,390390- &dev->eps[ep_index].new_ring,390390+ &dev->eps[ep_index].ring,391391 epriv->name,392392 spriv->root);393393 spriv->eps[ep_index] = epriv;
+16-9
drivers/usb/host/xhci-hub.c
···12241224 temp = readl(port_array[wIndex]);12251225 break;12261226 }12271227-12281228- /* Software should not attempt to set12291229- * port link state above '3' (U3) and the port12301230- * must be enabled.12311231- */12321232- if ((temp & PORT_PE) == 0 ||12331233- (link_state > USB_SS_PORT_LS_U3)) {12341234- xhci_warn(xhci, "Cannot set link state.\n");12271227+ /* Port must be enabled */12281228+ if (!(temp & PORT_PE)) {12291229+ retval = -ENODEV;12301230+ break;12311231+ }12321232+ /* Can't set port link state above '3' (U3) */12331233+ if (link_state > USB_SS_PORT_LS_U3) {12341234+ xhci_warn(xhci, "Cannot set port %d link state %d\n",12351235+ wIndex, link_state);12351236 goto error;12361237 }12371237-12381238 if (link_state == USB_SS_PORT_LS_U3) {12391239 slot_id = xhci_find_slot_id_by_port(hcd, xhci,12401240 wIndex + 1);···15211521 } else {15221522 t2 |= PORT_WKOC_E | PORT_WKCONN_E;15231523 t2 &= ~PORT_WKDISC_E;15241524+ }15251525+15261526+ if ((xhci->quirks & XHCI_U2_DISABLE_WAKE) &&15271527+ (hcd->speed < HCD_USB3)) {15281528+ if (usb_amd_pt_check_port(hcd->self.controller,15291529+ port_index))15301530+ t2 &= ~PORT_WAKE_BITS;15241531 }15251532 } else15261533 t2 &= ~PORT_WAKE_BITS;
···646646 return;647647 }648648649649- xhci_debugfs_exit(xhci);650650-651649 xhci_dbc_exit(xhci);652650653651 spin_lock_irq(&xhci->lock);···678680679681 xhci_dbg_trace(xhci, trace_xhci_dbg_init, "cleaning up memory");680682 xhci_mem_cleanup(xhci);683683+ xhci_debugfs_exit(xhci);681684 xhci_dbg_trace(xhci, trace_xhci_dbg_init,682685 "xhci_stop completed - status = %x",683686 readl(&xhci->op_regs->status));···1013101410141015 xhci_dbg(xhci, "cleaning up memory\n");10151016 xhci_mem_cleanup(xhci);10171017+ xhci_debugfs_exit(xhci);10161018 xhci_dbg(xhci, "xhci_stop completed - status = %x\n",10171019 readl(&xhci->op_regs->status));10181020···35443544 virt_dev->eps[i].ep_state &= ~EP_STOP_CMD_PENDING;35453545 del_timer_sync(&virt_dev->eps[i].stop_cmd_timer);35463546 }35473547-35473547+ xhci_debugfs_remove_slot(xhci, udev->slot_id);35483548 ret = xhci_disable_slot(xhci, udev->slot_id);35493549- if (ret) {35503550- xhci_debugfs_remove_slot(xhci, udev->slot_id);35493549+ if (ret)35513550 xhci_free_virt_device(xhci, udev->slot_id);35523552- }35533551}3554355235553553int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id)
+1-1
drivers/usb/host/xhci.h
···18221822/* For controller with a broken Port Disable implementation */18231823#define XHCI_BROKEN_PORT_PED (1 << 25)18241824#define XHCI_LIMIT_ENDPOINT_INTERVAL_7 (1 << 26)18251825-/* Reserved. It was XHCI_U2_DISABLE_WAKE */18251825+#define XHCI_U2_DISABLE_WAKE (1 << 27)18261826#define XHCI_ASMEDIA_MODIFY_FLOWCONTROL (1 << 28)18271827#define XHCI_HW_LPM_DISABLE (1 << 29)18281828
+6
drivers/usb/misc/ldusb.c
···4242#define USB_DEVICE_ID_LD_MICROCASSYTIME 0x1033 /* USB Product ID of Micro-CASSY Time (reserved) */4343#define USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE 0x1035 /* USB Product ID of Micro-CASSY Temperature */4444#define USB_DEVICE_ID_LD_MICROCASSYPH 0x1038 /* USB Product ID of Micro-CASSY pH */4545+#define USB_DEVICE_ID_LD_POWERANALYSERCASSY 0x1040 /* USB Product ID of Power Analyser CASSY */4646+#define USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY 0x1042 /* USB Product ID of Converter Controller CASSY */4747+#define USB_DEVICE_ID_LD_MACHINETESTCASSY 0x1043 /* USB Product ID of Machine Test CASSY */4548#define USB_DEVICE_ID_LD_JWM 0x1080 /* USB Product ID of Joule and Wattmeter */4649#define USB_DEVICE_ID_LD_DMMP 0x1081 /* USB Product ID of Digital Multimeter P (reserved) */4750#define USB_DEVICE_ID_LD_UMIP 0x1090 /* USB Product ID of UMI P */···8784 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTIME) },8885 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYTEMPERATURE) },8986 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MICROCASSYPH) },8787+ { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POWERANALYSERCASSY) },8888+ { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CONVERTERCONTROLLERCASSY) },8989+ { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETESTCASSY) },9090 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_JWM) },9191 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_DMMP) },9292 { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_UMIP) },
···391391 }392392 }393393394394- /*395395- * The pipe must be broken if current urb->status is set, so don't396396- * start next urb.397397- * TODO: to minimize the risk of regression, only check urb->status398398- * for RX, until we have a test case to understand the behavior of TX.399399- */400400- if ((!status || !is_in) && qh && qh->is_ready) {394394+ if (qh != NULL && qh->is_ready) {401395 musb_dbg(musb, "... next ep%d %cX urb %p",402396 hw_ep->epnum, is_in ? 'R' : 'T', next_urb(qh));403397 musb_start_urb(musb, is_in, qh);
+3
drivers/usb/phy/phy-mxs-usb.c
···602602 void __iomem *base = phy->io_priv;603603 enum usb_charger_type chgr_type = UNKNOWN_TYPE;604604605605+ if (!regmap)606606+ return UNKNOWN_TYPE;607607+605608 if (mxs_charger_data_contact_detect(mxs_phy))606609 return chgr_type;607610
+5
drivers/usb/renesas_usbhs/fifo.c
···982982 if ((uintptr_t)pkt->buf & (USBHS_USB_DMAC_XFER_SIZE - 1))983983 goto usbhsf_pio_prepare_pop;984984985985+ /* return at this time if the pipe is running */986986+ if (usbhs_pipe_is_running(pipe))987987+ return 0;988988+985989 usbhs_pipe_config_change_bfre(pipe, 1);986990987991 ret = usbhsf_fifo_select(pipe, fifo, 0);···11761172 usbhsf_fifo_clear(pipe, fifo);11771173 pkt->actual = usbhs_dma_calc_received_size(pkt, chan, rcv_len);1178117411751175+ usbhs_pipe_running(pipe, 0);11791176 usbhsf_dma_stop(pipe, fifo);11801177 usbhsf_dma_unmap(pkt);11811178 usbhsf_fifo_unselect(pipe, pipe->fifo);
···284284 int pool = tmem_frontswap_poolid;285285 int ret;286286287287+ /* THP isn't supported */288288+ if (PageTransHuge(page))289289+ return -1;290290+287291 if (pool < 0)288292 return -1;289293 if (ind64 != ind)
+6
fs/efivarfs/file.c
···88 */991010#include <linux/efi.h>1111+#include <linux/delay.h>1112#include <linux/fs.h>1213#include <linux/slab.h>1314#include <linux/mount.h>···7473 void *data;7574 ssize_t size = 0;7675 int err;7676+7777+ while (!__ratelimit(&file->f_cred->user->ratelimit)) {7878+ if (!msleep_interruptible(50))7979+ return -EINTR;8080+ }77817882 err = efivar_entry_size(var, &datasize);7983
+12-3
fs/signalfd.c
···118118 err |= __put_user(kinfo->si_trapno, &uinfo->ssi_trapno);119119#endif120120#ifdef BUS_MCEERR_AO121121- /* 121121+ /*122122 * Other callers might not initialize the si_lsb field,123123 * so check explicitly for the right codes here.124124 */125125 if (kinfo->si_signo == SIGBUS &&126126- (kinfo->si_code == BUS_MCEERR_AR ||127127- kinfo->si_code == BUS_MCEERR_AO))126126+ kinfo->si_code == BUS_MCEERR_AO)127127+ err |= __put_user((short) kinfo->si_addr_lsb,128128+ &uinfo->ssi_addr_lsb);129129+#endif130130+#ifdef BUS_MCEERR_AR131131+ /*132132+ * Other callers might not initialize the si_lsb field,133133+ * so check explicitly for the right codes here.134134+ */135135+ if (kinfo->si_signo == SIGBUS &&136136+ kinfo->si_code == BUS_MCEERR_AR)128137 err |= __put_user((short) kinfo->si_addr_lsb,129138 &uinfo->ssi_addr_lsb);130139#endif
+1
include/asm-generic/bug.h
···5252#ifndef HAVE_ARCH_BUG5353#define BUG() do { \5454 printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \5555+ barrier_before_unreachable(); \5556 panic("BUG!"); \5657} while (0)5758#endif
+9
include/drm/drm_atomic.h
···134134 * &drm_pending_vblank_event pointer to clean up private events.135135 */136136 struct drm_pending_vblank_event *event;137137+138138+ /**139139+ * @abort_completion:140140+ *141141+ * A flag that's set after drm_atomic_helper_setup_commit takes a second142142+ * reference for the completion of $drm_crtc_state.event. It's used by143143+ * the free code to remove the second reference if commit fails.144144+ */145145+ bool abort_completion;137146};138147139148struct __drm_planes_state {
···208208#endif209209210210/*211211+ * calling noreturn functions, __builtin_unreachable() and __builtin_trap()212212+ * confuse the stack allocation in gcc, leading to overly large stack213213+ * frames, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365214214+ *215215+ * Adding an empty inline assembly before it works around the problem216216+ */217217+#define barrier_before_unreachable() asm volatile("")218218+219219+/*211220 * Mark a position in code as unreachable. This can be used to212221 * suppress control flow warnings after asm blocks that transfer213222 * control elsewhere.···226217 * unreleased. Really, we need to have autoconf for the kernel.227218 */228219#define unreachable() \229229- do { annotate_unreachable(); __builtin_unreachable(); } while (0)220220+ do { \221221+ annotate_unreachable(); \222222+ barrier_before_unreachable(); \223223+ __builtin_unreachable(); \224224+ } while (0)230225231226/* Mark a function definition as prohibited from being cloned. */232227#define __noclone __attribute__((__noclone__, __optimize__("no-tracer")))
+5
include/linux/compiler.h
···8686# define barrier_data(ptr) barrier()8787#endif88888989+/* workaround for GCC PR82365 if needed */9090+#ifndef barrier_before_unreachable9191+# define barrier_before_unreachable() do { } while (0)9292+#endif9393+8994/* Unreachable code */9095#ifdef CONFIG_STACK_VALIDATION9196/*
+9
include/linux/kconfig.h
···4455#include <generated/autoconf.h>6677+#ifdef CONFIG_CPU_BIG_ENDIAN88+#define __BIG_ENDIAN 432199+#else1010+#define __LITTLE_ENDIAN 12341111+#endif1212+713#define __ARG_PLACEHOLDER_1 0,814#define __take_second_arg(__ignored, val, ...) val915···6963 * 0 otherwise.7064 */7165#define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))6666+6767+/* Make sure we always have all types and struct attributes defined. */6868+#include <linux/compiler_types.h>72697370#endif /* __LINUX_KCONFIG_H */
+16-8
include/linux/memcontrol.h
···523523static inline void mod_memcg_state(struct mem_cgroup *memcg,524524 int idx, int val)525525{526526- preempt_disable();526526+ unsigned long flags;527527+528528+ local_irq_save(flags);527529 __mod_memcg_state(memcg, idx, val);528528- preempt_enable();530530+ local_irq_restore(flags);529531}530532531533/**···608606static inline void mod_lruvec_state(struct lruvec *lruvec,609607 enum node_stat_item idx, int val)610608{611611- preempt_disable();609609+ unsigned long flags;610610+611611+ local_irq_save(flags);612612 __mod_lruvec_state(lruvec, idx, val);613613- preempt_enable();613613+ local_irq_restore(flags);614614}615615616616static inline void __mod_lruvec_page_state(struct page *page,···634630static inline void mod_lruvec_page_state(struct page *page,635631 enum node_stat_item idx, int val)636632{637637- preempt_disable();633633+ unsigned long flags;634634+635635+ local_irq_save(flags);638636 __mod_lruvec_page_state(page, idx, val);639639- preempt_enable();637637+ local_irq_restore(flags);640638}641639642640unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,···665659static inline void count_memcg_events(struct mem_cgroup *memcg,666660 int idx, unsigned long count)667661{668668- preempt_disable();662662+ unsigned long flags;663663+664664+ local_irq_save(flags);669665 __count_memcg_events(memcg, idx, count);670670- preempt_enable();666666+ local_irq_restore(flags);671667}672668673669/* idx can be of type enum memcg_event_item or vm_event_item */
+4-22
include/linux/perf/arm_pmu.h
···14141515#include <linux/interrupt.h>1616#include <linux/perf_event.h>1717+#include <linux/platform_device.h>1718#include <linux/sysfs.h>1819#include <asm/cputype.h>1919-2020-/*2121- * struct arm_pmu_platdata - ARM PMU platform data2222- *2323- * @handle_irq: an optional handler which will be called from the2424- * interrupt and passed the address of the low level handler,2525- * and can be used to implement any platform specific handling2626- * before or after calling it.2727- *2828- * @irq_flags: if non-zero, these flags will be passed to request_irq2929- * when requesting interrupts for this PMU device.3030- */3131-struct arm_pmu_platdata {3232- irqreturn_t (*handle_irq)(int irq, void *dev,3333- irq_handler_t pmu_handler);3434- unsigned long irq_flags;3535-};36203721#ifdef CONFIG_ARM_PMU3822···76927793struct arm_pmu {7894 struct pmu pmu;7979- cpumask_t active_irqs;8095 cpumask_t supported_cpus;8196 char *name;8297 irqreturn_t (*handle_irq)(int irq_num, void *dev);···157174158175/* Internal functions only for core arm_pmu code */159176struct arm_pmu *armpmu_alloc(void);177177+struct arm_pmu *armpmu_alloc_atomic(void);160178void armpmu_free(struct arm_pmu *pmu);161179int armpmu_register(struct arm_pmu *pmu);162162-int armpmu_request_irqs(struct arm_pmu *armpmu);163163-void armpmu_free_irqs(struct arm_pmu *armpmu);164164-int armpmu_request_irq(struct arm_pmu *armpmu, int cpu);165165-void armpmu_free_irq(struct arm_pmu *armpmu, int cpu);180180+int armpmu_request_irq(int irq, int cpu);181181+void armpmu_free_irq(int irq, int cpu);166182167183#define ARMV8_PMU_PDEV_NAME "armv8-pmu"168184
+12-1
include/linux/sched/mm.h
···3636 atomic_inc(&mm->mm_count);3737}38383939-extern void mmdrop(struct mm_struct *mm);3939+extern void __mmdrop(struct mm_struct *mm);4040+4141+static inline void mmdrop(struct mm_struct *mm)4242+{4343+ /*4444+ * The implicit full barrier implied by atomic_dec_and_test() is4545+ * required by the membarrier system call before returning to4646+ * user-space, after storing to rq->curr.4747+ */4848+ if (unlikely(atomic_dec_and_test(&mm->mm_count)))4949+ __mmdrop(mm);5050+}40514152/**4253 * mmget() - Pin the address space associated with a &struct mm_struct.
···41684168 * The TX headroom reserved by mac80211 for its own tx_status functions.41694169 * This is enough for the radiotap header.41704170 */41714171-#define IEEE80211_TX_STATUS_HEADROOM 1441714171+#define IEEE80211_TX_STATUS_HEADROOM ALIGN(14, 4)4172417241734173/**41744174 * ieee80211_sta_set_buffered - inform mac80211 about driver-buffered frames
···2929 */3030 RDMA_RESTRACK_QP,3131 /**3232- * @RDMA_RESTRACK_XRCD: XRC domain (XRCD)3333- */3434- RDMA_RESTRACK_XRCD,3535- /**3632 * @RDMA_RESTRACK_MAX: Last entry, used for array dclarations3733 */3834 RDMA_RESTRACK_MAX
+31-12
include/rdma/uverbs_ioctl.h
···276276 */277277278278struct uverbs_ptr_attr {279279- union {280280- u64 data;281281- void __user *ptr;282282- };279279+ u64 data;283280 u16 len;284281 /* Combination of bits from enum UVERBS_ATTR_F_XXXX */285282 u16 flags;···348351}349352350353static inline int uverbs_copy_to(const struct uverbs_attr_bundle *attrs_bundle,351351- size_t idx, const void *from)354354+ size_t idx, const void *from, size_t size)352355{353356 const struct uverbs_attr *attr = uverbs_attr_get(attrs_bundle, idx);354357 u16 flags;358358+ size_t min_size;355359356360 if (IS_ERR(attr))357361 return PTR_ERR(attr);358362363363+ min_size = min_t(size_t, attr->ptr_attr.len, size);364364+ if (copy_to_user(u64_to_user_ptr(attr->ptr_attr.data), from, min_size))365365+ return -EFAULT;366366+359367 flags = attr->ptr_attr.flags | UVERBS_ATTR_F_VALID_OUTPUT;360360- return (!copy_to_user(attr->ptr_attr.ptr, from, attr->ptr_attr.len) &&361361- !put_user(flags, &attr->uattr->flags)) ? 0 : -EFAULT;368368+ if (put_user(flags, &attr->uattr->flags))369369+ return -EFAULT;370370+371371+ return 0;362372}363373364364-static inline int _uverbs_copy_from(void *to, size_t to_size,374374+static inline bool uverbs_attr_ptr_is_inline(const struct uverbs_attr *attr)375375+{376376+ return attr->ptr_attr.len <= sizeof(attr->ptr_attr.data);377377+}378378+379379+static inline int _uverbs_copy_from(void *to,365380 const struct uverbs_attr_bundle *attrs_bundle,366366- size_t idx)381381+ size_t idx,382382+ size_t size)367383{368384 const struct uverbs_attr *attr = uverbs_attr_get(attrs_bundle, idx);369385370386 if (IS_ERR(attr))371387 return PTR_ERR(attr);372388373373- if (to_size <= sizeof(((struct ib_uverbs_attr *)0)->data))389389+ /*390390+ * Validation ensures attr->ptr_attr.len >= size. If the caller is391391+ * using UVERBS_ATTR_SPEC_F_MIN_SZ then it must call copy_from with392392+ * the right size.393393+ */394394+ if (unlikely(size < attr->ptr_attr.len))395395+ return -EINVAL;396396+397397+ if (uverbs_attr_ptr_is_inline(attr))374398 memcpy(to, &attr->ptr_attr.data, attr->ptr_attr.len);375375- else if (copy_from_user(to, attr->ptr_attr.ptr, attr->ptr_attr.len))399399+ else if (copy_from_user(to, u64_to_user_ptr(attr->ptr_attr.data),400400+ attr->ptr_attr.len))376401 return -EFAULT;377402378403 return 0;379404}380405381406#define uverbs_copy_from(to, attrs_bundle, idx) \382382- _uverbs_copy_from(to, sizeof(*(to)), attrs_bundle, idx)407407+ _uverbs_copy_from(to, attrs_bundle, idx, sizeof(*to))383408384409/* =================================================385410 * Definitions -> Specs infrastructure
+2-2
include/uapi/linux/ptrace.h
···6969#define PTRACE_SECCOMP_GET_METADATA 0x420d70707171struct seccomp_metadata {7272- unsigned long filter_off; /* Input: which filter */7373- unsigned int flags; /* Output: filter's flags */7272+ __u64 filter_off; /* Input: which filter */7373+ __u64 flags; /* Output: filter's flags */7474};75757676/* Read signals from a shared (process wide) queue */
+2-2
include/uapi/rdma/rdma_user_ioctl.h
···6565 __u16 len; /* only for pointers */6666 __u16 flags; /* combination of UVERBS_ATTR_F_XXXX */6767 __u16 reserved;6868- __u64 data; /* ptr to command, inline data or idr/fd */6868+ __aligned_u64 data; /* ptr to command, inline data or idr/fd */6969};70707171struct ib_uverbs_ioctl_hdr {···7373 __u16 object_id;7474 __u16 method_id;7575 __u16 num_attrs;7676- __u64 reserved;7676+ __aligned_u64 reserved;7777 struct ib_uverbs_attr attrs[0];7878};7979
+20-13
kernel/bpf/arraymap.c
···2626{2727 int i;28282929- for (i = 0; i < array->map.max_entries; i++)2929+ for (i = 0; i < array->map.max_entries; i++) {3030 free_percpu(array->pptrs[i]);3131+ cond_resched();3232+ }3133}32343335static int bpf_array_alloc_percpu(struct bpf_array *array)···4543 return -ENOMEM;4644 }4745 array->pptrs[i] = ptr;4646+ cond_resched();4847 }49485049 return 0;···7673static struct bpf_map *array_map_alloc(union bpf_attr *attr)7774{7875 bool percpu = attr->map_type == BPF_MAP_TYPE_PERCPU_ARRAY;7979- int numa_node = bpf_map_attr_numa_node(attr);7676+ int ret, numa_node = bpf_map_attr_numa_node(attr);8077 u32 elem_size, index_mask, max_entries;8178 bool unpriv = !capable(CAP_SYS_ADMIN);7979+ u64 cost, array_size, mask64;8280 struct bpf_array *array;8383- u64 array_size, mask64;84818582 elem_size = round_up(attr->value_size, 8);8683···112109 array_size += (u64) max_entries * elem_size;113110114111 /* make sure there is no u32 overflow later in round_up() */115115- if (array_size >= U32_MAX - PAGE_SIZE)112112+ cost = array_size;113113+ if (cost >= U32_MAX - PAGE_SIZE)116114 return ERR_PTR(-ENOMEM);115115+ if (percpu) {116116+ cost += (u64)attr->max_entries * elem_size * num_possible_cpus();117117+ if (cost >= U32_MAX - PAGE_SIZE)118118+ return ERR_PTR(-ENOMEM);119119+ }120120+ cost = round_up(cost, PAGE_SIZE) >> PAGE_SHIFT;121121+122122+ ret = bpf_map_precharge_memlock(cost);123123+ if (ret < 0)124124+ return ERR_PTR(ret);117125118126 /* allocate all map elements and zero-initialize them */119127 array = bpf_map_area_alloc(array_size, numa_node);···135121136122 /* copy mandatory map attributes */137123 bpf_map_init_from_attr(&array->map, attr);124124+ array->map.pages = cost;138125 array->elem_size = elem_size;139126140140- if (!percpu)141141- goto out;142142-143143- array_size += (u64) attr->max_entries * elem_size * num_possible_cpus();144144-145145- if (array_size >= U32_MAX - PAGE_SIZE ||146146- bpf_array_alloc_percpu(array)) {127127+ if (percpu && bpf_array_alloc_percpu(array)) {147128 bpf_map_area_free(array);148129 return ERR_PTR(-ENOMEM);149130 }150150-out:151151- array->map.pages = round_up(array_size, PAGE_SIZE) >> PAGE_SHIFT;152131153132 return &array->map;154133}
+1-1
kernel/bpf/core.c
···15901590 * so always copy 'cnt' prog_ids to the user.15911591 * In a rare race the user will see zero prog_ids15921592 */15931593- ids = kcalloc(cnt, sizeof(u32), GFP_USER);15931593+ ids = kcalloc(cnt, sizeof(u32), GFP_USER | __GFP_NOWARN);15941594 if (!ids)15951595 return -ENOMEM;15961596 rcu_read_lock();
···555555 struct lpm_trie_node __rcu **slot;556556 struct lpm_trie_node *node;557557558558- raw_spin_lock(&trie->lock);558558+ /* Wait for outstanding programs to complete559559+ * update/lookup/delete/get_next_key and free the trie.560560+ */561561+ synchronize_rcu();559562560563 /* Always start at the root and walk down to a node that has no561564 * children. Then free that node, nullify its reference in the parent···569566 slot = &trie->root;570567571568 for (;;) {572572- node = rcu_dereference_protected(*slot,573573- lockdep_is_held(&trie->lock));569569+ node = rcu_dereference_protected(*slot, 1);574570 if (!node)575575- goto unlock;571571+ goto out;576572577573 if (rcu_access_pointer(node->child[0])) {578574 slot = &node->child[0];···589587 }590588 }591589592592-unlock:593593- raw_spin_unlock(&trie->lock);590590+out:591591+ kfree(trie);594592}595593596594static int trie_get_next_key(struct bpf_map *map, void *_key, void *_next_key)
+2-1
kernel/bpf/sockmap.c
···521521static struct bpf_map *sock_map_alloc(union bpf_attr *attr)522522{523523 struct bpf_stab *stab;524524- int err = -EINVAL;525524 u64 cost;525525+ int err;526526527527 if (!capable(CAP_NET_ADMIN))528528 return ERR_PTR(-EPERM);···547547548548 /* make sure page count doesn't overflow */549549 cost = (u64) stab->map.max_entries * sizeof(struct sock *);550550+ err = -EINVAL;550551 if (cost >= U32_MAX - PAGE_SIZE)551552 goto free_stab;552553
+2-13
kernel/fork.c
···592592 * is dropped: either by a lazy thread or by593593 * mmput. Free the page directory and the mm.594594 */595595-static void __mmdrop(struct mm_struct *mm)595595+void __mmdrop(struct mm_struct *mm)596596{597597 BUG_ON(mm == &init_mm);598598 mm_free_pgd(mm);···603603 put_user_ns(mm->user_ns);604604 free_mm(mm);605605}606606-607607-void mmdrop(struct mm_struct *mm)608608-{609609- /*610610- * The implicit full barrier implied by atomic_dec_and_test() is611611- * required by the membarrier system call before returning to612612- * user-space, after storing to rq->curr.613613- */614614- if (unlikely(atomic_dec_and_test(&mm->mm_count)))615615- __mmdrop(mm);616616-}617617-EXPORT_SYMBOL_GPL(mmdrop);606606+EXPORT_SYMBOL_GPL(__mmdrop);618607619608static void mmdrop_async_fn(struct work_struct *work)620609{
···41804180EXPORT_SYMBOL_GPL(workqueue_set_max_active);4181418141824182/**41834183+ * current_work - retrieve %current task's work struct41844184+ *41854185+ * Determine if %current task is a workqueue worker and what it's working on.41864186+ * Useful to find out the context that the %current task is running in.41874187+ *41884188+ * Return: work struct if %current task is a workqueue worker, %NULL otherwise.41894189+ */41904190+struct work_struct *current_work(void)41914191+{41924192+ struct worker *worker = current_wq_worker();41934193+41944194+ return worker ? worker->current_work : NULL;41954195+}41964196+EXPORT_SYMBOL(current_work);41974197+41984198+/**41834199 * current_is_workqueue_rescuer - is %current workqueue rescuer?41844200 *41854201 * Determine whether %current is a workqueue rescuer. Can be used from
···21252125 preempt_enable();2126212621272127 if (!this_cpu_read(ida_bitmap)) {21282128- struct ida_bitmap *bitmap = kmalloc(sizeof(*bitmap), gfp);21282128+ struct ida_bitmap *bitmap = kzalloc(sizeof(*bitmap), gfp);21292129 if (!bitmap)21302130 return 0;21312131 if (this_cpu_cmpxchg(ida_bitmap, NULL, bitmap))
+1-1
lib/vsprintf.c
···18491849{18501850 const int default_width = 2 * sizeof(void *);1851185118521852- if (!ptr && *fmt != 'K') {18521852+ if (!ptr && *fmt != 'K' && *fmt != 'x') {18531853 /*18541854 * Print (null) with the same width as a pointer so it makes18551855 * tabular output look nice.
+6
mm/mlock.c
···6464 mod_zone_page_state(page_zone(page), NR_MLOCK,6565 -hpage_nr_pages(page));6666 count_vm_event(UNEVICTABLE_PGCLEARED);6767+ /*6868+ * The previous TestClearPageMlocked() corresponds to the smp_mb()6969+ * in __pagevec_lru_add_fn().7070+ *7171+ * See __pagevec_lru_add_fn for more explanation.7272+ */6773 if (!isolate_lru_page(page)) {6874 putback_lru_page(page);6975 } else {
+4
mm/page_alloc.c
···4646#include <linux/stop_machine.h>4747#include <linux/sort.h>4848#include <linux/pfn.h>4949+#include <xen/xen.h>4950#include <linux/backing-dev.h>5051#include <linux/fault-inject.h>5152#include <linux/page-isolation.h>···347346{348347 /* Always populate low zones for address-constrained allocations */349348 if (zone_end < pgdat_end_pfn(pgdat))349349+ return true;350350+ /* Xen PV domains need page structures early */351351+ if (xen_pv_domain())350352 return true;351353 (*nr_initialised)++;352354 if ((*nr_initialised > pgdat->static_init_pgcnt) &&
+48-36
mm/swap.c
···446446}447447448448/**449449- * add_page_to_unevictable_list - add a page to the unevictable list450450- * @page: the page to be added to the unevictable list451451- *452452- * Add page directly to its zone's unevictable list. To avoid races with453453- * tasks that might be making the page evictable, through eg. munlock,454454- * munmap or exit, while it's not on the lru, we want to add the page455455- * while it's locked or otherwise "invisible" to other tasks. This is456456- * difficult to do when using the pagevec cache, so bypass that.457457- */458458-void add_page_to_unevictable_list(struct page *page)459459-{460460- struct pglist_data *pgdat = page_pgdat(page);461461- struct lruvec *lruvec;462462-463463- spin_lock_irq(&pgdat->lru_lock);464464- lruvec = mem_cgroup_page_lruvec(page, pgdat);465465- ClearPageActive(page);466466- SetPageUnevictable(page);467467- SetPageLRU(page);468468- add_page_to_lru_list(page, lruvec, LRU_UNEVICTABLE);469469- spin_unlock_irq(&pgdat->lru_lock);470470-}471471-472472-/**473449 * lru_cache_add_active_or_unevictable474450 * @page: the page to be added to LRU475451 * @vma: vma in which page is mapped for determining reclaimability···460484{461485 VM_BUG_ON_PAGE(PageLRU(page), page);462486463463- if (likely((vma->vm_flags & (VM_LOCKED | VM_SPECIAL)) != VM_LOCKED)) {487487+ if (likely((vma->vm_flags & (VM_LOCKED | VM_SPECIAL)) != VM_LOCKED))464488 SetPageActive(page);465465- lru_cache_add(page);466466- return;467467- }468468-469469- if (!TestSetPageMlocked(page)) {489489+ else if (!TestSetPageMlocked(page)) {470490 /*471491 * We use the irq-unsafe __mod_zone_page_stat because this472492 * counter is not modified from interrupt context, and the pte···472500 hpage_nr_pages(page));473501 count_vm_event(UNEVICTABLE_PGMLOCKED);474502 }475475- add_page_to_unevictable_list(page);503503+ lru_cache_add(page);476504}477505478506/*···858886static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec,859887 void *arg)860888{861861- int file = page_is_file_cache(page);862862- int active = PageActive(page);863863- enum lru_list lru = page_lru(page);889889+ enum lru_list lru;890890+ int was_unevictable = TestClearPageUnevictable(page);864891865892 VM_BUG_ON_PAGE(PageLRU(page), page);866893867894 SetPageLRU(page);895895+ /*896896+ * Page becomes evictable in two ways:897897+ * 1) Within LRU lock [munlock_vma_pages() and __munlock_pagevec()].898898+ * 2) Before acquiring LRU lock to put the page to correct LRU and then899899+ * a) do PageLRU check with lock [check_move_unevictable_pages]900900+ * b) do PageLRU check before lock [clear_page_mlock]901901+ *902902+ * (1) & (2a) are ok as LRU lock will serialize them. For (2b), we need903903+ * following strict ordering:904904+ *905905+ * #0: __pagevec_lru_add_fn #1: clear_page_mlock906906+ *907907+ * SetPageLRU() TestClearPageMlocked()908908+ * smp_mb() // explicit ordering // above provides strict909909+ * // ordering910910+ * PageMlocked() PageLRU()911911+ *912912+ *913913+ * if '#1' does not observe setting of PG_lru by '#0' and fails914914+ * isolation, the explicit barrier will make sure that page_evictable915915+ * check will put the page in correct LRU. Without smp_mb(), SetPageLRU916916+ * can be reordered after PageMlocked check and can make '#1' to fail917917+ * the isolation of the page whose Mlocked bit is cleared (#0 is also918918+ * looking at the same page) and the evictable page will be stranded919919+ * in an unevictable LRU.920920+ */921921+ smp_mb();922922+923923+ if (page_evictable(page)) {924924+ lru = page_lru(page);925925+ update_page_reclaim_stat(lruvec, page_is_file_cache(page),926926+ PageActive(page));927927+ if (was_unevictable)928928+ count_vm_event(UNEVICTABLE_PGRESCUED);929929+ } else {930930+ lru = LRU_UNEVICTABLE;931931+ ClearPageActive(page);932932+ SetPageUnevictable(page);933933+ if (!was_unevictable)934934+ count_vm_event(UNEVICTABLE_PGCULLED);935935+ }936936+868937 add_page_to_lru_list(page, lruvec, lru);869869- update_page_reclaim_stat(lruvec, file, active);870938 trace_mm_lru_insertion(page, lru);871939}872940···925913 * @pvec: Where the resulting entries are placed926914 * @mapping: The address_space to search927915 * @start: The starting entry index928928- * @nr_pages: The maximum number of pages916916+ * @nr_entries: The maximum number of pages929917 * @indices: The cache indices corresponding to the entries in @pvec930918 *931919 * pagevec_lookup_entries() will search for and return a group of up
+7-3
mm/vmalloc.c
···19431943}1944194419451945#if defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA32)19461946-#define GFP_VMALLOC32 GFP_DMA32 | GFP_KERNEL19461946+#define GFP_VMALLOC32 (GFP_DMA32 | GFP_KERNEL)19471947#elif defined(CONFIG_64BIT) && defined(CONFIG_ZONE_DMA)19481948-#define GFP_VMALLOC32 GFP_DMA | GFP_KERNEL19481948+#define GFP_VMALLOC32 (GFP_DMA | GFP_KERNEL)19491949#else19501950-#define GFP_VMALLOC32 GFP_KERNEL19501950+/*19511951+ * 64b systems should always have either DMA or DMA32 zones. For others19521952+ * GFP_DMA32 should do the right thing and use the normal zone.19531953+ */19541954+#define GFP_VMALLOC32 GFP_DMA32 | GFP_KERNEL19511955#endif1952195619531957/**
+1-58
mm/vmscan.c
···769769 */770770void putback_lru_page(struct page *page)771771{772772- bool is_unevictable;773773- int was_unevictable = PageUnevictable(page);774774-775775- VM_BUG_ON_PAGE(PageLRU(page), page);776776-777777-redo:778778- ClearPageUnevictable(page);779779-780780- if (page_evictable(page)) {781781- /*782782- * For evictable pages, we can use the cache.783783- * In event of a race, worst case is we end up with an784784- * unevictable page on [in]active list.785785- * We know how to handle that.786786- */787787- is_unevictable = false;788788- lru_cache_add(page);789789- } else {790790- /*791791- * Put unevictable pages directly on zone's unevictable792792- * list.793793- */794794- is_unevictable = true;795795- add_page_to_unevictable_list(page);796796- /*797797- * When racing with an mlock or AS_UNEVICTABLE clearing798798- * (page is unlocked) make sure that if the other thread799799- * does not observe our setting of PG_lru and fails800800- * isolation/check_move_unevictable_pages,801801- * we see PG_mlocked/AS_UNEVICTABLE cleared below and move802802- * the page back to the evictable list.803803- *804804- * The other side is TestClearPageMlocked() or shmem_lock().805805- */806806- smp_mb();807807- }808808-809809- /*810810- * page's status can change while we move it among lru. If an evictable811811- * page is on unevictable list, it never be freed. To avoid that,812812- * check after we added it to the list, again.813813- */814814- if (is_unevictable && page_evictable(page)) {815815- if (!isolate_lru_page(page)) {816816- put_page(page);817817- goto redo;818818- }819819- /* This means someone else dropped this page from LRU820820- * So, it will be freed or putback to LRU again. There is821821- * nothing to do here.822822- */823823- }824824-825825- if (was_unevictable && !is_unevictable)826826- count_vm_event(UNEVICTABLE_PGRESCUED);827827- else if (!was_unevictable && is_unevictable)828828- count_vm_event(UNEVICTABLE_PGCULLED);829829-772772+ lru_cache_add(page);830773 put_page(page); /* drop ref from isolate */831774}832775
+1-1
mm/zpool.c
···360360361361/**362362 * zpool_evictable() - Test if zpool is potentially evictable363363- * @pool The zpool to test363363+ * @zpool: The zpool to test364364 *365365 * Zpool is only potentially evictable when it's created with struct366366 * zpool_ops.evict and its driver implements struct zpool_driver.shrink.
+6
mm/zswap.c
···10071007 u8 *src, *dst;10081008 struct zswap_header zhdr = { .swpentry = swp_entry(type, offset) };1009100910101010+ /* THP isn't supported */10111011+ if (PageTransHuge(page)) {10121012+ ret = -EINVAL;10131013+ goto reject;10141014+ }10151015+10101016 if (!zswap_enabled || !tree) {10111017 ret = -ENODEV;10121018 goto reject;
···330330 continue;331331 }332332 if (table_base + v != ipt_next_entry(e) &&333333- !(e->ip.flags & IPT_F_GOTO))333333+ !(e->ip.flags & IPT_F_GOTO)) {334334+ if (unlikely(stackidx >= private->stacksize)) {335335+ verdict = NF_DROP;336336+ break;337337+ }334338 jumpstack[stackidx++] = e;339339+ }335340336341 e = get_entry(table_base, v);337342 continue;
+12-8
net/ipv4/netfilter/ipt_CLUSTERIP.c
···107107108108 local_bh_disable();109109 if (refcount_dec_and_lock(&c->entries, &cn->lock)) {110110- list_del_rcu(&c->list);111111- spin_unlock(&cn->lock);112112- local_bh_enable();113113-114114- unregister_netdevice_notifier(&c->notifier);115115-116110 /* In case anyone still accesses the file, the open/close117111 * functions are also incrementing the refcount on their own,118112 * so it's safe to remove the entry even if it's in use. */···114120 if (cn->procdir)115121 proc_remove(c->pde);116122#endif123123+ list_del_rcu(&c->list);124124+ spin_unlock(&cn->lock);125125+ local_bh_enable();126126+127127+ unregister_netdevice_notifier(&c->notifier);128128+117129 return;118130 }119131 local_bh_enable();···154154#endif155155 if (unlikely(!refcount_inc_not_zero(&c->refcount)))156156 c = NULL;157157- else if (entry)158158- refcount_inc(&c->entries);157157+ else if (entry) {158158+ if (unlikely(!refcount_inc_not_zero(&c->entries))) {159159+ clusterip_config_put(c);160160+ c = NULL;161161+ }162162+ }159163 }160164 rcu_read_unlock_bh();161165
+5-7
net/ipv4/netfilter/ipt_ECN.c
···9898 const struct ipt_ECN_info *einfo = par->targinfo;9999 const struct ipt_entry *e = par->entryinfo;100100101101- if (einfo->operation & IPT_ECN_OP_MASK) {102102- pr_info("unsupported ECN operation %x\n", einfo->operation);101101+ if (einfo->operation & IPT_ECN_OP_MASK)103102 return -EINVAL;104104- }105105- if (einfo->ip_ect & ~IPT_ECN_IP_MASK) {106106- pr_info("new ECT codepoint %x out of mask\n", einfo->ip_ect);103103+104104+ if (einfo->ip_ect & ~IPT_ECN_IP_MASK)107105 return -EINVAL;108108- }106106+109107 if ((einfo->operation & (IPT_ECN_OP_SET_ECE|IPT_ECN_OP_SET_CWR)) &&110108 (e->ip.proto != IPPROTO_TCP || (e->ip.invflags & XT_INV_PROTO))) {111111- pr_info("cannot use TCP operations on a non-tcp rule\n");109109+ pr_info_ratelimited("cannot use operation on non-tcp rule\n");112110 return -EINVAL;113111 }114112 return 0;
+2-2
net/ipv4/netfilter/ipt_REJECT.c
···7474 const struct ipt_entry *e = par->entryinfo;75757676 if (rejinfo->with == IPT_ICMP_ECHOREPLY) {7777- pr_info("ECHOREPLY no longer supported.\n");7777+ pr_info_ratelimited("ECHOREPLY no longer supported.\n");7878 return -EINVAL;7979 } else if (rejinfo->with == IPT_TCP_RESET) {8080 /* Must specify that it's a TCP packet */8181 if (e->ip.proto != IPPROTO_TCP ||8282 (e->ip.invflags & XT_INV_PROTO)) {8383- pr_info("TCP_RESET invalid for non-tcp\n");8383+ pr_info_ratelimited("TCP_RESET invalid for non-tcp\n");8484 return -EINVAL;8585 }8686 }
+3-3
net/ipv4/netfilter/ipt_rpfilter.c
···105105 const struct xt_rpfilter_info *info = par->matchinfo;106106 unsigned int options = ~XT_RPFILTER_OPTION_MASK;107107 if (info->flags & options) {108108- pr_info("unknown options encountered");108108+ pr_info_ratelimited("unknown options\n");109109 return -EINVAL;110110 }111111112112 if (strcmp(par->table, "mangle") != 0 &&113113 strcmp(par->table, "raw") != 0) {114114- pr_info("match only valid in the \'raw\' "115115- "or \'mangle\' tables, not \'%s\'.\n", par->table);114114+ pr_info_ratelimited("only valid in \'raw\' or \'mangle\' table, not \'%s\'\n",115115+ par->table);116116 return -EINVAL;117117 }118118
···88 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>99 * Copyright 2007-2010, Intel Corporation1010 * Copyright(c) 2015-2017 Intel Deutschland GmbH1111+ * Copyright (C) 2018 Intel Corporation1112 *1213 * This program is free software; you can redistribute it and/or modify1314 * it under the terms of the GNU General Public License version 2 as···305304 * driver so reject the timeout update.306305 */307306 status = WLAN_STATUS_REQUEST_DECLINED;308308- ieee80211_send_addba_resp(sta->sdata, sta->sta.addr,309309- tid, dialog_token, status,310310- 1, buf_size, timeout);311307 goto end;312308 }313309
···12551255}1256125612571257static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata,12581258- struct ieee80211_mgmt *mgmt, size_t len)12581258+ struct ieee80211_mgmt *mgmt, size_t len,12591259+ struct ieee802_11_elems *elems)12591260{12601261 struct ieee80211_mgmt *mgmt_fwd;12611262 struct sk_buff *skb;12621263 struct ieee80211_local *local = sdata->local;12631263- u8 *pos = mgmt->u.action.u.chan_switch.variable;12641264- size_t offset_ttl;1265126412661265 skb = dev_alloc_skb(local->tx_headroom + len);12671266 if (!skb)···12681269 skb_reserve(skb, local->tx_headroom);12691270 mgmt_fwd = skb_put(skb, len);1270127112711271- /* offset_ttl is based on whether the secondary channel12721272- * offset is available or not. Subtract 1 from the mesh TTL12731273- * and disable the initiator flag before forwarding.12741274- */12751275- offset_ttl = (len < 42) ? 7 : 10;12761276- *(pos + offset_ttl) -= 1;12771277- *(pos + offset_ttl + 1) &= ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR;12721272+ elems->mesh_chansw_params_ie->mesh_ttl--;12731273+ elems->mesh_chansw_params_ie->mesh_flags &=12741274+ ~WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR;1278127512791276 memcpy(mgmt_fwd, mgmt, len);12801277 eth_broadcast_addr(mgmt_fwd->da);···1318132313191324 /* forward or re-broadcast the CSA frame */13201325 if (fwd_csa) {13211321- if (mesh_fwd_csa_frame(sdata, mgmt, len) < 0)13261326+ if (mesh_fwd_csa_frame(sdata, mgmt, len, &elems) < 0)13221327 mcsa_dbg(sdata, "Failed to forward the CSA frame");13231328 }13241329}
+3-4
net/mac80211/spectmgmt.c
···88 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>99 * Copyright 2007-2008, Intel Corporation1010 * Copyright 2008, Johannes Berg <johannes@sipsolutions.net>1111+ * Copyright (C) 2018 Intel Corporation1112 *1213 * This program is free software; you can redistribute it and/or modify1314 * it under the terms of the GNU General Public License version 2 as···2827 u32 sta_flags, u8 *bssid,2928 struct ieee80211_csa_ie *csa_ie)3029{3131- enum nl80211_band new_band;3030+ enum nl80211_band new_band = current_band;3231 int new_freq;3332 u8 new_chan_no;3433 struct ieee80211_channel *new_chan;···5655 elems->ext_chansw_ie->new_operating_class,5756 &new_band)) {5857 sdata_info(sdata,5959- "cannot understand ECSA IE operating class %d, disconnecting\n",5858+ "cannot understand ECSA IE operating class, %d, ignoring\n",6059 elems->ext_chansw_ie->new_operating_class);6161- return -EINVAL;6260 }6361 new_chan_no = elems->ext_chansw_ie->new_ch_num;6462 csa_ie->count = elems->ext_chansw_ie->count;6563 csa_ie->mode = elems->ext_chansw_ie->mode;6664 } else if (elems->ch_switch_ie) {6767- new_band = current_band;6865 new_chan_no = elems->ch_switch_ie->new_ch_num;6966 csa_ie->count = elems->ch_switch_ie->count;7067 csa_ie->mode = elems->ch_switch_ie->mode;
+2-1
net/mac80211/sta_info.c
···314314315315 if (ieee80211_hw_check(hw, USES_RSS)) {316316 sta->pcpu_rx_stats =317317- alloc_percpu(struct ieee80211_sta_rx_stats);317317+ alloc_percpu_gfp(struct ieee80211_sta_rx_stats, gfp);318318 if (!sta->pcpu_rx_stats)319319 goto free;320320 }···433433 if (sta->sta.txq[0])434434 kfree(to_txq_info(sta->sta.txq[0]));435435free:436436+ free_percpu(sta->pcpu_rx_stats);436437#ifdef CONFIG_MAC80211_MESH437438 kfree(sta->mesh);438439#endif
+5-2
net/netfilter/nf_nat_proto_common.c
···4141 const struct nf_conn *ct,4242 u16 *rover)4343{4444- unsigned int range_size, min, i;4444+ unsigned int range_size, min, max, i;4545 __be16 *portptr;4646 u_int16_t off;4747···7171 }7272 } else {7373 min = ntohs(range->min_proto.all);7474- range_size = ntohs(range->max_proto.all) - min + 1;7474+ max = ntohs(range->max_proto.all);7575+ if (unlikely(max < min))7676+ swap(max, min);7777+ range_size = max - min + 1;7578 }76797780 if (range->flags & NF_NAT_RANGE_PROTO_RANDOM) {
+34-40
net/netfilter/x_tables.c
···434434 * ebt_among is exempt from centralized matchsize checking435435 * because it uses a dynamic-size data set.436436 */437437- pr_err("%s_tables: %s.%u match: invalid size "438438- "%u (kernel) != (user) %u\n",439439- xt_prefix[par->family], par->match->name,440440- par->match->revision,441441- XT_ALIGN(par->match->matchsize), size);437437+ pr_err_ratelimited("%s_tables: %s.%u match: invalid size %u (kernel) != (user) %u\n",438438+ xt_prefix[par->family], par->match->name,439439+ par->match->revision,440440+ XT_ALIGN(par->match->matchsize), size);442441 return -EINVAL;443442 }444443 if (par->match->table != NULL &&445444 strcmp(par->match->table, par->table) != 0) {446446- pr_err("%s_tables: %s match: only valid in %s table, not %s\n",447447- xt_prefix[par->family], par->match->name,448448- par->match->table, par->table);445445+ pr_info_ratelimited("%s_tables: %s match: only valid in %s table, not %s\n",446446+ xt_prefix[par->family], par->match->name,447447+ par->match->table, par->table);449448 return -EINVAL;450449 }451450 if (par->match->hooks && (par->hook_mask & ~par->match->hooks) != 0) {452451 char used[64], allow[64];453452454454- pr_err("%s_tables: %s match: used from hooks %s, but only "455455- "valid from %s\n",456456- xt_prefix[par->family], par->match->name,457457- textify_hooks(used, sizeof(used), par->hook_mask,458458- par->family),459459- textify_hooks(allow, sizeof(allow), par->match->hooks,460460- par->family));453453+ pr_info_ratelimited("%s_tables: %s match: used from hooks %s, but only valid from %s\n",454454+ xt_prefix[par->family], par->match->name,455455+ textify_hooks(used, sizeof(used),456456+ par->hook_mask, par->family),457457+ textify_hooks(allow, sizeof(allow),458458+ par->match->hooks,459459+ par->family));461460 return -EINVAL;462461 }463462 if (par->match->proto && (par->match->proto != proto || inv_proto)) {464464- pr_err("%s_tables: %s match: only valid for protocol %u\n",465465- xt_prefix[par->family], par->match->name,466466- par->match->proto);463463+ pr_info_ratelimited("%s_tables: %s match: only valid for protocol %u\n",464464+ xt_prefix[par->family], par->match->name,465465+ par->match->proto);467466 return -EINVAL;468467 }469468 if (par->match->checkentry != NULL) {···813814 int ret;814815815816 if (XT_ALIGN(par->target->targetsize) != size) {816816- pr_err("%s_tables: %s.%u target: invalid size "817817- "%u (kernel) != (user) %u\n",818818- xt_prefix[par->family], par->target->name,819819- par->target->revision,820820- XT_ALIGN(par->target->targetsize), size);817817+ pr_err_ratelimited("%s_tables: %s.%u target: invalid size %u (kernel) != (user) %u\n",818818+ xt_prefix[par->family], par->target->name,819819+ par->target->revision,820820+ XT_ALIGN(par->target->targetsize), size);821821 return -EINVAL;822822 }823823 if (par->target->table != NULL &&824824 strcmp(par->target->table, par->table) != 0) {825825- pr_err("%s_tables: %s target: only valid in %s table, not %s\n",826826- xt_prefix[par->family], par->target->name,827827- par->target->table, par->table);825825+ pr_info_ratelimited("%s_tables: %s target: only valid in %s table, not %s\n",826826+ xt_prefix[par->family], par->target->name,827827+ par->target->table, par->table);828828 return -EINVAL;829829 }830830 if (par->target->hooks && (par->hook_mask & ~par->target->hooks) != 0) {831831 char used[64], allow[64];832832833833- pr_err("%s_tables: %s target: used from hooks %s, but only "834834- "usable from %s\n",835835- xt_prefix[par->family], par->target->name,836836- textify_hooks(used, sizeof(used), par->hook_mask,837837- par->family),838838- textify_hooks(allow, sizeof(allow), par->target->hooks,839839- par->family));833833+ pr_info_ratelimited("%s_tables: %s target: used from hooks %s, but only usable from %s\n",834834+ xt_prefix[par->family], par->target->name,835835+ textify_hooks(used, sizeof(used),836836+ par->hook_mask, par->family),837837+ textify_hooks(allow, sizeof(allow),838838+ par->target->hooks,839839+ par->family));840840 return -EINVAL;841841 }842842 if (par->target->proto && (par->target->proto != proto || inv_proto)) {843843- pr_err("%s_tables: %s target: only valid for protocol %u\n",844844- xt_prefix[par->family], par->target->name,845845- par->target->proto);843843+ pr_info_ratelimited("%s_tables: %s target: only valid for protocol %u\n",844844+ xt_prefix[par->family], par->target->name,845845+ par->target->proto);846846 return -EINVAL;847847 }848848 if (par->target->checkentry != NULL) {···10001002 size_t sz = sizeof(*info) + size;1001100310021004 if (sz < sizeof(*info))10031003- return NULL;10041004-10051005- /* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */10061006- if ((size >> PAGE_SHIFT) + 2 > totalram_pages)10071005 return NULL;1008100610091007 /* __GFP_NORETRY is not fully supported by kvmalloc but it should
+2-2
net/netfilter/xt_AUDIT.c
···120120 const struct xt_audit_info *info = par->targinfo;121121122122 if (info->type > XT_AUDIT_TYPE_MAX) {123123- pr_info("Audit type out of range (valid range: 0..%hhu)\n",124124- XT_AUDIT_TYPE_MAX);123123+ pr_info_ratelimited("Audit type out of range (valid range: 0..%hhu)\n",124124+ XT_AUDIT_TYPE_MAX);125125 return -ERANGE;126126 }127127
···91919292 if (strcmp(par->table, "mangle") != 0 &&9393 strcmp(par->table, "security") != 0) {9494- pr_info("target only valid in the \'mangle\' "9595- "or \'security\' tables, not \'%s\'.\n", par->table);9494+ pr_info_ratelimited("only valid in \'mangle\' or \'security\' table, not \'%s\'\n",9595+ par->table);9696 return -EINVAL;9797 }9898···102102 break;103103104104 default:105105- pr_info("invalid mode: %hu\n", info->mode);105105+ pr_info_ratelimited("invalid mode: %hu\n", info->mode);106106 return -EINVAL;107107 }108108109109 ret = nf_ct_netns_get(par->net, par->family);110110 if (ret < 0)111111- pr_info("cannot load conntrack support for proto=%u\n",112112- par->family);111111+ pr_info_ratelimited("cannot load conntrack support for proto=%u\n",112112+ par->family);113113 return ret;114114}115115
+13-12
net/netfilter/xt_CT.c
···82828383 proto = xt_ct_find_proto(par);8484 if (!proto) {8585- pr_info("You must specify a L4 protocol, and not use "8686- "inversions on it.\n");8585+ pr_info_ratelimited("You must specify a L4 protocol and not use inversions on it\n");8786 return -ENOENT;8887 }89889089 helper = nf_conntrack_helper_try_module_get(helper_name, par->family,9190 proto);9291 if (helper == NULL) {9393- pr_info("No such helper \"%s\"\n", helper_name);9292+ pr_info_ratelimited("No such helper \"%s\"\n", helper_name);9493 return -ENOENT;9594 }9695···123124 const struct nf_conntrack_l4proto *l4proto;124125 struct ctnl_timeout *timeout;125126 struct nf_conn_timeout *timeout_ext;127127+ const char *errmsg = NULL;126128 int ret = 0;127129 u8 proto;128130···131131 timeout_find_get = rcu_dereference(nf_ct_timeout_find_get_hook);132132 if (timeout_find_get == NULL) {133133 ret = -ENOENT;134134- pr_info("Timeout policy base is empty\n");134134+ errmsg = "Timeout policy base is empty";135135 goto out;136136 }137137138138 proto = xt_ct_find_proto(par);139139 if (!proto) {140140 ret = -EINVAL;141141- pr_info("You must specify a L4 protocol, and not use "142142- "inversions on it.\n");141141+ errmsg = "You must specify a L4 protocol and not use inversions on it";143142 goto out;144143 }145144146145 timeout = timeout_find_get(par->net, timeout_name);147146 if (timeout == NULL) {148147 ret = -ENOENT;149149- pr_info("No such timeout policy \"%s\"\n", timeout_name);148148+ pr_info_ratelimited("No such timeout policy \"%s\"\n",149149+ timeout_name);150150 goto out;151151 }152152153153 if (timeout->l3num != par->family) {154154 ret = -EINVAL;155155- pr_info("Timeout policy `%s' can only be used by L3 protocol "156156- "number %d\n", timeout_name, timeout->l3num);155155+ pr_info_ratelimited("Timeout policy `%s' can only be used by L%d protocol number %d\n",156156+ timeout_name, 3, timeout->l3num);157157 goto err_put_timeout;158158 }159159 /* Make sure the timeout policy matches any existing protocol tracker,···162162 l4proto = __nf_ct_l4proto_find(par->family, proto);163163 if (timeout->l4proto->l4proto != l4proto->l4proto) {164164 ret = -EINVAL;165165- pr_info("Timeout policy `%s' can only be used by L4 protocol "166166- "number %d\n",167167- timeout_name, timeout->l4proto->l4proto);165165+ pr_info_ratelimited("Timeout policy `%s' can only be used by L%d protocol number %d\n",166166+ timeout_name, 4, timeout->l4proto->l4proto);168167 goto err_put_timeout;169168 }170169 timeout_ext = nf_ct_timeout_ext_add(ct, timeout, GFP_ATOMIC);···179180 __xt_ct_tg_timeout_put(timeout);180181out:181182 rcu_read_unlock();183183+ if (errmsg)184184+ pr_info_ratelimited("%s\n", errmsg);182185 return ret;183186#else184187 return -EOPNOTSUPP;
+1-3
net/netfilter/xt_DSCP.c
···6666{6767 const struct xt_DSCP_info *info = par->targinfo;68686969- if (info->dscp > XT_DSCP_MAX) {7070- pr_info("dscp %x out of range\n", info->dscp);6969+ if (info->dscp > XT_DSCP_MAX)7170 return -EDOM;7272- }7371 return 0;7472}7573
+3-10
net/netfilter/xt_HL.c
···105105{106106 const struct ipt_TTL_info *info = par->targinfo;107107108108- if (info->mode > IPT_TTL_MAXMODE) {109109- pr_info("TTL: invalid or unknown mode %u\n", info->mode);108108+ if (info->mode > IPT_TTL_MAXMODE)110109 return -EINVAL;111111- }112110 if (info->mode != IPT_TTL_SET && info->ttl == 0)113111 return -EINVAL;114112 return 0;···116118{117119 const struct ip6t_HL_info *info = par->targinfo;118120119119- if (info->mode > IP6T_HL_MAXMODE) {120120- pr_info("invalid or unknown mode %u\n", info->mode);121121+ if (info->mode > IP6T_HL_MAXMODE)121122 return -EINVAL;122122- }123123- if (info->mode != IP6T_HL_SET && info->hop_limit == 0) {124124- pr_info("increment/decrement does not "125125- "make sense with value 0\n");123123+ if (info->mode != IP6T_HL_SET && info->hop_limit == 0)126124 return -EINVAL;127127- }128125 return 0;129126}130127
+15-12
net/netfilter/xt_HMARK.c
···99 * the Free Software Foundation.1010 */11111212+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt1313+1214#include <linux/module.h>1315#include <linux/skbuff.h>1416#include <linux/icmp.h>···314312static int hmark_tg_check(const struct xt_tgchk_param *par)315313{316314 const struct xt_hmark_info *info = par->targinfo;315315+ const char *errmsg = "proto mask must be zero with L3 mode";317316318318- if (!info->hmodulus) {319319- pr_info("xt_HMARK: hash modulus can't be zero\n");317317+ if (!info->hmodulus)320318 return -EINVAL;321321- }319319+322320 if (info->proto_mask &&323323- (info->flags & XT_HMARK_FLAG(XT_HMARK_METHOD_L3))) {324324- pr_info("xt_HMARK: proto mask must be zero with L3 mode\n");325325- return -EINVAL;326326- }321321+ (info->flags & XT_HMARK_FLAG(XT_HMARK_METHOD_L3)))322322+ goto err;323323+327324 if (info->flags & XT_HMARK_FLAG(XT_HMARK_SPI_MASK) &&328325 (info->flags & (XT_HMARK_FLAG(XT_HMARK_SPORT_MASK) |329329- XT_HMARK_FLAG(XT_HMARK_DPORT_MASK)))) {330330- pr_info("xt_HMARK: spi-mask and port-mask can't be combined\n");326326+ XT_HMARK_FLAG(XT_HMARK_DPORT_MASK))))331327 return -EINVAL;332332- }328328+333329 if (info->flags & XT_HMARK_FLAG(XT_HMARK_SPI) &&334330 (info->flags & (XT_HMARK_FLAG(XT_HMARK_SPORT) |335331 XT_HMARK_FLAG(XT_HMARK_DPORT)))) {336336- pr_info("xt_HMARK: spi-set and port-set can't be combined\n");337337- return -EINVAL;332332+ errmsg = "spi-set and port-set can't be combined";333333+ goto err;338334 }339335 return 0;336336+err:337337+ pr_info_ratelimited("%s\n", errmsg);338338+ return -EINVAL;340339}341340342341static struct xt_target hmark_tg_reg[] __read_mostly = {
+6-3
net/netfilter/xt_IDLETIMER.c
···146146 timer_setup(&info->timer->timer, idletimer_tg_expired, 0);147147 info->timer->refcnt = 1;148148149149+ INIT_WORK(&info->timer->work, idletimer_tg_work);150150+149151 mod_timer(&info->timer->timer,150152 msecs_to_jiffies(info->timeout * 1000) + jiffies);151151-152152- INIT_WORK(&info->timer->work, idletimer_tg_work);153153154154 return 0;155155···191191 pr_debug("timeout value is zero\n");192192 return -EINVAL;193193 }194194-194194+ if (info->timeout >= INT_MAX / 1000) {195195+ pr_debug("timeout value is too big\n");196196+ return -EINVAL;197197+ }195198 if (info->label[0] == '\0' ||196199 strnlen(info->label,197200 MAX_IDLETIMER_LABEL_SIZE) == MAX_IDLETIMER_LABEL_SIZE) {
+7-9
net/netfilter/xt_LED.c
···111111 struct xt_led_info_internal *ledinternal;112112 int err;113113114114- if (ledinfo->id[0] == '\0') {115115- pr_info("No 'id' parameter given.\n");114114+ if (ledinfo->id[0] == '\0')116115 return -EINVAL;117117- }118116119117 mutex_lock(&xt_led_mutex);120118···136138137139 err = led_trigger_register(&ledinternal->netfilter_led_trigger);138140 if (err) {139139- pr_err("Trigger name is already in use.\n");141141+ pr_info_ratelimited("Trigger name is already in use.\n");140142 goto exit_alloc;141143 }142144143143- /* See if we need to set up a timer */144144- if (ledinfo->delay > 0)145145- timer_setup(&ledinternal->timer, led_timeout_callback, 0);145145+ /* Since the letinternal timer can be shared between multiple targets,146146+ * always set it up, even if the current target does not need it147147+ */148148+ timer_setup(&ledinternal->timer, led_timeout_callback, 0);146149147150 list_add_tail(&ledinternal->list, &xt_led_triggers);148151···180181181182 list_del(&ledinternal->list);182183183183- if (ledinfo->delay > 0)184184- del_timer_sync(&ledinternal->timer);184184+ del_timer_sync(&ledinternal->timer);185185186186 led_trigger_unregister(&ledinternal->netfilter_led_trigger);187187
+5-3
net/netfilter/xt_NFQUEUE.c
···88 *99 */10101111+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt1212+1113#include <linux/module.h>1214#include <linux/skbuff.h>1315···6967 init_hashrandom(&jhash_initval);70687169 if (info->queues_total == 0) {7272- pr_err("NFQUEUE: number of total queues is 0\n");7070+ pr_info_ratelimited("number of total queues is 0\n");7371 return -EINVAL;7472 }7573 maxid = info->queues_total - 1 + info->queuenum;7674 if (maxid > 0xffff) {7777- pr_err("NFQUEUE: number of queues (%u) out of range (got %u)\n",7878- info->queues_total, maxid);7575+ pr_info_ratelimited("number of queues (%u) out of range (got %u)\n",7676+ info->queues_total, maxid);7977 return -ERANGE;8078 }8179 if (par->target->revision == 2 && info->flags > 1)
+10-8
net/netfilter/xt_SECMARK.c
···6060 &info->secid);6161 if (err) {6262 if (err == -EINVAL)6363- pr_info("invalid security context \'%s\'\n", info->secctx);6363+ pr_info_ratelimited("invalid security context \'%s\'\n",6464+ info->secctx);6465 return err;6566 }66676768 if (!info->secid) {6868- pr_info("unable to map security context \'%s\'\n", info->secctx);6969+ pr_info_ratelimited("unable to map security context \'%s\'\n",7070+ info->secctx);6971 return -ENOENT;7072 }71737274 err = security_secmark_relabel_packet(info->secid);7375 if (err) {7474- pr_info("unable to obtain relabeling permission\n");7676+ pr_info_ratelimited("unable to obtain relabeling permission\n");7577 return err;7678 }7779···88868987 if (strcmp(par->table, "mangle") != 0 &&9088 strcmp(par->table, "security") != 0) {9191- pr_info("target only valid in the \'mangle\' "9292- "or \'security\' tables, not \'%s\'.\n", par->table);8989+ pr_info_ratelimited("only valid in \'mangle\' or \'security\' table, not \'%s\'\n",9090+ par->table);9391 return -EINVAL;9492 }95939694 if (mode && mode != info->mode) {9797- pr_info("mode already set to %hu cannot mix with "9898- "rules for mode %hu\n", mode, info->mode);9595+ pr_info_ratelimited("mode already set to %hu cannot mix with rules for mode %hu\n",9696+ mode, info->mode);9997 return -EINVAL;10098 }10199···103101 case SECMARK_MODE_SEL:104102 break;105103 default:106106- pr_info("invalid mode: %hu\n", info->mode);104104+ pr_info_ratelimited("invalid mode: %hu\n", info->mode);107105 return -EINVAL;108106 }109107
+4-6
net/netfilter/xt_TCPMSS.c
···273273 (par->hook_mask & ~((1 << NF_INET_FORWARD) |274274 (1 << NF_INET_LOCAL_OUT) |275275 (1 << NF_INET_POST_ROUTING))) != 0) {276276- pr_info("path-MTU clamping only supported in "277277- "FORWARD, OUTPUT and POSTROUTING hooks\n");276276+ pr_info_ratelimited("path-MTU clamping only supported in FORWARD, OUTPUT and POSTROUTING hooks\n");278277 return -EINVAL;279278 }280279 if (par->nft_compat)···282283 xt_ematch_foreach(ematch, e)283284 if (find_syn_match(ematch))284285 return 0;285285- pr_info("Only works on TCP SYN packets\n");286286+ pr_info_ratelimited("Only works on TCP SYN packets\n");286287 return -EINVAL;287288}288289···297298 (par->hook_mask & ~((1 << NF_INET_FORWARD) |298299 (1 << NF_INET_LOCAL_OUT) |299300 (1 << NF_INET_POST_ROUTING))) != 0) {300300- pr_info("path-MTU clamping only supported in "301301- "FORWARD, OUTPUT and POSTROUTING hooks\n");301301+ pr_info_ratelimited("path-MTU clamping only supported in FORWARD, OUTPUT and POSTROUTING hooks\n");302302 return -EINVAL;303303 }304304 if (par->nft_compat)···306308 xt_ematch_foreach(ematch, e)307309 if (find_syn_match(ematch))308310 return 0;309309- pr_info("Only works on TCP SYN packets\n");311311+ pr_info_ratelimited("Only works on TCP SYN packets\n");310312 return -EINVAL;311313}312314#endif
+2-4
net/netfilter/xt_TPROXY.c
···540540 !(i->invflags & IP6T_INV_PROTO))541541 return 0;542542543543- pr_info("Can be used only in combination with "544544- "either -p tcp or -p udp\n");543543+ pr_info_ratelimited("Can be used only with -p tcp or -p udp\n");545544 return -EINVAL;546545}547546#endif···558559 && !(i->invflags & IPT_INV_PROTO))559560 return 0;560561561561- pr_info("Can be used only in combination with "562562- "either -p tcp or -p udp\n");562562+ pr_info_ratelimited("Can be used only with -p tcp or -p udp\n");563563 return -EINVAL;564564}565565
+16-17
net/netfilter/xt_addrtype.c
···164164165165static int addrtype_mt_checkentry_v1(const struct xt_mtchk_param *par)166166{167167+ const char *errmsg = "both incoming and outgoing interface limitation cannot be selected";167168 struct xt_addrtype_info_v1 *info = par->matchinfo;168169169170 if (info->flags & XT_ADDRTYPE_LIMIT_IFACE_IN &&170170- info->flags & XT_ADDRTYPE_LIMIT_IFACE_OUT) {171171- pr_info("both incoming and outgoing "172172- "interface limitation cannot be selected\n");173173- return -EINVAL;174174- }171171+ info->flags & XT_ADDRTYPE_LIMIT_IFACE_OUT)172172+ goto err;175173176174 if (par->hook_mask & ((1 << NF_INET_PRE_ROUTING) |177175 (1 << NF_INET_LOCAL_IN)) &&178176 info->flags & XT_ADDRTYPE_LIMIT_IFACE_OUT) {179179- pr_info("output interface limitation "180180- "not valid in PREROUTING and INPUT\n");181181- return -EINVAL;177177+ errmsg = "output interface limitation not valid in PREROUTING and INPUT";178178+ goto err;182179 }183180184181 if (par->hook_mask & ((1 << NF_INET_POST_ROUTING) |185182 (1 << NF_INET_LOCAL_OUT)) &&186183 info->flags & XT_ADDRTYPE_LIMIT_IFACE_IN) {187187- pr_info("input interface limitation "188188- "not valid in POSTROUTING and OUTPUT\n");189189- return -EINVAL;184184+ errmsg = "input interface limitation not valid in POSTROUTING and OUTPUT";185185+ goto err;190186 }191187192188#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)193189 if (par->family == NFPROTO_IPV6) {194190 if ((info->source | info->dest) & XT_ADDRTYPE_BLACKHOLE) {195195- pr_err("ipv6 BLACKHOLE matching not supported\n");196196- return -EINVAL;191191+ errmsg = "ipv6 BLACKHOLE matching not supported";192192+ goto err;197193 }198194 if ((info->source | info->dest) >= XT_ADDRTYPE_PROHIBIT) {199199- pr_err("ipv6 PROHIBIT (THROW, NAT ..) matching not supported\n");200200- return -EINVAL;195195+ errmsg = "ipv6 PROHIBIT (THROW, NAT ..) matching not supported";196196+ goto err;201197 }202198 if ((info->source | info->dest) & XT_ADDRTYPE_BROADCAST) {203203- pr_err("ipv6 does not support BROADCAST matching\n");204204- return -EINVAL;199199+ errmsg = "ipv6 does not support BROADCAST matching";200200+ goto err;205201 }206202 }207203#endif208204 return 0;205205+err:206206+ pr_info_ratelimited("%s\n", errmsg);207207+ return -EINVAL;209208}210209211210static struct xt_match addrtype_mt_reg[] __read_mostly = {
+3-1
net/netfilter/xt_bpf.c
···77 * published by the Free Software Foundation.88 */991010+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt1111+1012#include <linux/module.h>1113#include <linux/syscalls.h>1214#include <linux/skbuff.h>···3634 program.filter = insns;37353836 if (bpf_prog_create(ret, &program)) {3939- pr_info("bpf: check failed: parse error\n");3737+ pr_info_ratelimited("check failed: parse error\n");4038 return -EINVAL;4139 }4240
+5-3
net/netfilter/xt_cgroup.c
···1212 * published by the Free Software Foundation.1313 */14141515+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt1616+1517#include <linux/skbuff.h>1618#include <linux/module.h>1719#include <linux/netfilter/x_tables.h>···5048 }51495250 if (info->has_path && info->has_classid) {5353- pr_info("xt_cgroup: both path and classid specified\n");5151+ pr_info_ratelimited("path and classid specified\n");5452 return -EINVAL;5553 }5654···5856 if (info->has_path) {5957 cgrp = cgroup_get_from_path(info->path);6058 if (IS_ERR(cgrp)) {6161- pr_info("xt_cgroup: invalid path, errno=%ld\n",6262- PTR_ERR(cgrp));5959+ pr_info_ratelimited("invalid path, errno=%ld\n",6060+ PTR_ERR(cgrp));6361 return -EINVAL;6462 }6563 info->priv = cgrp;
+3-5
net/netfilter/xt_cluster.c
···135135 struct xt_cluster_match_info *info = par->matchinfo;136136137137 if (info->total_nodes > XT_CLUSTER_NODES_MAX) {138138- pr_info("you have exceeded the maximum "139139- "number of cluster nodes (%u > %u)\n",140140- info->total_nodes, XT_CLUSTER_NODES_MAX);138138+ pr_info_ratelimited("you have exceeded the maximum number of cluster nodes (%u > %u)\n",139139+ info->total_nodes, XT_CLUSTER_NODES_MAX);141140 return -EINVAL;142141 }143142 if (info->node_mask >= (1ULL << info->total_nodes)) {144144- pr_info("this node mask cannot be "145145- "higher than the total number of nodes\n");143143+ pr_info_ratelimited("node mask cannot exceed total number of nodes\n");146144 return -EDOM;147145 }148146 return 0;
+2-2
net/netfilter/xt_connbytes.c
···112112113113 ret = nf_ct_netns_get(par->net, par->family);114114 if (ret < 0)115115- pr_info("cannot load conntrack support for proto=%u\n",116116- par->family);115115+ pr_info_ratelimited("cannot load conntrack support for proto=%u\n",116116+ par->family);117117118118 /*119119 * This filter cannot function correctly unless connection tracking
+4-3
net/netfilter/xt_connlabel.c
···5757 int ret;58585959 if (info->options & ~options) {6060- pr_err("Unknown options in mask %x\n", info->options);6060+ pr_info_ratelimited("Unknown options in mask %x\n",6161+ info->options);6162 return -EINVAL;6263 }63646465 ret = nf_ct_netns_get(par->net, par->family);6566 if (ret < 0) {6666- pr_info("cannot load conntrack support for proto=%u\n",6767- par->family);6767+ pr_info_ratelimited("cannot load conntrack support for proto=%u\n",6868+ par->family);6869 return ret;6970 }7071
+4-4
net/netfilter/xt_connmark.c
···79798080 ret = nf_ct_netns_get(par->net, par->family);8181 if (ret < 0)8282- pr_info("cannot load conntrack support for proto=%u\n",8383- par->family);8282+ pr_info_ratelimited("cannot load conntrack support for proto=%u\n",8383+ par->family);8484 return ret;8585}8686···109109110110 ret = nf_ct_netns_get(par->net, par->family);111111 if (ret < 0)112112- pr_info("cannot load conntrack support for proto=%u\n",113113- par->family);112112+ pr_info_ratelimited("cannot load conntrack support for proto=%u\n",113113+ par->family);114114 return ret;115115}116116
+2-2
net/netfilter/xt_conntrack.c
···272272273273 ret = nf_ct_netns_get(par->net, par->family);274274 if (ret < 0)275275- pr_info("cannot load conntrack support for proto=%u\n",276276- par->family);275275+ pr_info_ratelimited("cannot load conntrack support for proto=%u\n",276276+ par->family);277277 return ret;278278}279279
+1-3
net/netfilter/xt_dscp.c
···4646{4747 const struct xt_dscp_info *info = par->matchinfo;48484949- if (info->dscp > XT_DSCP_MAX) {5050- pr_info("dscp %x out of range\n", info->dscp);4949+ if (info->dscp > XT_DSCP_MAX)5150 return -EDOM;5252- }53515452 return 0;5553}
+2-2
net/netfilter/xt_ecn.c
···97979898 if (info->operation & (XT_ECN_OP_MATCH_ECE | XT_ECN_OP_MATCH_CWR) &&9999 (ip->proto != IPPROTO_TCP || ip->invflags & IPT_INV_PROTO)) {100100- pr_info("cannot match TCP bits in rule for non-tcp packets\n");100100+ pr_info_ratelimited("cannot match TCP bits for non-tcp packets\n");101101 return -EINVAL;102102 }103103···139139140140 if (info->operation & (XT_ECN_OP_MATCH_ECE | XT_ECN_OP_MATCH_CWR) &&141141 (ip->proto != IPPROTO_TCP || ip->invflags & IP6T_INV_PROTO)) {142142- pr_info("cannot match TCP bits in rule for non-tcp packets\n");142142+ pr_info_ratelimited("cannot match TCP bits for non-tcp packets\n");143143 return -EINVAL;144144 }145145
···88 * published by the Free Software Foundation.99 */10101111+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt1212+1113#include <linux/module.h>1214#include <linux/skbuff.h>1315#include <linux/netfilter.h>···2119 const struct nf_nat_ipv4_multi_range_compat *mr = par->targinfo;22202321 if (mr->rangesize != 1) {2424- pr_info("%s: multiple ranges no longer supported\n",2525- par->target->name);2222+ pr_info_ratelimited("multiple ranges no longer supported\n");2623 return -EINVAL;2724 }2825 return nf_ct_netns_get(par->net, par->family);
+4-2
net/netfilter/xt_nfacct.c
···66 * it under the terms of the GNU General Public License version 2 (or any77 * later at your option) as published by the Free Software Foundation.88 */99+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt1010+911#include <linux/module.h>1012#include <linux/skbuff.h>1113···41394240 nfacct = nfnl_acct_find_get(par->net, info->name);4341 if (nfacct == NULL) {4444- pr_info("xt_nfacct: accounting object with name `%s' "4545- "does not exists\n", info->name);4242+ pr_info_ratelimited("accounting object `%s' does not exists\n",4343+ info->name);4644 return -ENOENT;4745 }4846 info->nfacct = nfacct;
+1-3
net/netfilter/xt_physdev.c
···107107 info->invert & XT_PHYSDEV_OP_BRIDGED) &&108108 par->hook_mask & ((1 << NF_INET_LOCAL_OUT) |109109 (1 << NF_INET_FORWARD) | (1 << NF_INET_POST_ROUTING))) {110110- pr_info("using --physdev-out and --physdev-is-out are only "111111- "supported in the FORWARD and POSTROUTING chains with "112112- "bridged traffic.\n");110110+ pr_info_ratelimited("--physdev-out and --physdev-is-out only supported in the FORWARD and POSTROUTING chains with bridged traffic\n");113111 if (par->hook_mask & (1 << NF_INET_LOCAL_OUT))114112 return -EINVAL;115113 }
+13-10
net/netfilter/xt_policy.c
···132132static int policy_mt_check(const struct xt_mtchk_param *par)133133{134134 const struct xt_policy_info *info = par->matchinfo;135135+ const char *errmsg = "neither incoming nor outgoing policy selected";135136136136- if (!(info->flags & (XT_POLICY_MATCH_IN|XT_POLICY_MATCH_OUT))) {137137- pr_info("neither incoming nor outgoing policy selected\n");138138- return -EINVAL;139139- }137137+ if (!(info->flags & (XT_POLICY_MATCH_IN|XT_POLICY_MATCH_OUT)))138138+ goto err;139139+140140 if (par->hook_mask & ((1 << NF_INET_PRE_ROUTING) |141141 (1 << NF_INET_LOCAL_IN)) && info->flags & XT_POLICY_MATCH_OUT) {142142- pr_info("output policy not valid in PREROUTING and INPUT\n");143143- return -EINVAL;142142+ errmsg = "output policy not valid in PREROUTING and INPUT";143143+ goto err;144144 }145145 if (par->hook_mask & ((1 << NF_INET_POST_ROUTING) |146146 (1 << NF_INET_LOCAL_OUT)) && info->flags & XT_POLICY_MATCH_IN) {147147- pr_info("input policy not valid in POSTROUTING and OUTPUT\n");148148- return -EINVAL;147147+ errmsg = "input policy not valid in POSTROUTING and OUTPUT";148148+ goto err;149149 }150150 if (info->len > XT_POLICY_MAX_ELEM) {151151- pr_info("too many policy elements\n");152152- return -EINVAL;151151+ errmsg = "too many policy elements";152152+ goto err;153153 }154154 return 0;155155+err:156156+ pr_info_ratelimited("%s\n", errmsg);157157+ return -EINVAL;155158}156159157160static struct xt_match policy_mt_reg[] __read_mostly = {
+6-8
net/netfilter/xt_recent.c
···342342 net_get_random_once(&hash_rnd, sizeof(hash_rnd));343343344344 if (info->check_set & ~XT_RECENT_VALID_FLAGS) {345345- pr_info("Unsupported user space flags (%08x)\n",346346- info->check_set);345345+ pr_info_ratelimited("Unsupported userspace flags (%08x)\n",346346+ info->check_set);347347 return -EINVAL;348348 }349349 if (hweight8(info->check_set &···357357 if ((info->check_set & XT_RECENT_REAP) && !info->seconds)358358 return -EINVAL;359359 if (info->hit_count >= XT_RECENT_MAX_NSTAMPS) {360360- pr_info("hitcount (%u) is larger than allowed maximum (%u)\n",361361- info->hit_count, XT_RECENT_MAX_NSTAMPS - 1);360360+ pr_info_ratelimited("hitcount (%u) is larger than allowed maximum (%u)\n",361361+ info->hit_count, XT_RECENT_MAX_NSTAMPS - 1);362362 return -EINVAL;363363 }364364 if (info->name[0] == '\0' ||···587587 add = true;588588 break;589589 default:590590- pr_info("Need \"+ip\", \"-ip\" or \"/\"\n");590590+ pr_info_ratelimited("Need \"+ip\", \"-ip\" or \"/\"\n");591591 return -EINVAL;592592 }593593···601601 succ = in4_pton(c, size, (void *)&addr, '\n', NULL);602602 }603603604604- if (!succ) {605605- pr_info("illegal address written to procfs\n");604604+ if (!succ)606605 return -EINVAL;607607- }608606609607 spin_lock_bh(&recent_lock);610608 e = recent_entry_lookup(t, &addr, family, 0);
+25-25
net/netfilter/xt_set.c
···9292 index = ip_set_nfnl_get_byindex(par->net, info->match_set.index);93939494 if (index == IPSET_INVALID_ID) {9595- pr_warn("Cannot find set identified by id %u to match\n",9696- info->match_set.index);9595+ pr_info_ratelimited("Cannot find set identified by id %u to match\n",9696+ info->match_set.index);9797 return -ENOENT;9898 }9999 if (info->match_set.u.flags[IPSET_DIM_MAX - 1] != 0) {100100- pr_warn("Protocol error: set match dimension is over the limit!\n");100100+ pr_info_ratelimited("set match dimension is over the limit!\n");101101 ip_set_nfnl_put(par->net, info->match_set.index);102102 return -ERANGE;103103 }···143143 index = ip_set_nfnl_get_byindex(par->net, info->match_set.index);144144145145 if (index == IPSET_INVALID_ID) {146146- pr_warn("Cannot find set identified by id %u to match\n",147147- info->match_set.index);146146+ pr_info_ratelimited("Cannot find set identified by id %u to match\n",147147+ info->match_set.index);148148 return -ENOENT;149149 }150150 if (info->match_set.dim > IPSET_DIM_MAX) {151151- pr_warn("Protocol error: set match dimension is over the limit!\n");151151+ pr_info_ratelimited("set match dimension is over the limit!\n");152152 ip_set_nfnl_put(par->net, info->match_set.index);153153 return -ERANGE;154154 }···241241 if (info->add_set.index != IPSET_INVALID_ID) {242242 index = ip_set_nfnl_get_byindex(par->net, info->add_set.index);243243 if (index == IPSET_INVALID_ID) {244244- pr_warn("Cannot find add_set index %u as target\n",245245- info->add_set.index);244244+ pr_info_ratelimited("Cannot find add_set index %u as target\n",245245+ info->add_set.index);246246 return -ENOENT;247247 }248248 }···250250 if (info->del_set.index != IPSET_INVALID_ID) {251251 index = ip_set_nfnl_get_byindex(par->net, info->del_set.index);252252 if (index == IPSET_INVALID_ID) {253253- pr_warn("Cannot find del_set index %u as target\n",254254- info->del_set.index);253253+ pr_info_ratelimited("Cannot find del_set index %u as target\n",254254+ info->del_set.index);255255 if (info->add_set.index != IPSET_INVALID_ID)256256 ip_set_nfnl_put(par->net, info->add_set.index);257257 return -ENOENT;···259259 }260260 if (info->add_set.u.flags[IPSET_DIM_MAX - 1] != 0 ||261261 info->del_set.u.flags[IPSET_DIM_MAX - 1] != 0) {262262- pr_warn("Protocol error: SET target dimension is over the limit!\n");262262+ pr_info_ratelimited("SET target dimension over the limit!\n");263263 if (info->add_set.index != IPSET_INVALID_ID)264264 ip_set_nfnl_put(par->net, info->add_set.index);265265 if (info->del_set.index != IPSET_INVALID_ID)···316316 if (info->add_set.index != IPSET_INVALID_ID) {317317 index = ip_set_nfnl_get_byindex(par->net, info->add_set.index);318318 if (index == IPSET_INVALID_ID) {319319- pr_warn("Cannot find add_set index %u as target\n",320320- info->add_set.index);319319+ pr_info_ratelimited("Cannot find add_set index %u as target\n",320320+ info->add_set.index);321321 return -ENOENT;322322 }323323 }···325325 if (info->del_set.index != IPSET_INVALID_ID) {326326 index = ip_set_nfnl_get_byindex(par->net, info->del_set.index);327327 if (index == IPSET_INVALID_ID) {328328- pr_warn("Cannot find del_set index %u as target\n",329329- info->del_set.index);328328+ pr_info_ratelimited("Cannot find del_set index %u as target\n",329329+ info->del_set.index);330330 if (info->add_set.index != IPSET_INVALID_ID)331331 ip_set_nfnl_put(par->net, info->add_set.index);332332 return -ENOENT;···334334 }335335 if (info->add_set.dim > IPSET_DIM_MAX ||336336 info->del_set.dim > IPSET_DIM_MAX) {337337- pr_warn("Protocol error: SET target dimension is over the limit!\n");337337+ pr_info_ratelimited("SET target dimension over the limit!\n");338338 if (info->add_set.index != IPSET_INVALID_ID)339339 ip_set_nfnl_put(par->net, info->add_set.index);340340 if (info->del_set.index != IPSET_INVALID_ID)···444444 index = ip_set_nfnl_get_byindex(par->net,445445 info->add_set.index);446446 if (index == IPSET_INVALID_ID) {447447- pr_warn("Cannot find add_set index %u as target\n",448448- info->add_set.index);447447+ pr_info_ratelimited("Cannot find add_set index %u as target\n",448448+ info->add_set.index);449449 return -ENOENT;450450 }451451 }···454454 index = ip_set_nfnl_get_byindex(par->net,455455 info->del_set.index);456456 if (index == IPSET_INVALID_ID) {457457- pr_warn("Cannot find del_set index %u as target\n",458458- info->del_set.index);457457+ pr_info_ratelimited("Cannot find del_set index %u as target\n",458458+ info->del_set.index);459459 if (info->add_set.index != IPSET_INVALID_ID)460460 ip_set_nfnl_put(par->net,461461 info->add_set.index);···465465466466 if (info->map_set.index != IPSET_INVALID_ID) {467467 if (strncmp(par->table, "mangle", 7)) {468468- pr_warn("--map-set only usable from mangle table\n");468468+ pr_info_ratelimited("--map-set only usable from mangle table\n");469469 return -EINVAL;470470 }471471 if (((info->flags & IPSET_FLAG_MAP_SKBPRIO) |···473473 !(par->hook_mask & (1 << NF_INET_FORWARD |474474 1 << NF_INET_LOCAL_OUT |475475 1 << NF_INET_POST_ROUTING))) {476476- pr_warn("mapping of prio or/and queue is allowed only from OUTPUT/FORWARD/POSTROUTING chains\n");476476+ pr_info_ratelimited("mapping of prio or/and queue is allowed only from OUTPUT/FORWARD/POSTROUTING chains\n");477477 return -EINVAL;478478 }479479 index = ip_set_nfnl_get_byindex(par->net,480480 info->map_set.index);481481 if (index == IPSET_INVALID_ID) {482482- pr_warn("Cannot find map_set index %u as target\n",483483- info->map_set.index);482482+ pr_info_ratelimited("Cannot find map_set index %u as target\n",483483+ info->map_set.index);484484 if (info->add_set.index != IPSET_INVALID_ID)485485 ip_set_nfnl_put(par->net,486486 info->add_set.index);···494494 if (info->add_set.dim > IPSET_DIM_MAX ||495495 info->del_set.dim > IPSET_DIM_MAX ||496496 info->map_set.dim > IPSET_DIM_MAX) {497497- pr_warn("Protocol error: SET target dimension is over the limit!\n");497497+ pr_info_ratelimited("SET target dimension over the limit!\n");498498 if (info->add_set.index != IPSET_INVALID_ID)499499 ip_set_nfnl_put(par->net, info->add_set.index);500500 if (info->del_set.index != IPSET_INVALID_ID)
···44444545 ret = nf_ct_netns_get(par->net, par->family);4646 if (ret < 0)4747- pr_info("cannot load conntrack support for proto=%u\n",4848- par->family);4747+ pr_info_ratelimited("cannot load conntrack support for proto=%u\n",4848+ par->family);4949 return ret;5050}5151
+3-3
net/netfilter/xt_time.c
···235235236236 if (info->daytime_start > XT_TIME_MAX_DAYTIME ||237237 info->daytime_stop > XT_TIME_MAX_DAYTIME) {238238- pr_info("invalid argument - start or "239239- "stop time greater than 23:59:59\n");238238+ pr_info_ratelimited("invalid argument - start or stop time greater than 23:59:59\n");240239 return -EDOM;241240 }242241243242 if (info->flags & ~XT_TIME_ALL_FLAGS) {244244- pr_info("unknown flags 0x%x\n", info->flags & ~XT_TIME_ALL_FLAGS);243243+ pr_info_ratelimited("unknown flags 0x%x\n",244244+ info->flags & ~XT_TIME_ALL_FLAGS);245245 return -EINVAL;246246 }247247
···170170 enum nl80211_bss_scan_width scan_width;171171 struct ieee80211_supported_band *sband =172172 rdev->wiphy.bands[setup->chandef.chan->band];173173- scan_width = cfg80211_chandef_to_scan_width(&setup->chandef);174174- setup->basic_rates = ieee80211_mandatory_rates(sband,175175- scan_width);173173+174174+ if (setup->chandef.chan->band == NL80211_BAND_2GHZ) {175175+ int i;176176+177177+ /*178178+ * Older versions selected the mandatory rates for179179+ * 2.4 GHz as well, but were broken in that only180180+ * 1 Mbps was regarded as a mandatory rate. Keep181181+ * using just 1 Mbps as the default basic rate for182182+ * mesh to be interoperable with older versions.183183+ */184184+ for (i = 0; i < sband->n_bitrates; i++) {185185+ if (sband->bitrates[i].bitrate == 10) {186186+ setup->basic_rates = BIT(i);187187+ break;188188+ }189189+ }190190+ } else {191191+ scan_width = cfg80211_chandef_to_scan_width(&setup->chandef);192192+ setup->basic_rates = ieee80211_mandatory_rates(sband,193193+ scan_width);194194+ }176195 }177196178197 err = cfg80211_chandef_dfs_required(&rdev->wiphy,
···146146 $(eval $(1) = $(2)))147147endef148148149149-# Allow setting CC and AR and LD, or setting CROSS_COMPILE as a prefix.150150-$(call allow-override,CC,$(CROSS_COMPILE)gcc)151151-$(call allow-override,AR,$(CROSS_COMPILE)ar)152152-$(call allow-override,LD,$(CROSS_COMPILE)ld)153153-$(call allow-override,CXX,$(CROSS_COMPILE)g++)154154-155149LD += $(EXTRA_LDFLAGS)156150157151HOSTCC ?= gcc
-3
tools/power/acpi/Makefile.config
···5656# to compile vs uClibc, that can be done here as well.5757CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-5858CROSS_COMPILE ?= $(CROSS)5959-CC = $(CROSS_COMPILE)gcc6060-LD = $(CROSS_COMPILE)gcc6161-STRIP = $(CROSS_COMPILE)strip6259HOSTCC = gcc63606461# check if compiler option is supported
+18
tools/scripts/Makefile.include
···42424343CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?)44444545+# Makefiles suck: This macro sets a default value of $(2) for the4646+# variable named by $(1), unless the variable has been set by4747+# environment or command line. This is necessary for CC and AR4848+# because make sets default values, so the simpler ?= approach4949+# won't work as expected.5050+define allow-override5151+ $(if $(or $(findstring environment,$(origin $(1))),\5252+ $(findstring command line,$(origin $(1)))),,\5353+ $(eval $(1) = $(2)))5454+endef5555+5656+# Allow setting various cross-compile vars or setting CROSS_COMPILE as a prefix.5757+$(call allow-override,CC,$(CROSS_COMPILE)gcc)5858+$(call allow-override,AR,$(CROSS_COMPILE)ar)5959+$(call allow-override,LD,$(CROSS_COMPILE)ld)6060+$(call allow-override,CXX,$(CROSS_COMPILE)g++)6161+$(call allow-override,STRIP,$(CROSS_COMPILE)strip)6262+4563ifeq ($(CC_NO_CLANG), 1)4664EXTRA_WARNINGS += -Wstrict-aliasing=34765endif