···365365 if (err)366366 goto err_free_dev;367367368368- result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_KBD_DOCK);369369- if (result >= 0) {370370- input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE);371371- input_report_switch(asus->inputdev, SW_TABLET_MODE, !result);372372- } else if (result != -ENODEV) {373373- pr_err("Error checking for keyboard-dock: %d\n", result);368368+ if (asus->driver->quirks->use_kbd_dock_devid) {369369+ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_KBD_DOCK);370370+ if (result >= 0) {371371+ input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE);372372+ input_report_switch(asus->inputdev, SW_TABLET_MODE, !result);373373+ } else if (result != -ENODEV) {374374+ pr_err("Error checking for keyboard-dock: %d\n", result);375375+ }374376 }375377376378 err = input_register_device(asus->inputdev);···21172115 return;21182116 }2119211721202120- if (code == NOTIFY_KBD_DOCK_CHANGE) {21182118+ if (asus->driver->quirks->use_kbd_dock_devid && code == NOTIFY_KBD_DOCK_CHANGE) {21212119 result = asus_wmi_get_devstate_simple(asus,21222120 ASUS_WMI_DEVID_KBD_DOCK);21232121 if (result >= 0) {
+1
drivers/platform/x86/asus-wmi.h
···3333 bool wmi_backlight_native;3434 bool wmi_backlight_set_devstate;3535 bool wmi_force_als_set;3636+ bool use_kbd_dock_devid;3637 int wapf;3738 /*3839 * For machines with AMD graphic chips, it will send out WMI event
+3-4
drivers/vdpa/Kconfig
···3030 be called ifcvf.31313232config MLX5_VDPA3333- bool "MLX5 VDPA support library for ConnectX devices"3434- depends on MLX5_CORE3535- default n3333+ bool3634 help3735 Support library for Mellanox VDPA drivers. Provides code that is3836 common for all types of VDPA drivers. The following drivers are planned:···38403941config MLX5_VDPA_NET4042 tristate "vDPA driver for ConnectX devices"4141- depends on MLX5_VDPA4343+ select MLX5_VDPA4444+ depends on MLX5_CORE4245 default n4346 help4447 VDPA network driver for ConnectX6 and newer. Provides offloading
+14-6
drivers/vdpa/mlx5/net/mlx5_vnet.c
···11331133 if (!mvq->initialized)11341134 return;1135113511361136- if (query_virtqueue(ndev, mvq, &attr)) {11371137- mlx5_vdpa_warn(&ndev->mvdev, "failed to query virtqueue\n");11381138- return;11391139- }11401136 if (mvq->fw_state != MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY)11411137 return;1142113811431139 if (modify_virtqueue(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND))11441140 mlx5_vdpa_warn(&ndev->mvdev, "modify to suspend failed\n");11411141+11421142+ if (query_virtqueue(ndev, mvq, &attr)) {11431143+ mlx5_vdpa_warn(&ndev->mvdev, "failed to query virtqueue\n");11441144+ return;11451145+ }11461146+ mvq->avail_idx = attr.available_index;11451147}1146114811471149static void suspend_vqs(struct mlx5_vdpa_net *ndev)···14131411 struct mlx5_virtq_attr attr;14141412 int err;1415141314161416- if (!mvq->initialized)14171417- return -EAGAIN;14141414+ /* If the virtq object was destroyed, use the value saved at14151415+ * the last minute of suspend_vq. This caters for userspace14161416+ * that cares about emulating the index after vq is stopped.14171417+ */14181418+ if (!mvq->initialized) {14191419+ state->avail_index = mvq->avail_idx;14201420+ return 0;14211421+ }1418142214191423 err = query_virtqueue(ndev, mvq, &attr);14201424 if (err) {
+77-50
drivers/vhost/vdpa.c
···565565 perm_to_iommu_flags(perm));566566 }567567568568+ if (r)569569+ vhost_iotlb_del_range(dev->iotlb, iova, iova + size - 1);570570+568571 return r;569572}570573···595592 struct vhost_dev *dev = &v->vdev;596593 struct vhost_iotlb *iotlb = dev->iotlb;597594 struct page **page_list;598598- unsigned long list_size = PAGE_SIZE / sizeof(struct page *);595595+ struct vm_area_struct **vmas;599596 unsigned int gup_flags = FOLL_LONGTERM;600600- unsigned long npages, cur_base, map_pfn, last_pfn = 0;601601- unsigned long locked, lock_limit, pinned, i;597597+ unsigned long map_pfn, last_pfn = 0;598598+ unsigned long npages, lock_limit;599599+ unsigned long i, nmap = 0;602600 u64 iova = msg->iova;601601+ long pinned;603602 int ret = 0;604603605604 if (vhost_iotlb_itree_first(iotlb, msg->iova,606605 msg->iova + msg->size - 1))607606 return -EEXIST;608608-609609- page_list = (struct page **) __get_free_page(GFP_KERNEL);610610- if (!page_list)611611- return -ENOMEM;612607613608 if (msg->perm & VHOST_ACCESS_WO)614609 gup_flags |= FOLL_WRITE;···615614 if (!npages)616615 return -EINVAL;617616617617+ page_list = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);618618+ vmas = kvmalloc_array(npages, sizeof(struct vm_area_struct *),619619+ GFP_KERNEL);620620+ if (!page_list || !vmas) {621621+ ret = -ENOMEM;622622+ goto free;623623+ }624624+618625 mmap_read_lock(dev->mm);619626620620- locked = atomic64_add_return(npages, &dev->mm->pinned_vm);621627 lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;622622-623623- if (locked > lock_limit) {628628+ if (npages + atomic64_read(&dev->mm->pinned_vm) > lock_limit) {624629 ret = -ENOMEM;625625- goto out;630630+ goto unlock;626631 }627632628628- cur_base = msg->uaddr & PAGE_MASK;629629- iova &= PAGE_MASK;630630-631631- while (npages) {632632- pinned = min_t(unsigned long, npages, list_size);633633- ret = pin_user_pages(cur_base, pinned,634634- gup_flags, page_list, NULL);635635- if (ret != pinned)636636- goto out;637637-638638- if (!last_pfn)639639- map_pfn = page_to_pfn(page_list[0]);640640-641641- for (i = 0; i < ret; i++) {642642- unsigned long this_pfn = page_to_pfn(page_list[i]);643643- u64 csize;644644-645645- if (last_pfn && (this_pfn != last_pfn + 1)) {646646- /* Pin a contiguous chunk of memory */647647- csize = (last_pfn - map_pfn + 1) << PAGE_SHIFT;648648- if (vhost_vdpa_map(v, iova, csize,649649- map_pfn << PAGE_SHIFT,650650- msg->perm))651651- goto out;652652- map_pfn = this_pfn;653653- iova += csize;654654- }655655-656656- last_pfn = this_pfn;633633+ pinned = pin_user_pages(msg->uaddr & PAGE_MASK, npages, gup_flags,634634+ page_list, vmas);635635+ if (npages != pinned) {636636+ if (pinned < 0) {637637+ ret = pinned;638638+ } else {639639+ unpin_user_pages(page_list, pinned);640640+ ret = -ENOMEM;657641 }658658-659659- cur_base += ret << PAGE_SHIFT;660660- npages -= ret;642642+ goto unlock;661643 }662644663663- /* Pin the rest chunk */664664- ret = vhost_vdpa_map(v, iova, (last_pfn - map_pfn + 1) << PAGE_SHIFT,665665- map_pfn << PAGE_SHIFT, msg->perm);645645+ iova &= PAGE_MASK;646646+ map_pfn = page_to_pfn(page_list[0]);647647+648648+ /* One more iteration to avoid extra vdpa_map() call out of loop. */649649+ for (i = 0; i <= npages; i++) {650650+ unsigned long this_pfn;651651+ u64 csize;652652+653653+ /* The last chunk may have no valid PFN next to it */654654+ this_pfn = i < npages ? page_to_pfn(page_list[i]) : -1UL;655655+656656+ if (last_pfn && (this_pfn == -1UL ||657657+ this_pfn != last_pfn + 1)) {658658+ /* Pin a contiguous chunk of memory */659659+ csize = last_pfn - map_pfn + 1;660660+ ret = vhost_vdpa_map(v, iova, csize << PAGE_SHIFT,661661+ map_pfn << PAGE_SHIFT,662662+ msg->perm);663663+ if (ret) {664664+ /*665665+ * Unpin the rest chunks of memory on the666666+ * flight with no corresponding vdpa_map()667667+ * calls having been made yet. On the other668668+ * hand, vdpa_unmap() in the failure path669669+ * is in charge of accounting the number of670670+ * pinned pages for its own.671671+ * This asymmetrical pattern of accounting672672+ * is for efficiency to pin all pages at673673+ * once, while there is no other callsite674674+ * of vdpa_map() than here above.675675+ */676676+ unpin_user_pages(&page_list[nmap],677677+ npages - nmap);678678+ goto out;679679+ }680680+ atomic64_add(csize, &dev->mm->pinned_vm);681681+ nmap += csize;682682+ iova += csize << PAGE_SHIFT;683683+ map_pfn = this_pfn;684684+ }685685+ last_pfn = this_pfn;686686+ }687687+688688+ WARN_ON(nmap != npages);666689out:667667- if (ret) {690690+ if (ret)668691 vhost_vdpa_unmap(v, msg->iova, msg->size);669669- atomic64_sub(npages, &dev->mm->pinned_vm);670670- }692692+unlock:671693 mmap_read_unlock(dev->mm);672672- free_page((unsigned long)page_list);694694+free:695695+ kvfree(vmas);696696+ kvfree(page_list);673697 return ret;674698}675699···836810837811err_init_iotlb:838812 vhost_dev_cleanup(&v->vdev);813813+ kfree(vqs);839814err:840815 atomic_dec(&v->opened);841816 return r;
+23-10
drivers/vhost/vhost.c
···12901290 vring_used_t __user *used)1291129112921292{12931293+ /* If an IOTLB device is present, the vring addresses are12941294+ * GIOVAs. Access validation occurs at prefetch time. */12951295+ if (vq->iotlb)12961296+ return true;12971297+12931298 return access_ok(desc, vhost_get_desc_size(vq, num)) &&12941299 access_ok(avail, vhost_get_avail_size(vq, num)) &&12951300 access_ok(used, vhost_get_used_size(vq, num));···13701365}13711366EXPORT_SYMBOL_GPL(vhost_log_access_ok);1372136713681368+static bool vq_log_used_access_ok(struct vhost_virtqueue *vq,13691369+ void __user *log_base,13701370+ bool log_used,13711371+ u64 log_addr)13721372+{13731373+ /* If an IOTLB device is present, log_addr is a GIOVA that13741374+ * will never be logged by log_used(). */13751375+ if (vq->iotlb)13761376+ return true;13771377+13781378+ return !log_used || log_access_ok(log_base, log_addr,13791379+ vhost_get_used_size(vq, vq->num));13801380+}13811381+13731382/* Verify access for write logging. */13741383/* Caller should have vq mutex and device mutex */13751384static bool vq_log_access_ok(struct vhost_virtqueue *vq,···13911372{13921373 return vq_memory_access_ok(log_base, vq->umem,13931374 vhost_has_feature(vq, VHOST_F_LOG_ALL)) &&13941394- (!vq->log_used || log_access_ok(log_base, vq->log_addr,13951395- vhost_get_used_size(vq, vq->num)));13751375+ vq_log_used_access_ok(vq, log_base, vq->log_used, vq->log_addr);13961376}1397137713981378/* Can we start vq? */···14001382{14011383 if (!vq_log_access_ok(vq, vq->log_base))14021384 return false;14031403-14041404- /* Access validation occurs at prefetch time with IOTLB */14051405- if (vq->iotlb)14061406- return true;1407138514081386 return vq_access_ok(vq, vq->num, vq->desc, vq->avail, vq->used);14091387}···15301516 return -EINVAL;1531151715321518 /* Also validate log access for used ring if enabled. */15331533- if ((a.flags & (0x1 << VHOST_VRING_F_LOG)) &&15341534- !log_access_ok(vq->log_base, a.log_guest_addr,15351535- sizeof *vq->used +15361536- vq->num * sizeof *vq->used->ring))15191519+ if (!vq_log_used_access_ok(vq, vq->log_base,15201520+ a.flags & (0x1 << VHOST_VRING_F_LOG),15211521+ a.log_guest_addr))15371522 return -EINVAL;15381523 }15391524
···272272 help273273 Support the Permedia2 FIFO disconnect feature.274274275275+config FB_ARMCLCD276276+ tristate "ARM PrimeCell PL110 support"277277+ depends on ARM || ARM64 || COMPILE_TEST278278+ depends on FB && ARM_AMBA && HAS_IOMEM279279+ select FB_CFB_FILLRECT280280+ select FB_CFB_COPYAREA281281+ select FB_CFB_IMAGEBLIT282282+ select FB_MODE_HELPERS if OF283283+ select VIDEOMODE_HELPERS if OF284284+ select BACKLIGHT_CLASS_DEVICE if OF285285+ help286286+ This framebuffer device driver is for the ARM PrimeCell PL110287287+ Colour LCD controller. ARM PrimeCells provide the building288288+ blocks for System on a Chip devices.289289+290290+ If you want to compile this as a module (=code which can be291291+ inserted into and removed from the running kernel), say M292292+ here and read <file:Documentation/kbuild/modules.rst>. The module293293+ will be called amba-clcd.294294+275295config FB_ACORN276296 bool "Acorn VIDC support"277297 depends on (FB = y) && ARM && ARCH_ACORN
···738738int afs_writepages(struct address_space *mapping,739739 struct writeback_control *wbc)740740{741741+ struct afs_vnode *vnode = AFS_FS_I(mapping->host);741742 pgoff_t start, end, next;742743 int ret;743744744745 _enter("");746746+747747+ /* We have to be careful as we can end up racing with setattr()748748+ * truncating the pagecache since the caller doesn't take a lock here749749+ * to prevent it.750750+ */751751+ if (wbc->sync_mode == WB_SYNC_ALL)752752+ down_read(&vnode->validate_lock);753753+ else if (!down_read_trylock(&vnode->validate_lock))754754+ return 0;745755746756 if (wbc->range_cyclic) {747757 start = mapping->writeback_index;···772762 ret = afs_writepages_region(mapping, wbc, start, end, &next);773763 }774764765765+ up_read(&vnode->validate_lock);775766 _leave(" = %d", ret);776767 return ret;777768}
···526526 return 1;527527}528528529529+/* We know we have a pipe buffer, but maybe it's empty? */530530+static inline bool eat_empty_buffer(struct pipe_inode_info *pipe)531531+{532532+ unsigned int tail = pipe->tail;533533+ unsigned int mask = pipe->ring_size - 1;534534+ struct pipe_buffer *buf = &pipe->bufs[tail & mask];535535+536536+ if (unlikely(!buf->len)) {537537+ pipe_buf_release(pipe, buf);538538+ pipe->tail = tail+1;539539+ return true;540540+ }541541+542542+ return false;543543+}544544+529545/**530546 * splice_from_pipe_next - wait for some data to splice from531547 * @pipe: pipe to splice from···561545 if (signal_pending(current))562546 return -ERESTARTSYS;563547548548+repeat:564549 while (pipe_empty(pipe->head, pipe->tail)) {565550 if (!pipe->writers)566551 return 0;···582565583566 pipe_wait_readable(pipe);584567 }568568+569569+ if (eat_empty_buffer(pipe))570570+ goto repeat;585571586572 return 1;587573}
+1-1
include/drm/drm_dsc.h
···588588 * This structure represents the DSC PPS infoframe required to send the Picture589589 * Parameter Set metadata required before enabling VESA Display Stream590590 * Compression. This is based on the DP Secondary Data Packet structure and591591- * comprises of SDP Header as defined &struct struct dp_sdp_header in drm_dp_helper.h591591+ * comprises of SDP Header as defined &struct dp_sdp_header in drm_dp_helper.h592592 * and PPS payload defined in &struct drm_dsc_picture_parameter_set.593593 *594594 * @pps_header: Header for PPS as per DP SDP header format of type
···11+/*22+ * linux/include/asm-arm/hardware/amba_clcd.h -- Integrator LCD panel.33+ *44+ * David A Rusling55+ *66+ * Copyright (C) 2001 ARM Limited77+ *88+ * This file is subject to the terms and conditions of the GNU General Public99+ * License. See the file COPYING in the main directory of this archive1010+ * for more details.1111+ */1212+#include <linux/fb.h>1313+#include <linux/amba/clcd-regs.h>1414+1515+enum {1616+ /* individual formats */1717+ CLCD_CAP_RGB444 = (1 << 0),1818+ CLCD_CAP_RGB5551 = (1 << 1),1919+ CLCD_CAP_RGB565 = (1 << 2),2020+ CLCD_CAP_RGB888 = (1 << 3),2121+ CLCD_CAP_BGR444 = (1 << 4),2222+ CLCD_CAP_BGR5551 = (1 << 5),2323+ CLCD_CAP_BGR565 = (1 << 6),2424+ CLCD_CAP_BGR888 = (1 << 7),2525+2626+ /* connection layouts */2727+ CLCD_CAP_444 = CLCD_CAP_RGB444 | CLCD_CAP_BGR444,2828+ CLCD_CAP_5551 = CLCD_CAP_RGB5551 | CLCD_CAP_BGR5551,2929+ CLCD_CAP_565 = CLCD_CAP_RGB565 | CLCD_CAP_BGR565,3030+ CLCD_CAP_888 = CLCD_CAP_RGB888 | CLCD_CAP_BGR888,3131+3232+ /* red/blue ordering */3333+ CLCD_CAP_RGB = CLCD_CAP_RGB444 | CLCD_CAP_RGB5551 |3434+ CLCD_CAP_RGB565 | CLCD_CAP_RGB888,3535+ CLCD_CAP_BGR = CLCD_CAP_BGR444 | CLCD_CAP_BGR5551 |3636+ CLCD_CAP_BGR565 | CLCD_CAP_BGR888,3737+3838+ CLCD_CAP_ALL = CLCD_CAP_BGR | CLCD_CAP_RGB,3939+};4040+4141+struct backlight_device;4242+4343+struct clcd_panel {4444+ struct fb_videomode mode;4545+ signed short width; /* width in mm */4646+ signed short height; /* height in mm */4747+ u32 tim2;4848+ u32 tim3;4949+ u32 cntl;5050+ u32 caps;5151+ unsigned int bpp:8,5252+ fixedtimings:1,5353+ grayscale:1;5454+ unsigned int connector;5555+ struct backlight_device *backlight;5656+ /*5757+ * If the B/R lines are switched between the CLCD5858+ * and the panel we need to know this and not try to5959+ * compensate with the BGR bit in the control register.6060+ */6161+ bool bgr_connection;6262+};6363+6464+struct clcd_regs {6565+ u32 tim0;6666+ u32 tim1;6767+ u32 tim2;6868+ u32 tim3;6969+ u32 cntl;7070+ unsigned long pixclock;7171+};7272+7373+struct clcd_fb;7474+7575+/*7676+ * the board-type specific routines7777+ */7878+struct clcd_board {7979+ const char *name;8080+8181+ /*8282+ * Optional. Hardware capability flags.8383+ */8484+ u32 caps;8585+8686+ /*8787+ * Optional. Check whether the var structure is acceptable8888+ * for this display.8989+ */9090+ int (*check)(struct clcd_fb *fb, struct fb_var_screeninfo *var);9191+9292+ /*9393+ * Compulsory. Decode fb->fb.var into regs->*. In the case of9494+ * fixed timing, set regs->* to the register values required.9595+ */9696+ void (*decode)(struct clcd_fb *fb, struct clcd_regs *regs);9797+9898+ /*9999+ * Optional. Disable any extra display hardware.100100+ */101101+ void (*disable)(struct clcd_fb *);102102+103103+ /*104104+ * Optional. Enable any extra display hardware.105105+ */106106+ void (*enable)(struct clcd_fb *);107107+108108+ /*109109+ * Setup platform specific parts of CLCD driver110110+ */111111+ int (*setup)(struct clcd_fb *);112112+113113+ /*114114+ * mmap the framebuffer memory115115+ */116116+ int (*mmap)(struct clcd_fb *, struct vm_area_struct *);117117+118118+ /*119119+ * Remove platform specific parts of CLCD driver120120+ */121121+ void (*remove)(struct clcd_fb *);122122+};123123+124124+struct amba_device;125125+struct clk;126126+127127+/* this data structure describes each frame buffer device we find */128128+struct clcd_fb {129129+ struct fb_info fb;130130+ struct amba_device *dev;131131+ struct clk *clk;132132+ struct clcd_panel *panel;133133+ struct clcd_board *board;134134+ void *board_data;135135+ void __iomem *regs;136136+ u16 off_ienb;137137+ u16 off_cntl;138138+ u32 clcd_cntl;139139+ u32 cmap[16];140140+ bool clk_enabled;141141+};142142+143143+static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)144144+{145145+ struct fb_var_screeninfo *var = &fb->fb.var;146146+ u32 val, cpl;147147+148148+ /*149149+ * Program the CLCD controller registers and start the CLCD150150+ */151151+ val = ((var->xres / 16) - 1) << 2;152152+ val |= (var->hsync_len - 1) << 8;153153+ val |= (var->right_margin - 1) << 16;154154+ val |= (var->left_margin - 1) << 24;155155+ regs->tim0 = val;156156+157157+ val = var->yres;158158+ if (fb->panel->cntl & CNTL_LCDDUAL)159159+ val /= 2;160160+ val -= 1;161161+ val |= (var->vsync_len - 1) << 10;162162+ val |= var->lower_margin << 16;163163+ val |= var->upper_margin << 24;164164+ regs->tim1 = val;165165+166166+ val = fb->panel->tim2;167167+ val |= var->sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS;168168+ val |= var->sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS;169169+170170+ cpl = var->xres_virtual;171171+ if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */172172+ /* / 1 */;173173+ else if (!var->grayscale) /* STN color */174174+ cpl = cpl * 8 / 3;175175+ else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */176176+ cpl /= 8;177177+ else /* STN monochrome, 4bit */178178+ cpl /= 4;179179+180180+ regs->tim2 = val | ((cpl - 1) << 16);181181+182182+ regs->tim3 = fb->panel->tim3;183183+184184+ val = fb->panel->cntl;185185+ if (var->grayscale)186186+ val |= CNTL_LCDBW;187187+188188+ if (fb->panel->caps && fb->board->caps && var->bits_per_pixel >= 16) {189189+ /*190190+ * if board and panel supply capabilities, we can support191191+ * changing BGR/RGB depending on supplied parameters. Here192192+ * we switch to what the framebuffer is providing if need193193+ * be, so if the framebuffer is BGR but the display connection194194+ * is RGB (first case) we switch it around. Vice versa mutatis195195+ * mutandis if the framebuffer is RGB but the display connection196196+ * is BGR, we flip it around.197197+ */198198+ if (var->red.offset == 0)199199+ val &= ~CNTL_BGR;200200+ else201201+ val |= CNTL_BGR;202202+ if (fb->panel->bgr_connection)203203+ val ^= CNTL_BGR;204204+ }205205+206206+ switch (var->bits_per_pixel) {207207+ case 1:208208+ val |= CNTL_LCDBPP1;209209+ break;210210+ case 2:211211+ val |= CNTL_LCDBPP2;212212+ break;213213+ case 4:214214+ val |= CNTL_LCDBPP4;215215+ break;216216+ case 8:217217+ val |= CNTL_LCDBPP8;218218+ break;219219+ case 16:220220+ /*221221+ * PL110 cannot choose between 5551 and 565 modes in its222222+ * control register. It is possible to use 565 with223223+ * custom external wiring.224224+ */225225+ if (amba_part(fb->dev) == 0x110 ||226226+ var->green.length == 5)227227+ val |= CNTL_LCDBPP16;228228+ else if (var->green.length == 6)229229+ val |= CNTL_LCDBPP16_565;230230+ else231231+ val |= CNTL_LCDBPP16_444;232232+ break;233233+ case 32:234234+ val |= CNTL_LCDBPP24;235235+ break;236236+ }237237+238238+ regs->cntl = val;239239+ regs->pixclock = var->pixclock;240240+}241241+242242+static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)243243+{244244+ var->xres_virtual = var->xres = (var->xres + 15) & ~15;245245+ var->yres_virtual = var->yres = (var->yres + 1) & ~1;246246+247247+#define CHECK(e,l,h) (var->e < l || var->e > h)248248+ if (CHECK(right_margin, (5+1), 256) || /* back porch */249249+ CHECK(left_margin, (5+1), 256) || /* front porch */250250+ CHECK(hsync_len, (5+1), 256) ||251251+ var->xres > 4096 ||252252+ var->lower_margin > 255 || /* back porch */253253+ var->upper_margin > 255 || /* front porch */254254+ var->vsync_len > 32 ||255255+ var->yres > 1024)256256+ return -EINVAL;257257+#undef CHECK258258+259259+ /* single panel mode: PCD = max(PCD, 1) */260260+ /* dual panel mode: PCD = max(PCD, 5) */261261+262262+ /*263263+ * You can't change the grayscale setting, and264264+ * we can only do non-interlaced video.265265+ */266266+ if (var->grayscale != fb->fb.var.grayscale ||267267+ (var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED)268268+ return -EINVAL;269269+270270+#define CHECK(e) (var->e != fb->fb.var.e)271271+ if (fb->panel->fixedtimings &&272272+ (CHECK(xres) ||273273+ CHECK(yres) ||274274+ CHECK(bits_per_pixel) ||275275+ CHECK(pixclock) ||276276+ CHECK(left_margin) ||277277+ CHECK(right_margin) ||278278+ CHECK(upper_margin) ||279279+ CHECK(lower_margin) ||280280+ CHECK(hsync_len) ||281281+ CHECK(vsync_len) ||282282+ CHECK(sync)))283283+ return -EINVAL;284284+#undef CHECK285285+286286+ var->nonstd = 0;287287+ var->accel_flags = 0;288288+289289+ return 0;290290+}
+13
include/linux/font.h
···5959/* Max. length for the name of a predefined font */6060#define MAX_FONT_NAME 3261616262+/* Extra word getters */6363+#define REFCOUNT(fd) (((int *)(fd))[-1])6464+#define FNTSIZE(fd) (((int *)(fd))[-2])6565+#define FNTCHARCNT(fd) (((int *)(fd))[-3])6666+#define FNTSUM(fd) (((int *)(fd))[-4])6767+6868+#define FONT_EXTRA_WORDS 46969+7070+struct font_data {7171+ unsigned int extra[FONT_EXTRA_WORDS];7272+ const unsigned char data[];7373+} __packed;7474+6275#endif /* _VIDEO_FONT_H */
+1-1
include/uapi/linux/rxrpc.h
···5151 RXRPC_BUSY = 6, /* -r: server busy received [terminal] */5252 RXRPC_LOCAL_ERROR = 7, /* -r: local error generated [terminal] */5353 RXRPC_NEW_CALL = 8, /* -r: [Service] new incoming call notification */5454- RXRPC_ACCEPT = 9, /* s-: [Service] accept request */5554 RXRPC_EXCLUSIVE_CALL = 10, /* s-: Call should be on exclusive connection */5655 RXRPC_UPGRADE_SERVICE = 11, /* s-: Request service upgrade for client call */5756 RXRPC_TX_LENGTH = 12, /* s-: Total length of Tx data */5857 RXRPC_SET_CALL_TIMEOUT = 13, /* s-: Set one or more call timeouts */5858+ RXRPC_CHARGE_ACCEPT = 14, /* s-: Charge the accept pool with a user call ID */5959 RXRPC__SUPPORTED6060};6161
+3
include/xen/arm/page.h
···8383 })8484#define gfn_to_virt(m) (__va(gfn_to_pfn(m) << XEN_PAGE_SHIFT))85858686+#define percpu_to_gfn(v) \8787+ (pfn_to_gfn(per_cpu_ptr_to_phys(v) >> XEN_PAGE_SHIFT))8888+8689/* Only used in PV code. But ARM guests are always HVM. */8790static inline xmaddr_t arbitrary_virt_to_machine(void *vaddr)8891{
+4-4
kernel/bpf/verifier.c
···58805880 bool src_known = tnum_subreg_is_const(src_reg->var_off);58815881 bool dst_known = tnum_subreg_is_const(dst_reg->var_off);58825882 struct tnum var32_off = tnum_subreg(dst_reg->var_off);58835883- s32 smin_val = src_reg->smin_value;58845884- u32 umin_val = src_reg->umin_value;58835883+ s32 smin_val = src_reg->s32_min_value;58845884+ u32 umin_val = src_reg->u32_min_value;5885588558865886 /* Assuming scalar64_min_max_or will be called so it is safe58875887 * to skip updating register for known case.···59045904 /* ORing two positives gives a positive, so safe to59055905 * cast result into s64.59065906 */59075907- dst_reg->s32_min_value = dst_reg->umin_value;59085908- dst_reg->s32_max_value = dst_reg->umax_value;59075907+ dst_reg->s32_min_value = dst_reg->u32_min_value;59085908+ dst_reg->s32_max_value = dst_reg->u32_max_value;59095909 }59105910}59115911
+9
kernel/umh.c
···1414#include <linux/cred.h>1515#include <linux/file.h>1616#include <linux/fdtable.h>1717+#include <linux/fs_struct.h>1718#include <linux/workqueue.h>1819#include <linux/security.h>1920#include <linux/mount.h>···7170 spin_lock_irq(¤t->sighand->siglock);7271 flush_signal_handlers(current, 1);7372 spin_unlock_irq(¤t->sighand->siglock);7373+7474+ /*7575+ * Initial kernel threads share ther FS with init, in order to7676+ * get the init root directory. But we've now created a new7777+ * thread that is going to execve a user process and has its own7878+ * 'struct fs_struct'. Reset umask to the default.7979+ */8080+ current->fs->umask = 0022;74817582 /*7683 * Our parent (unbound workqueue) runs with elevated scheduling
···806806 return 1;807807808808 /*809809- * The trick starts.810810- *811809 * What we want to do is to check whether this page may812810 * have been pinned by the parent process. If so,813811 * instead of wrprotect the pte on both sides, we copy···813815 * the pinned page won't be randomly replaced in the814816 * future.815817 *816816- * To achieve this, we do the following:817817- *818818- * 1. Write-protect the pte if it's writable. This is819819- * to protect concurrent write fast-gup with820820- * FOLL_PIN, so that we'll fail the fast-gup with821821- * the write bit removed.822822- *823823- * 2. Check page_maybe_dma_pinned() to see whether this824824- * page may have been pinned.825825- *826826- * The order of these steps is important to serialize827827- * against the fast-gup code (gup_pte_range()) on the828828- * pte check and try_grab_compound_head(), so that829829- * we'll make sure either we'll capture that fast-gup830830- * so we'll copy the pinned page here, or we'll fail831831- * that fast-gup.832832- *833833- * NOTE! Even if we don't end up copying the page,834834- * we won't undo this wrprotect(), because the normal835835- * reference copy will need it anyway.836836- */837837- if (pte_write(pte))838838- ptep_set_wrprotect(src_mm, addr, src_pte);839839-840840- /*841841- * These are the "normally we can just copy by reference"842842- * checks.818818+ * The page pinning checks are just "has this mm ever819819+ * seen pinning", along with the (inexact) check of820820+ * the page count. That might give false positives for821821+ * for pinning, but it will work correctly.843822 */844823 if (likely(!atomic_read(&src_mm->has_pinned)))845824 return 1;846825 if (likely(!page_maybe_dma_pinned(page)))847826 return 1;848848-849849- /*850850- * Uhhuh. It looks like the page might be a pinned page,851851- * and we actually need to copy it. Now we can set the852852- * source pte back to being writable.853853- */854854- if (pte_write(pte))855855- set_pte_at(src_mm, addr, src_pte, pte);856827857828 new_page = *prealloc;858829 if (!new_page)
+11-15
net/bridge/br_netlink.c
···380380 u32 filter_mask, const struct net_device *dev)381381{382382 u8 operstate = netif_running(dev) ? dev->operstate : IF_OPER_DOWN;383383+ struct nlattr *af = NULL;383384 struct net_bridge *br;384385 struct ifinfomsg *hdr;385386 struct nlmsghdr *nlh;···424423 nla_nest_end(skb, nest);425424 }426425426426+ if (filter_mask & (RTEXT_FILTER_BRVLAN |427427+ RTEXT_FILTER_BRVLAN_COMPRESSED |428428+ RTEXT_FILTER_MRP)) {429429+ af = nla_nest_start_noflag(skb, IFLA_AF_SPEC);430430+ if (!af)431431+ goto nla_put_failure;432432+ }433433+427434 /* Check if the VID information is requested */428435 if ((filter_mask & RTEXT_FILTER_BRVLAN) ||429436 (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)) {430437 struct net_bridge_vlan_group *vg;431431- struct nlattr *af;432438 int err;433439434440 /* RCU needed because of the VLAN locking rules (rcu || rtnl) */···449441 rcu_read_unlock();450442 goto done;451443 }452452- af = nla_nest_start_noflag(skb, IFLA_AF_SPEC);453453- if (!af) {454454- rcu_read_unlock();455455- goto nla_put_failure;456456- }457444 if (filter_mask & RTEXT_FILTER_BRVLAN_COMPRESSED)458445 err = br_fill_ifvlaninfo_compressed(skb, vg);459446 else···459456 rcu_read_unlock();460457 if (err)461458 goto nla_put_failure;462462-463463- nla_nest_end(skb, af);464459 }465460466461 if (filter_mask & RTEXT_FILTER_MRP) {467467- struct nlattr *af;468462 int err;469463470464 if (!br_mrp_enabled(br) || port)471465 goto done;472472-473473- af = nla_nest_start_noflag(skb, IFLA_AF_SPEC);474474- if (!af)475475- goto nla_put_failure;476466477467 rcu_read_lock();478468 err = br_mrp_fill_info(skb, br);···473477474478 if (err)475479 goto nla_put_failure;476476-477477- nla_nest_end(skb, af);478480 }479481480482done:483483+ if (af)484484+ nla_nest_end(skb, af);481485 nlmsg_end(skb, nlh);482486 return 0;483487
+6
net/core/filter.c
···10203102031020410204BPF_CALL_1(bpf_skc_to_tcp_timewait_sock, struct sock *, sk)1020510205{1020610206+ /* BTF types for tcp_timewait_sock and inet_timewait_sock are not1020710207+ * generated if CONFIG_INET=n. Trigger an explicit generation here.1020810208+ */1020910209+ BTF_TYPE_EMIT(struct inet_timewait_sock);1021010210+ BTF_TYPE_EMIT(struct tcp_timewait_sock);1021110211+1020610212#ifdef CONFIG_INET1020710213 if (sk && sk->sk_prot == &tcp_prot && sk->sk_state == TCP_TIME_WAIT)1020810214 return (unsigned long)sk;
+3-3
net/ipv4/tcp_ipv4.c
···1798179817991799 __skb_pull(skb, hdrlen);18001800 if (skb_try_coalesce(tail, skb, &fragstolen, &delta)) {18011801- thtail->window = th->window;18021802-18031801 TCP_SKB_CB(tail)->end_seq = TCP_SKB_CB(skb)->end_seq;1804180218051805- if (after(TCP_SKB_CB(skb)->ack_seq, TCP_SKB_CB(tail)->ack_seq))18031803+ if (likely(!before(TCP_SKB_CB(skb)->ack_seq, TCP_SKB_CB(tail)->ack_seq))) {18061804 TCP_SKB_CB(tail)->ack_seq = TCP_SKB_CB(skb)->ack_seq;18051805+ thtail->window = th->window;18061806+ }1807180718081808 /* We have to update both TCP_SKB_CB(tail)->tcp_flags and18091809 * thtail->fin, so that the fast path in tcp_rcv_established()
+5-5
net/mptcp/options.c
···452452static void mptcp_write_data_fin(struct mptcp_subflow_context *subflow,453453 struct sk_buff *skb, struct mptcp_ext *ext)454454{455455- u64 data_fin_tx_seq = READ_ONCE(mptcp_sk(subflow->conn)->write_seq);455455+ /* The write_seq value has already been incremented, so the actual456456+ * sequence number for the DATA_FIN is one less.457457+ */458458+ u64 data_fin_tx_seq = READ_ONCE(mptcp_sk(subflow->conn)->write_seq) - 1;456459457460 if (!ext->use_map || !skb->len) {458461 /* RFC6824 requires a DSS mapping with specific values···464461 ext->data_fin = 1;465462 ext->use_map = 1;466463 ext->dsn64 = 1;467467- /* The write_seq value has already been incremented, so468468- * the actual sequence number for the DATA_FIN is one less.469469- */470470- ext->data_seq = data_fin_tx_seq - 1;464464+ ext->data_seq = data_fin_tx_seq;471465 ext->subflow_seq = 0;472466 ext->data_len = 1;473467 } else if (ext->data_seq + ext->data_len == data_fin_tx_seq) {
+1-1
net/mptcp/subflow.c
···750750 return MAPPING_DATA_FIN;751751 }752752 } else {753753- u64 data_fin_seq = mpext->data_seq + data_len;753753+ u64 data_fin_seq = mpext->data_seq + data_len - 1;754754755755 /* If mpext->data_seq is a 32-bit value, data_fin_seq756756 * must also be limited to 32 bits.
+12-8
net/openvswitch/conntrack.c
···905905 }906906 err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range, maniptype);907907908908- if (err == NF_ACCEPT &&909909- ct->status & IPS_SRC_NAT && ct->status & IPS_DST_NAT) {910910- if (maniptype == NF_NAT_MANIP_SRC)911911- maniptype = NF_NAT_MANIP_DST;912912- else913913- maniptype = NF_NAT_MANIP_SRC;908908+ if (err == NF_ACCEPT && ct->status & IPS_DST_NAT) {909909+ if (ct->status & IPS_SRC_NAT) {910910+ if (maniptype == NF_NAT_MANIP_SRC)911911+ maniptype = NF_NAT_MANIP_DST;912912+ else913913+ maniptype = NF_NAT_MANIP_SRC;914914915915- err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range,916916- maniptype);915915+ err = ovs_ct_nat_execute(skb, ct, ctinfo, &info->range,916916+ maniptype);917917+ } else if (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) {918918+ err = ovs_ct_nat_execute(skb, ct, ctinfo, NULL,919919+ NF_NAT_MANIP_SRC);920920+ }917921 }918922919923 /* Mark NAT done if successful and update the flow key. */
+64-12
net/qrtr/ns.c
···193193 struct qrtr_server *srv;194194 struct qrtr_node *node;195195 void __rcu **slot;196196- int ret = 0;196196+ int ret;197197198198 node = node_get(qrtr_ns.local_node);199199 if (!node)···203203 /* Announce the list of servers registered in this node */204204 radix_tree_for_each_slot(slot, &node->servers, &iter, 0) {205205 srv = radix_tree_deref_slot(slot);206206+ if (!srv)207207+ continue;208208+ if (radix_tree_deref_retry(srv)) {209209+ slot = radix_tree_iter_retry(&iter);210210+ continue;211211+ }212212+ slot = radix_tree_iter_resume(slot, &iter);213213+ rcu_read_unlock();206214207215 ret = service_announce_new(sq, srv);208216 if (ret < 0) {209217 pr_err("failed to announce new service\n");210210- goto err_out;218218+ return ret;211219 }220220+221221+ rcu_read_lock();212222 }213223214214-err_out:215224 rcu_read_unlock();216225217217- return ret;226226+ return 0;218227}219228220229static struct qrtr_server *server_add(unsigned int service,···348339 struct qrtr_node *node;349340 void __rcu **slot;350341 struct kvec iv;351351- int ret = 0;342342+ int ret;352343353344 iv.iov_base = &pkt;354345 iv.iov_len = sizeof(pkt);···361352 /* Advertise removal of this client to all servers of remote node */362353 radix_tree_for_each_slot(slot, &node->servers, &iter, 0) {363354 srv = radix_tree_deref_slot(slot);355355+ if (!srv)356356+ continue;357357+ if (radix_tree_deref_retry(srv)) {358358+ slot = radix_tree_iter_retry(&iter);359359+ continue;360360+ }361361+ slot = radix_tree_iter_resume(slot, &iter);362362+ rcu_read_unlock();364363 server_del(node, srv->port);364364+ rcu_read_lock();365365 }366366 rcu_read_unlock();367367···386368 rcu_read_lock();387369 radix_tree_for_each_slot(slot, &local_node->servers, &iter, 0) {388370 srv = radix_tree_deref_slot(slot);371371+ if (!srv)372372+ continue;373373+ if (radix_tree_deref_retry(srv)) {374374+ slot = radix_tree_iter_retry(&iter);375375+ continue;376376+ }377377+ slot = radix_tree_iter_resume(slot, &iter);378378+ rcu_read_unlock();389379390380 sq.sq_family = AF_QIPCRTR;391381 sq.sq_node = srv->node;···405379 ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));406380 if (ret < 0) {407381 pr_err("failed to send bye cmd\n");408408- goto err_out;382382+ return ret;409383 }384384+ rcu_read_lock();410385 }411386412412-err_out:413387 rcu_read_unlock();414388415415- return ret;389389+ return 0;416390}417391418392static int ctrl_cmd_del_client(struct sockaddr_qrtr *from,···430404 struct list_head *li;431405 void __rcu **slot;432406 struct kvec iv;433433- int ret = 0;407407+ int ret;434408435409 iv.iov_base = &pkt;436410 iv.iov_len = sizeof(pkt);···473447 rcu_read_lock();474448 radix_tree_for_each_slot(slot, &local_node->servers, &iter, 0) {475449 srv = radix_tree_deref_slot(slot);450450+ if (!srv)451451+ continue;452452+ if (radix_tree_deref_retry(srv)) {453453+ slot = radix_tree_iter_retry(&iter);454454+ continue;455455+ }456456+ slot = radix_tree_iter_resume(slot, &iter);457457+ rcu_read_unlock();476458477459 sq.sq_family = AF_QIPCRTR;478460 sq.sq_node = srv->node;···492458 ret = kernel_sendmsg(qrtr_ns.sock, &msg, &iv, 1, sizeof(pkt));493459 if (ret < 0) {494460 pr_err("failed to send del client cmd\n");495495- goto err_out;461461+ return ret;496462 }463463+ rcu_read_lock();497464 }498465499499-err_out:500466 rcu_read_unlock();501467502502- return ret;468468+ return 0;503469}504470505471static int ctrl_cmd_new_server(struct sockaddr_qrtr *from,···605571 rcu_read_lock();606572 radix_tree_for_each_slot(node_slot, &nodes, &node_iter, 0) {607573 node = radix_tree_deref_slot(node_slot);574574+ if (!node)575575+ continue;576576+ if (radix_tree_deref_retry(node)) {577577+ node_slot = radix_tree_iter_retry(&node_iter);578578+ continue;579579+ }580580+ node_slot = radix_tree_iter_resume(node_slot, &node_iter);608581609582 radix_tree_for_each_slot(srv_slot, &node->servers,610583 &srv_iter, 0) {611584 struct qrtr_server *srv;612585613586 srv = radix_tree_deref_slot(srv_slot);587587+ if (!srv)588588+ continue;589589+ if (radix_tree_deref_retry(srv)) {590590+ srv_slot = radix_tree_iter_retry(&srv_iter);591591+ continue;592592+ }593593+614594 if (!server_match(srv, &filter))615595 continue;616596597597+ srv_slot = radix_tree_iter_resume(srv_slot, &srv_iter);598598+599599+ rcu_read_unlock();617600 lookup_notify(from, srv, true);601601+ rcu_read_lock();618602 }619603 }620604 rcu_read_unlock();
···3939 unsigned int debug_id)4040{4141 const void *here = __builtin_return_address(0);4242- struct rxrpc_call *call;4242+ struct rxrpc_call *call, *xcall;4343 struct rxrpc_net *rxnet = rxrpc_net(sock_net(&rx->sk));4444+ struct rb_node *parent, **pp;4445 int max, tmp;4546 unsigned int size = RXRPC_BACKLOG_MAX;4647 unsigned int head, tail, call_head, call_tail;···9594 }96959796 /* Now it gets complicated, because calls get registered with the9898- * socket here, particularly if a user ID is preassigned by the user.9797+ * socket here, with a user ID preassigned by the user.9998 */10099 call = rxrpc_alloc_call(rx, gfp, debug_id);101100 if (!call)···108107 here, (const void *)user_call_ID);109108110109 write_lock(&rx->call_lock);110110+111111+ /* Check the user ID isn't already in use */112112+ pp = &rx->calls.rb_node;113113+ parent = NULL;114114+ while (*pp) {115115+ parent = *pp;116116+ xcall = rb_entry(parent, struct rxrpc_call, sock_node);117117+ if (user_call_ID < xcall->user_call_ID)118118+ pp = &(*pp)->rb_left;119119+ else if (user_call_ID > xcall->user_call_ID)120120+ pp = &(*pp)->rb_right;121121+ else122122+ goto id_in_use;123123+ }124124+125125+ call->user_call_ID = user_call_ID;126126+ call->notify_rx = notify_rx;111127 if (user_attach_call) {112112- struct rxrpc_call *xcall;113113- struct rb_node *parent, **pp;114114-115115- /* Check the user ID isn't already in use */116116- pp = &rx->calls.rb_node;117117- parent = NULL;118118- while (*pp) {119119- parent = *pp;120120- xcall = rb_entry(parent, struct rxrpc_call, sock_node);121121- if (user_call_ID < xcall->user_call_ID)122122- pp = &(*pp)->rb_left;123123- else if (user_call_ID > xcall->user_call_ID)124124- pp = &(*pp)->rb_right;125125- else126126- goto id_in_use;127127- }128128-129129- call->user_call_ID = user_call_ID;130130- call->notify_rx = notify_rx;131128 rxrpc_get_call(call, rxrpc_call_got_kernel);132129 user_attach_call(call, user_call_ID);133133- rxrpc_get_call(call, rxrpc_call_got_userid);134134- rb_link_node(&call->sock_node, parent, pp);135135- rb_insert_color(&call->sock_node, &rx->calls);136136- set_bit(RXRPC_CALL_HAS_USERID, &call->flags);137130 }131131+132132+ rxrpc_get_call(call, rxrpc_call_got_userid);133133+ rb_link_node(&call->sock_node, parent, pp);134134+ rb_insert_color(&call->sock_node, &rx->calls);135135+ set_bit(RXRPC_CALL_HAS_USERID, &call->flags);138136139137 list_add(&call->sock_link, &rx->sock_calls);140138···157157}158158159159/*160160- * Preallocate sufficient service connections, calls and peers to cover the161161- * entire backlog of a socket. When a new call comes in, if we don't have162162- * sufficient of each available, the call gets rejected as busy or ignored.163163- *164164- * The backlog is replenished when a connection is accepted or rejected.160160+ * Allocate the preallocation buffers for incoming service calls. These must161161+ * be charged manually.165162 */166163int rxrpc_service_prealloc(struct rxrpc_sock *rx, gfp_t gfp)167164{···170173 return -ENOMEM;171174 rx->backlog = b;172175 }173173-174174- if (rx->discard_new_call)175175- return 0;176176-177177- while (rxrpc_service_prealloc_one(rx, b, NULL, NULL, 0, gfp,178178- atomic_inc_return(&rxrpc_debug_id)) == 0)179179- ;180176181177 return 0;182178}···323333 rxrpc_see_call(call);324334 call->conn = conn;325335 call->security = conn->security;336336+ call->security_ix = conn->security_ix;326337 call->peer = rxrpc_get_peer(conn->params.peer);327338 call->cong_cwnd = call->peer->cong_cwnd;328339 return call;···393402394403 if (rx->notify_new_call)395404 rx->notify_new_call(&rx->sk, call, call->user_call_ID);396396- else397397- sk_acceptq_added(&rx->sk);398405399406 spin_lock(&conn->state_lock);400407 switch (conn->state) {···404415405416 case RXRPC_CONN_SERVICE:406417 write_lock(&call->state_lock);407407- if (call->state < RXRPC_CALL_COMPLETE) {408408- if (rx->discard_new_call)409409- call->state = RXRPC_CALL_SERVER_RECV_REQUEST;410410- else411411- call->state = RXRPC_CALL_SERVER_ACCEPTING;412412- }418418+ if (call->state < RXRPC_CALL_COMPLETE)419419+ call->state = RXRPC_CALL_SERVER_RECV_REQUEST;413420 write_unlock(&call->state_lock);414421 break;415422···425440426441 rxrpc_send_ping(call, skb);427442428428- if (call->state == RXRPC_CALL_SERVER_ACCEPTING)429429- rxrpc_notify_socket(call);430430-431443 /* We have to discard the prealloc queue's ref here and rely on a432444 * combination of the RCU read lock and refs held either by the socket433445 * (recvmsg queue, to-be-accepted queue or user ID tree) or the kernel···442460}443461444462/*445445- * handle acceptance of a call by userspace446446- * - assign the user call ID to the call at the front of the queue447447- * - called with the socket locked.463463+ * Charge up socket with preallocated calls, attaching user call IDs.448464 */449449-struct rxrpc_call *rxrpc_accept_call(struct rxrpc_sock *rx,450450- unsigned long user_call_ID,451451- rxrpc_notify_rx_t notify_rx)452452- __releases(&rx->sk.sk_lock.slock)453453- __acquires(call->user_mutex)465465+int rxrpc_user_charge_accept(struct rxrpc_sock *rx, unsigned long user_call_ID)454466{455455- struct rxrpc_call *call;456456- struct rb_node *parent, **pp;457457- int ret;467467+ struct rxrpc_backlog *b = rx->backlog;458468459459- _enter(",%lx", user_call_ID);469469+ if (rx->sk.sk_state == RXRPC_CLOSE)470470+ return -ESHUTDOWN;460471461461- ASSERT(!irqs_disabled());462462-463463- write_lock(&rx->call_lock);464464-465465- if (list_empty(&rx->to_be_accepted)) {466466- write_unlock(&rx->call_lock);467467- release_sock(&rx->sk);468468- kleave(" = -ENODATA [empty]");469469- return ERR_PTR(-ENODATA);470470- }471471-472472- /* check the user ID isn't already in use */473473- pp = &rx->calls.rb_node;474474- parent = NULL;475475- while (*pp) {476476- parent = *pp;477477- call = rb_entry(parent, struct rxrpc_call, sock_node);478478-479479- if (user_call_ID < call->user_call_ID)480480- pp = &(*pp)->rb_left;481481- else if (user_call_ID > call->user_call_ID)482482- pp = &(*pp)->rb_right;483483- else484484- goto id_in_use;485485- }486486-487487- /* Dequeue the first call and check it's still valid. We gain488488- * responsibility for the queue's reference.489489- */490490- call = list_entry(rx->to_be_accepted.next,491491- struct rxrpc_call, accept_link);492492- write_unlock(&rx->call_lock);493493-494494- /* We need to gain the mutex from the interrupt handler without495495- * upsetting lockdep, so we have to release it there and take it here.496496- * We are, however, still holding the socket lock, so other accepts497497- * must wait for us and no one can add the user ID behind our backs.498498- */499499- if (mutex_lock_interruptible(&call->user_mutex) < 0) {500500- release_sock(&rx->sk);501501- kleave(" = -ERESTARTSYS");502502- return ERR_PTR(-ERESTARTSYS);503503- }504504-505505- write_lock(&rx->call_lock);506506- list_del_init(&call->accept_link);507507- sk_acceptq_removed(&rx->sk);508508- rxrpc_see_call(call);509509-510510- /* Find the user ID insertion point. */511511- pp = &rx->calls.rb_node;512512- parent = NULL;513513- while (*pp) {514514- parent = *pp;515515- call = rb_entry(parent, struct rxrpc_call, sock_node);516516-517517- if (user_call_ID < call->user_call_ID)518518- pp = &(*pp)->rb_left;519519- else if (user_call_ID > call->user_call_ID)520520- pp = &(*pp)->rb_right;521521- else522522- BUG();523523- }524524-525525- write_lock_bh(&call->state_lock);526526- switch (call->state) {527527- case RXRPC_CALL_SERVER_ACCEPTING:528528- call->state = RXRPC_CALL_SERVER_RECV_REQUEST;529529- break;530530- case RXRPC_CALL_COMPLETE:531531- ret = call->error;532532- goto out_release;533533- default:534534- BUG();535535- }536536-537537- /* formalise the acceptance */538538- call->notify_rx = notify_rx;539539- call->user_call_ID = user_call_ID;540540- rxrpc_get_call(call, rxrpc_call_got_userid);541541- rb_link_node(&call->sock_node, parent, pp);542542- rb_insert_color(&call->sock_node, &rx->calls);543543- if (test_and_set_bit(RXRPC_CALL_HAS_USERID, &call->flags))544544- BUG();545545-546546- write_unlock_bh(&call->state_lock);547547- write_unlock(&rx->call_lock);548548- rxrpc_notify_socket(call);549549- rxrpc_service_prealloc(rx, GFP_KERNEL);550550- release_sock(&rx->sk);551551- _leave(" = %p{%d}", call, call->debug_id);552552- return call;553553-554554-out_release:555555- _debug("release %p", call);556556- write_unlock_bh(&call->state_lock);557557- write_unlock(&rx->call_lock);558558- rxrpc_release_call(rx, call);559559- rxrpc_put_call(call, rxrpc_call_put);560560- goto out;561561-562562-id_in_use:563563- ret = -EBADSLT;564564- write_unlock(&rx->call_lock);565565-out:566566- rxrpc_service_prealloc(rx, GFP_KERNEL);567567- release_sock(&rx->sk);568568- _leave(" = %d", ret);569569- return ERR_PTR(ret);570570-}571571-572572-/*573573- * Handle rejection of a call by userspace574574- * - reject the call at the front of the queue575575- */576576-int rxrpc_reject_call(struct rxrpc_sock *rx)577577-{578578- struct rxrpc_call *call;579579- bool abort = false;580580- int ret;581581-582582- _enter("");583583-584584- ASSERT(!irqs_disabled());585585-586586- write_lock(&rx->call_lock);587587-588588- if (list_empty(&rx->to_be_accepted)) {589589- write_unlock(&rx->call_lock);590590- return -ENODATA;591591- }592592-593593- /* Dequeue the first call and check it's still valid. We gain594594- * responsibility for the queue's reference.595595- */596596- call = list_entry(rx->to_be_accepted.next,597597- struct rxrpc_call, accept_link);598598- list_del_init(&call->accept_link);599599- sk_acceptq_removed(&rx->sk);600600- rxrpc_see_call(call);601601-602602- write_lock_bh(&call->state_lock);603603- switch (call->state) {604604- case RXRPC_CALL_SERVER_ACCEPTING:605605- __rxrpc_abort_call("REJ", call, 1, RX_USER_ABORT, -ECONNABORTED);606606- abort = true;607607- fallthrough;608608- case RXRPC_CALL_COMPLETE:609609- ret = call->error;610610- goto out_discard;611611- default:612612- BUG();613613- }614614-615615-out_discard:616616- write_unlock_bh(&call->state_lock);617617- write_unlock(&rx->call_lock);618618- if (abort) {619619- rxrpc_send_abort_packet(call);620620- rxrpc_release_call(rx, call);621621- rxrpc_put_call(call, rxrpc_call_put);622622- }623623- rxrpc_service_prealloc(rx, GFP_KERNEL);624624- _leave(" = %d", ret);625625- return ret;472472+ return rxrpc_service_prealloc_one(rx, b, NULL, NULL, user_call_ID,473473+ GFP_KERNEL,474474+ atomic_inc_return(&rxrpc_debug_id));626475}627476628477/*
+1-4
net/rxrpc/call_object.c
···2323 [RXRPC_CALL_CLIENT_RECV_REPLY] = "ClRcvRpl",2424 [RXRPC_CALL_SERVER_PREALLOC] = "SvPrealc",2525 [RXRPC_CALL_SERVER_SECURING] = "SvSecure",2626- [RXRPC_CALL_SERVER_ACCEPTING] = "SvAccept",2726 [RXRPC_CALL_SERVER_RECV_REQUEST] = "SvRcvReq",2827 [RXRPC_CALL_SERVER_ACK_REQUEST] = "SvAckReq",2928 [RXRPC_CALL_SERVER_SEND_REPLY] = "SvSndRpl",···392393 call->call_id = sp->hdr.callNumber;393394 call->service_id = sp->hdr.serviceId;394395 call->cid = sp->hdr.cid;395395- call->state = RXRPC_CALL_SERVER_ACCEPTING;396396- if (sp->hdr.securityIndex > 0)397397- call->state = RXRPC_CALL_SERVER_SECURING;396396+ call->state = RXRPC_CALL_SERVER_SECURING;398397 call->cong_tstamp = skb->tstamp;399398400399 /* Set the channel for this call. We don't get channel_lock as we're
···179179}180180181181/*182182- * Pass back notification of a new call. The call is added to the183183- * to-be-accepted list. This means that the next call to be accepted might not184184- * be the last call seen awaiting acceptance, but unless we leave this on the185185- * front of the queue and block all other messages until someone gives us a186186- * user_ID for it, there's not a lot we can do.187187- */188188-static int rxrpc_recvmsg_new_call(struct rxrpc_sock *rx,189189- struct rxrpc_call *call,190190- struct msghdr *msg, int flags)191191-{192192- int tmp = 0, ret;193193-194194- ret = put_cmsg(msg, SOL_RXRPC, RXRPC_NEW_CALL, 0, &tmp);195195-196196- if (ret == 0 && !(flags & MSG_PEEK)) {197197- _debug("to be accepted");198198- write_lock_bh(&rx->recvmsg_lock);199199- list_del_init(&call->recvmsg_link);200200- write_unlock_bh(&rx->recvmsg_lock);201201-202202- rxrpc_get_call(call, rxrpc_call_got);203203- write_lock(&rx->call_lock);204204- list_add_tail(&call->accept_link, &rx->to_be_accepted);205205- write_unlock(&rx->call_lock);206206- }207207-208208- trace_rxrpc_recvmsg(call, rxrpc_recvmsg_to_be_accepted, 1, 0, 0, ret);209209- return ret;210210-}211211-212212-/*213182 * End the packet reception phase.214183 */215184static void rxrpc_end_rx_phase(struct rxrpc_call *call, rxrpc_serial_t serial)···599630 }600631601632 switch (READ_ONCE(call->state)) {602602- case RXRPC_CALL_SERVER_ACCEPTING:603603- ret = rxrpc_recvmsg_new_call(rx, call, msg, flags);604604- break;605633 case RXRPC_CALL_CLIENT_RECV_REPLY:606634 case RXRPC_CALL_SERVER_RECV_REQUEST:607635 case RXRPC_CALL_SERVER_ACK_REQUEST:···694728 call->debug_id, rxrpc_call_states[call->state],695729 iov_iter_count(iter), want_more);696730697697- ASSERTCMP(call->state, !=, RXRPC_CALL_SERVER_ACCEPTING);731731+ ASSERTCMP(call->state, !=, RXRPC_CALL_SERVER_SECURING);698732699733 mutex_lock(&call->user_mutex);700734
+5-10
net/rxrpc/sendmsg.c
···530530 return -EINVAL;531531 break;532532533533- case RXRPC_ACCEPT:533533+ case RXRPC_CHARGE_ACCEPT:534534 if (p->command != RXRPC_CMD_SEND_DATA)535535 return -EINVAL;536536- p->command = RXRPC_CMD_ACCEPT;536536+ p->command = RXRPC_CMD_CHARGE_ACCEPT;537537 if (len != 0)538538 return -EINVAL;539539 break;···659659 if (ret < 0)660660 goto error_release_sock;661661662662- if (p.command == RXRPC_CMD_ACCEPT) {662662+ if (p.command == RXRPC_CMD_CHARGE_ACCEPT) {663663 ret = -EINVAL;664664 if (rx->sk.sk_state != RXRPC_SERVER_LISTENING)665665 goto error_release_sock;666666- call = rxrpc_accept_call(rx, p.call.user_call_ID, NULL);667667- /* The socket is now unlocked. */668668- if (IS_ERR(call))669669- return PTR_ERR(call);670670- ret = 0;671671- goto out_put_unlock;666666+ ret = rxrpc_user_charge_accept(rx, p.call.user_call_ID);667667+ goto error_release_sock;672668 }673669674670 call = rxrpc_find_call_by_user_ID(rx, p.call.user_call_ID);···686690 case RXRPC_CALL_CLIENT_AWAIT_CONN:687691 case RXRPC_CALL_SERVER_PREALLOC:688692 case RXRPC_CALL_SERVER_SECURING:689689- case RXRPC_CALL_SERVER_ACCEPTING:690693 rxrpc_put_call(call, rxrpc_call_put);691694 ret = -EBUSY;692695 goto error_release_sock;
+1
net/sctp/auth.c
···494494out_err:495495 /* Clean up any successful allocations */496496 sctp_auth_destroy_hmacs(ep->auth_hmacs);497497+ ep->auth_hmacs = NULL;497498 return -ENOMEM;498499}499500