This is the 4.4.232 stable release

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl8kLg0ACgkQONu9yGCS
 aT4abQ//cj9rRBIi2f+TM+JqYkKdEWHp6+sSi9qyAsSquyLmtYRoZ6U39JMM0UIG
 +Z/7OSL6lg1Xjd9OMVw7VJLWy0cB4AXN6K7NRiuQIq0CF8zIYAyM8SQV/9nT9vyc
 NVDrXiSFkkGmZ1lWJhkb6MO3RFdcYHNUG3dyuq+y5n5ABmXQaRdkN8Lo6TZllQxN
 6/fQ9QxzSvTmPyDwDpzOxrfFegPwRzTLlPyaKkn7oswmN6rYqcxc18PS35GlMTD+
 VZP2zdpIOl++maDMoSO3FLp2lA/5HT1asIvE0S7AgXSHFJkziTgzFJr8OcjYmvRU
 h/JxAbJ5PyXRbsnSeSyIFNWEUsH6BsQdl7eH7bWDQV9Rrru6oXV+Sa+QsLu9Xl6p
 0JgwxAsWfrM0p/6Bg7GTwkbdH2s7pigThUQ4w5DikIsGdtoNsfVNK5KSwmkHh6DH
 7VO9S5cUdIaEVGG+Ghe70a+Yh+9O7O5f48XKW3skrQ95vgb3tupuz8UTU0yis1MP
 iCk3NQtKUahcsAvoWDLljLjLGkrvmtbql61dNvkrbgwJ+BiV+U+LDJ9z88/ywms4
 LRywrExOeTUxS5H7y4efKDhGrCFAH2Xdi0WERRuS22NAT4JhaPGqKLEwXQae4ecm
 cWWikmN463rrAzCPZdJvuAxGo+jHfz/sj4ESOhe/d4LDBiBkzPc=
 =oyOO
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEJDfLduVEy2qz2d/TmXOSYMtstxYFAl8kS/wACgkQmXOSYMts
 txbI6w/+Oc9aAaWE8mL222CTATANUZ0sb/sGuCaqmlQ/D0PiHWsAHaJG3L0rnybm
 dgQWAgMs7s6XlSiUGh28PdqTOafLkw+xr9aPOimgV19edhT9fM9Li+SDDm8HKi2E
 jK+zcI2UxV5K9pNfqTr7H4iUATDTosksJCGObpc55TbbAht6XYImyTBT19lG/Oaj
 UQ/mRbBIbnbnqqW1I0ltqDXZVY7XOHfHDhl76QWXdYZ9vz4Ao3FBoWbHSCKePiHo
 tAqkuTWqsy+i1Bwfry7+CodBs1xRh0HX+bXqNGUp0gkeQHs3Of5DBmELmxcqyRKq
 hMkAhSptlyxhImz2aHH6DUQHcBwAsetOrIKf3B/QPNgVS5UkrRrBd6Xt1Y5D5X/1
 kANVYOm8qqMnS1ciFHrqgfOFAvSZ9FPhVIo5JyDHS7/6AvzpIetR0/Xvk4T8b/tm
 4JjpJe/5zJx+qPnzL3e5/5Uur83Q6Z9H+Hz94dK4mXj9XI2ymFpLsR38nsaZeJZb
 Z1xbZUodJwdNsK6/cHH0Cjd0v/JwXLCJtys1o2p6xParQeqws26tbvxe81gBsCZ6
 OocpvvNO8Vs6zYV1SBfohXhI3miSEytjJsanZ/8vV0tUHn4ox/SIusRcrGNS2URD
 paSwafXzvLIBuzjxpez6ntDr4l0FmygoWOfl+69OFa2R/fbsjlc=
 =jwIB
 -----END PGP SIGNATURE-----

Merge 4.4.232 into kernel.lnx.4.4.r39-rel

Changes in 4.4.232: (55 commits)
        pinctrl: amd: fix npins for uart0 in kerncz_groups
        mac80211: allow rx of mesh eapol frames with default rx key
        scsi: scsi_transport_spi: Fix function pointer check
        xtensa: fix __sync_fetch_and_{and,or}_4 declarations
        xtensa: update *pos in cpuinfo_op.next
        drivers/net/wan/lapbether: Fixed the value of hard_header_len
        net: sky2: initialize return of gm_phy_read
        drm/nouveau/i2c/g94-: increase NV_PMGR_DP_AUXCTL_TRANSACTREQ timeout
        SUNRPC reverting d03727b248d0 ("NFSv4 fix CLOSE not waiting for direct IO compeletion")
        perf/core: Fix locking for children siblings group read
        uprobes: Change handle_swbp() to send SIGTRAP with si_code=SI_KERNEL, to fix GDB regression
        ALSA: info: Drop WARN_ON() from buffer NULL sanity check
        ASoC: rt5670: Correct RT5670_LDO_SEL_MASK
        btrfs: fix double free on ulist after backref resolution failure
        x86/fpu: Disable bottom halves while loading FPU registers
        btrfs: fix mount failure caused by race with umount
        hippi: Fix a size used in a 'pci_free_consistent()' in an error handling path
        ax88172a: fix ax88172a_unbind() failures
        net: dp83640: fix SIOCSHWTSTAMP to update the struct with actual configuration
        net: smc91x: Fix possible memory leak in smc_drv_probe()
        scripts/decode_stacktrace: strip basepath from all paths
        regmap: dev_get_regmap_match(): fix string comparison
        usb: gadget: udc: gr_udc: fix memleak on error handling path in gr_ep_init()
        arm64: Use test_tsk_thread_flag() for checking TIF_SINGLESTEP
        x86: math-emu: Fix up 'cmp' insn for clang ias
        Revert "cifs: Fix the target file was deleted when rename failed."
        staging: wlan-ng: properly check endpoint types
        staging: comedi: addi_apci_1032: check INSN_CONFIG_DIGITAL_TRIG shift
        staging: comedi: ni_6527: fix INSN_CONFIG_DIGITAL_TRIG support
        staging: comedi: addi_apci_1500: check INSN_CONFIG_DIGITAL_TRIG shift
        staging: comedi: addi_apci_1564: check INSN_CONFIG_DIGITAL_TRIG shift
        serial: 8250: fix null-ptr-deref in serial8250_start_tx()
        serial: 8250_mtk: Fix high-speed baud rates clamping
        mm/memcg: fix refcount error while moving and swapping
        parisc: Add atomic64_set_release() define to avoid CPU soft lockups
        ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb
        ath9k: Fix regression with Atheros 9271
        AX.25: Fix out-of-bounds read in ax25_connect()
        AX.25: Prevent out-of-bounds read in ax25_sendmsg()
        net-sysfs: add a newline when printing 'tx_timeout' by sysfs
        net: udp: Fix wrong clean up for IS_UDPLITE macro
        AX.25: Prevent integer overflows in connect and sendmsg
        tcp: allow at most one TLP probe per flight
        rxrpc: Fix sendmsg() returning EPIPE due to recvmsg() returning ENODATA
        ip6_gre: fix null-ptr-deref in ip6gre_init_net()
        drivers/net/wan/x25_asy: Fix to make it work
        Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation
        regmap: debugfs: check count when read regmap file
        xfs: set format back to extents if xfs_bmap_extents_to_btree
        tools/lib/subcmd/pager.c: do not alias select() params
        perf: Make perf able to build with latest libbfd
        perf tools: Fix snprint warnings for gcc 8
        perf annotate: Use asprintf when formatting objdump command line
        perf probe: Fix to check blacklist address correctly
        Linux 4.4.232

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
This commit is contained in:
Nathan Chancellor 2020-07-31 09:51:08 -07:00
commit 68912ae749
63 changed files with 346 additions and 142 deletions

View file

@ -1,6 +1,6 @@
VERSION = 4 VERSION = 4
PATCHLEVEL = 4 PATCHLEVEL = 4
SUBLEVEL = 231 SUBLEVEL = 232
EXTRAVERSION = EXTRAVERSION =
NAME = Blurry Fish Butt NAME = Blurry Fish Butt
@ -619,7 +619,7 @@ ifeq ($(shell $(srctree)/scripts/clang-android.sh $(CC) $(CLANG_TARGET)), y)
$(error "Clang with Android --target detected. Did you specify CLANG_TRIPLE?") $(error "Clang with Android --target detected. Did you specify CLANG_TRIPLE?")
endif endif
GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
CLANG_PREFIX := --prefix=$(GCC_TOOLCHAIN_DIR) CLANG_PREFIX := --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
endif endif
ifneq ($(GCC_TOOLCHAIN),) ifneq ($(GCC_TOOLCHAIN),)

View file

@ -410,14 +410,14 @@ void user_rewind_single_step(struct task_struct *task)
* If single step is active for this thread, then set SPSR.SS * If single step is active for this thread, then set SPSR.SS
* to 1 to avoid returning to the active-pending state. * to 1 to avoid returning to the active-pending state.
*/ */
if (test_ti_thread_flag(task_thread_info(task), TIF_SINGLESTEP)) if (test_tsk_thread_flag(task, TIF_SINGLESTEP))
set_regs_spsr_ss(task_pt_regs(task)); set_regs_spsr_ss(task_pt_regs(task));
} }
NOKPROBE_SYMBOL(user_rewind_single_step); NOKPROBE_SYMBOL(user_rewind_single_step);
void user_fastforward_single_step(struct task_struct *task) void user_fastforward_single_step(struct task_struct *task)
{ {
if (test_ti_thread_flag(task_thread_info(task), TIF_SINGLESTEP)) if (test_tsk_thread_flag(task, TIF_SINGLESTEP))
clear_regs_spsr_ss(task_pt_regs(task)); clear_regs_spsr_ss(task_pt_regs(task));
} }

View file

@ -208,6 +208,8 @@ atomic64_set(atomic64_t *v, s64 i)
_atomic_spin_unlock_irqrestore(v, flags); _atomic_spin_unlock_irqrestore(v, flags);
} }
#define atomic64_set_release(v, i) atomic64_set((v), (i))
static __inline__ s64 static __inline__ s64
atomic64_read(const atomic64_t *v) atomic64_read(const atomic64_t *v)
{ {

View file

@ -317,10 +317,10 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
sanitize_restored_xstate(tsk, &env, xfeatures, fx_only); sanitize_restored_xstate(tsk, &env, xfeatures, fx_only);
} }
local_bh_disable();
fpu->fpstate_active = 1; fpu->fpstate_active = 1;
preempt_disable();
fpu__restore(fpu); fpu__restore(fpu);
preempt_enable(); local_bh_enable();
return err; return err;
} else { } else {

View file

@ -208,7 +208,7 @@ sqrt_stage_2_finish:
#ifdef PARANOID #ifdef PARANOID
/* It should be possible to get here only if the arg is ffff....ffff */ /* It should be possible to get here only if the arg is ffff....ffff */
cmp $0xffffffff,FPU_fsqrt_arg_1 cmpl $0xffffffff,FPU_fsqrt_arg_1
jnz sqrt_stage_2_error jnz sqrt_stage_2_error
#endif /* PARANOID */ #endif /* PARANOID */

View file

@ -716,7 +716,8 @@ c_start(struct seq_file *f, loff_t *pos)
static void * static void *
c_next(struct seq_file *f, void *v, loff_t *pos) c_next(struct seq_file *f, void *v, loff_t *pos)
{ {
return NULL; ++*pos;
return c_start(f, pos);
} }
static void static void

View file

@ -82,13 +82,13 @@ void __xtensa_libgcc_window_spill(void)
} }
EXPORT_SYMBOL(__xtensa_libgcc_window_spill); EXPORT_SYMBOL(__xtensa_libgcc_window_spill);
unsigned long __sync_fetch_and_and_4(unsigned long *p, unsigned long v) unsigned int __sync_fetch_and_and_4(volatile void *p, unsigned int v)
{ {
BUG(); BUG();
} }
EXPORT_SYMBOL(__sync_fetch_and_and_4); EXPORT_SYMBOL(__sync_fetch_and_and_4);
unsigned long __sync_fetch_and_or_4(unsigned long *p, unsigned long v) unsigned int __sync_fetch_and_or_4(volatile void *p, unsigned int v)
{ {
BUG(); BUG();
} }

View file

@ -194,6 +194,9 @@ static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
if (*ppos < 0 || !count) if (*ppos < 0 || !count)
return -EINVAL; return -EINVAL;
if (count > (PAGE_SIZE << (MAX_ORDER - 1)))
count = PAGE_SIZE << (MAX_ORDER - 1);
buf = kmalloc(count, GFP_KERNEL); buf = kmalloc(count, GFP_KERNEL);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
@ -402,6 +405,9 @@ static ssize_t regmap_reg_ranges_read_file(struct file *file,
if (*ppos < 0 || !count) if (*ppos < 0 || !count)
return -EINVAL; return -EINVAL;
if (count > (PAGE_SIZE << (MAX_ORDER - 1)))
count = PAGE_SIZE << (MAX_ORDER - 1);
buf = kmalloc(count, GFP_KERNEL); buf = kmalloc(count, GFP_KERNEL);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;

View file

@ -1106,7 +1106,7 @@ static int dev_get_regmap_match(struct device *dev, void *res, void *data)
/* If the user didn't specify a name match any */ /* If the user didn't specify a name match any */
if (data) if (data)
return (*r)->name == data; return !strcmp((*r)->name, data);
else else
return 1; return 1;
} }

View file

@ -118,10 +118,10 @@ g94_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry,
if (retries) if (retries)
udelay(400); udelay(400);
/* transaction request, wait up to 1ms for it to complete */ /* transaction request, wait up to 2ms for it to complete */
nvkm_wr32(device, 0x00e4e4 + base, 0x00010000 | ctrl); nvkm_wr32(device, 0x00e4e4 + base, 0x00010000 | ctrl);
timeout = 1000; timeout = 2000;
do { do {
ctrl = nvkm_rd32(device, 0x00e4e4 + base); ctrl = nvkm_rd32(device, 0x00e4e4 + base);
udelay(1); udelay(1);

View file

@ -118,10 +118,10 @@ gm204_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry,
if (retries) if (retries)
udelay(400); udelay(400);
/* transaction request, wait up to 1ms for it to complete */ /* transaction request, wait up to 2ms for it to complete */
nvkm_wr32(device, 0x00d954 + base, 0x00010000 | ctrl); nvkm_wr32(device, 0x00d954 + base, 0x00010000 | ctrl);
timeout = 1000; timeout = 2000;
do { do {
ctrl = nvkm_rd32(device, 0x00d954 + base); ctrl = nvkm_rd32(device, 0x00d954 + base);
udelay(1); udelay(1);

View file

@ -215,7 +215,7 @@ io_error:
static inline u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg) static inline u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg)
{ {
u16 v; u16 v = 0;
__gm_phy_read(hw, port, reg, &v); __gm_phy_read(hw, port, reg, &v);
return v; return v;
} }

View file

@ -2289,7 +2289,7 @@ static int smc_drv_probe(struct platform_device *pdev)
ret = try_toggle_control_gpio(&pdev->dev, &lp->power_gpio, ret = try_toggle_control_gpio(&pdev->dev, &lp->power_gpio,
"power", 0, 0, 100); "power", 0, 0, 100);
if (ret) if (ret)
return ret; goto out_free_netdev;
/* /*
* Optional reset GPIO configured? Minimum 100 ns reset needed * Optional reset GPIO configured? Minimum 100 ns reset needed
@ -2298,7 +2298,7 @@ static int smc_drv_probe(struct platform_device *pdev)
ret = try_toggle_control_gpio(&pdev->dev, &lp->reset_gpio, ret = try_toggle_control_gpio(&pdev->dev, &lp->reset_gpio,
"reset", 0, 0, 100); "reset", 0, 0, 100);
if (ret) if (ret)
return ret; goto out_free_netdev;
/* /*
* Need to wait for optional EEPROM to load, max 750 us according * Need to wait for optional EEPROM to load, max 750 us according

View file

@ -1250,7 +1250,7 @@ static int rr_open(struct net_device *dev)
rrpriv->info = NULL; rrpriv->info = NULL;
} }
if (rrpriv->rx_ctrl) { if (rrpriv->rx_ctrl) {
pci_free_consistent(pdev, sizeof(struct ring_ctrl), pci_free_consistent(pdev, 256 * sizeof(struct ring_ctrl),
rrpriv->rx_ctrl, rrpriv->rx_ctrl_dma); rrpriv->rx_ctrl, rrpriv->rx_ctrl_dma);
rrpriv->rx_ctrl = NULL; rrpriv->rx_ctrl = NULL;
} }

View file

@ -1335,6 +1335,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr)
dp83640->hwts_rx_en = 1; dp83640->hwts_rx_en = 1;
dp83640->layer = PTP_CLASS_L4; dp83640->layer = PTP_CLASS_L4;
dp83640->version = PTP_CLASS_V1; dp83640->version = PTP_CLASS_V1;
cfg.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
break; break;
case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
@ -1342,6 +1343,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr)
dp83640->hwts_rx_en = 1; dp83640->hwts_rx_en = 1;
dp83640->layer = PTP_CLASS_L4; dp83640->layer = PTP_CLASS_L4;
dp83640->version = PTP_CLASS_V2; dp83640->version = PTP_CLASS_V2;
cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT;
break; break;
case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
@ -1349,6 +1351,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr)
dp83640->hwts_rx_en = 1; dp83640->hwts_rx_en = 1;
dp83640->layer = PTP_CLASS_L2; dp83640->layer = PTP_CLASS_L2;
dp83640->version = PTP_CLASS_V2; dp83640->version = PTP_CLASS_V2;
cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
break; break;
case HWTSTAMP_FILTER_PTP_V2_EVENT: case HWTSTAMP_FILTER_PTP_V2_EVENT:
case HWTSTAMP_FILTER_PTP_V2_SYNC: case HWTSTAMP_FILTER_PTP_V2_SYNC:
@ -1356,6 +1359,7 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr)
dp83640->hwts_rx_en = 1; dp83640->hwts_rx_en = 1;
dp83640->layer = PTP_CLASS_L4 | PTP_CLASS_L2; dp83640->layer = PTP_CLASS_L4 | PTP_CLASS_L2;
dp83640->version = PTP_CLASS_V2; dp83640->version = PTP_CLASS_V2;
cfg.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
break; break;
default: default:
return -ERANGE; return -ERANGE;

View file

@ -245,6 +245,7 @@ static int ax88172a_bind(struct usbnet *dev, struct usb_interface *intf)
ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf); ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf);
if (ret < ETH_ALEN) { if (ret < ETH_ALEN) {
netdev_err(dev->net, "Failed to read MAC address: %d\n", ret); netdev_err(dev->net, "Failed to read MAC address: %d\n", ret);
ret = -EIO;
goto free; goto free;
} }
memcpy(dev->net->dev_addr, buf, ETH_ALEN); memcpy(dev->net->dev_addr, buf, ETH_ALEN);

View file

@ -308,7 +308,6 @@ static void lapbeth_setup(struct net_device *dev)
dev->netdev_ops = &lapbeth_netdev_ops; dev->netdev_ops = &lapbeth_netdev_ops;
dev->destructor = free_netdev; dev->destructor = free_netdev;
dev->type = ARPHRD_X25; dev->type = ARPHRD_X25;
dev->hard_header_len = 3;
dev->mtu = 1000; dev->mtu = 1000;
dev->addr_len = 0; dev->addr_len = 0;
} }
@ -329,6 +328,14 @@ static int lapbeth_new_device(struct net_device *dev)
if (!ndev) if (!ndev)
goto out; goto out;
/* When transmitting data:
* first this driver removes a pseudo header of 1 byte,
* then the lapb module prepends an LAPB header of at most 3 bytes,
* then this driver prepends a length field of 2 bytes,
* then the underlying Ethernet device prepends its own header.
*/
ndev->hard_header_len = -1 + 3 + 2 + dev->hard_header_len;
lapbeth = netdev_priv(ndev); lapbeth = netdev_priv(ndev);
lapbeth->axdev = ndev; lapbeth->axdev = ndev;

View file

@ -186,7 +186,7 @@ static inline void x25_asy_unlock(struct x25_asy *sl)
netif_wake_queue(sl->dev); netif_wake_queue(sl->dev);
} }
/* Send one completely decapsulated IP datagram to the IP layer. */ /* Send an LAPB frame to the LAPB module to process. */
static void x25_asy_bump(struct x25_asy *sl) static void x25_asy_bump(struct x25_asy *sl)
{ {
@ -198,13 +198,12 @@ static void x25_asy_bump(struct x25_asy *sl)
count = sl->rcount; count = sl->rcount;
dev->stats.rx_bytes += count; dev->stats.rx_bytes += count;
skb = dev_alloc_skb(count+1); skb = dev_alloc_skb(count);
if (skb == NULL) { if (skb == NULL) {
netdev_warn(sl->dev, "memory squeeze, dropping packet\n"); netdev_warn(sl->dev, "memory squeeze, dropping packet\n");
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
return; return;
} }
skb_push(skb, 1); /* LAPB internal control */
memcpy(skb_put(skb, count), sl->rbuff, count); memcpy(skb_put(skb, count), sl->rbuff, count);
skb->protocol = x25_type_trans(skb, sl->dev); skb->protocol = x25_type_trans(skb, sl->dev);
err = lapb_data_received(skb->dev, skb); err = lapb_data_received(skb->dev, skb);
@ -212,7 +211,6 @@ static void x25_asy_bump(struct x25_asy *sl)
kfree_skb(skb); kfree_skb(skb);
printk(KERN_DEBUG "x25_asy: data received err - %d\n", err); printk(KERN_DEBUG "x25_asy: data received err - %d\n", err);
} else { } else {
netif_rx(skb);
dev->stats.rx_packets++; dev->stats.rx_packets++;
} }
} }
@ -358,12 +356,21 @@ static netdev_tx_t x25_asy_xmit(struct sk_buff *skb,
*/ */
/* /*
* Called when I frame data arrives. We did the work above - throw it * Called when I frame data arrive. We add a pseudo header for upper
* at the net layer. * layers and pass it to upper layers.
*/ */
static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb) static int x25_asy_data_indication(struct net_device *dev, struct sk_buff *skb)
{ {
if (skb_cow(skb, 1)) {
kfree_skb(skb);
return NET_RX_DROP;
}
skb_push(skb, 1);
skb->data[0] = X25_IFACE_DATA;
skb->protocol = x25_type_trans(skb, dev);
return netif_rx(skb); return netif_rx(skb);
} }
@ -655,7 +662,7 @@ static void x25_asy_unesc(struct x25_asy *sl, unsigned char s)
switch (s) { switch (s) {
case X25_END: case X25_END:
if (!test_and_clear_bit(SLF_ERROR, &sl->flags) && if (!test_and_clear_bit(SLF_ERROR, &sl->flags) &&
sl->rcount > 2) sl->rcount >= 2)
x25_asy_bump(sl); x25_asy_bump(sl);
clear_bit(SLF_ESCAPE, &sl->flags); clear_bit(SLF_ESCAPE, &sl->flags);
sl->rcount = 0; sl->rcount = 0;

View file

@ -639,9 +639,9 @@ err:
static void ath9k_hif_usb_rx_cb(struct urb *urb) static void ath9k_hif_usb_rx_cb(struct urb *urb)
{ {
struct sk_buff *skb = (struct sk_buff *) urb->context; struct rx_buf *rx_buf = (struct rx_buf *)urb->context;
struct hif_device_usb *hif_dev = struct hif_device_usb *hif_dev = rx_buf->hif_dev;
usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); struct sk_buff *skb = rx_buf->skb;
int ret; int ret;
if (!skb) if (!skb)
@ -681,14 +681,15 @@ resubmit:
return; return;
free: free:
kfree_skb(skb); kfree_skb(skb);
kfree(rx_buf);
} }
static void ath9k_hif_usb_reg_in_cb(struct urb *urb) static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
{ {
struct sk_buff *skb = (struct sk_buff *) urb->context; struct rx_buf *rx_buf = (struct rx_buf *)urb->context;
struct hif_device_usb *hif_dev = rx_buf->hif_dev;
struct sk_buff *skb = rx_buf->skb;
struct sk_buff *nskb; struct sk_buff *nskb;
struct hif_device_usb *hif_dev =
usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
int ret; int ret;
if (!skb) if (!skb)
@ -728,11 +729,13 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
return; return;
} }
rx_buf->skb = nskb;
usb_fill_int_urb(urb, hif_dev->udev, usb_fill_int_urb(urb, hif_dev->udev,
usb_rcvintpipe(hif_dev->udev, usb_rcvintpipe(hif_dev->udev,
USB_REG_IN_PIPE), USB_REG_IN_PIPE),
nskb->data, MAX_REG_IN_BUF_SIZE, nskb->data, MAX_REG_IN_BUF_SIZE,
ath9k_hif_usb_reg_in_cb, nskb, 1); ath9k_hif_usb_reg_in_cb, rx_buf, 1);
} }
resubmit: resubmit:
@ -746,6 +749,7 @@ resubmit:
return; return;
free: free:
kfree_skb(skb); kfree_skb(skb);
kfree(rx_buf);
urb->context = NULL; urb->context = NULL;
} }
@ -791,7 +795,7 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev)
init_usb_anchor(&hif_dev->mgmt_submitted); init_usb_anchor(&hif_dev->mgmt_submitted);
for (i = 0; i < MAX_TX_URB_NUM; i++) { for (i = 0; i < MAX_TX_URB_NUM; i++) {
tx_buf = kzalloc(sizeof(struct tx_buf), GFP_KERNEL); tx_buf = kzalloc(sizeof(*tx_buf), GFP_KERNEL);
if (!tx_buf) if (!tx_buf)
goto err; goto err;
@ -828,8 +832,9 @@ static void ath9k_hif_usb_dealloc_rx_urbs(struct hif_device_usb *hif_dev)
static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
{ {
struct urb *urb = NULL; struct rx_buf *rx_buf = NULL;
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct urb *urb = NULL;
int i, ret; int i, ret;
init_usb_anchor(&hif_dev->rx_submitted); init_usb_anchor(&hif_dev->rx_submitted);
@ -837,6 +842,12 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
for (i = 0; i < MAX_RX_URB_NUM; i++) { for (i = 0; i < MAX_RX_URB_NUM; i++) {
rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL);
if (!rx_buf) {
ret = -ENOMEM;
goto err_rxb;
}
/* Allocate URB */ /* Allocate URB */
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (urb == NULL) { if (urb == NULL) {
@ -851,11 +862,14 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev)
goto err_skb; goto err_skb;
} }
rx_buf->hif_dev = hif_dev;
rx_buf->skb = skb;
usb_fill_bulk_urb(urb, hif_dev->udev, usb_fill_bulk_urb(urb, hif_dev->udev,
usb_rcvbulkpipe(hif_dev->udev, usb_rcvbulkpipe(hif_dev->udev,
USB_WLAN_RX_PIPE), USB_WLAN_RX_PIPE),
skb->data, MAX_RX_BUF_SIZE, skb->data, MAX_RX_BUF_SIZE,
ath9k_hif_usb_rx_cb, skb); ath9k_hif_usb_rx_cb, rx_buf);
/* Anchor URB */ /* Anchor URB */
usb_anchor_urb(urb, &hif_dev->rx_submitted); usb_anchor_urb(urb, &hif_dev->rx_submitted);
@ -881,6 +895,8 @@ err_submit:
err_skb: err_skb:
usb_free_urb(urb); usb_free_urb(urb);
err_urb: err_urb:
kfree(rx_buf);
err_rxb:
ath9k_hif_usb_dealloc_rx_urbs(hif_dev); ath9k_hif_usb_dealloc_rx_urbs(hif_dev);
return ret; return ret;
} }
@ -892,14 +908,21 @@ static void ath9k_hif_usb_dealloc_reg_in_urbs(struct hif_device_usb *hif_dev)
static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
{ {
struct urb *urb = NULL; struct rx_buf *rx_buf = NULL;
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct urb *urb = NULL;
int i, ret; int i, ret;
init_usb_anchor(&hif_dev->reg_in_submitted); init_usb_anchor(&hif_dev->reg_in_submitted);
for (i = 0; i < MAX_REG_IN_URB_NUM; i++) { for (i = 0; i < MAX_REG_IN_URB_NUM; i++) {
rx_buf = kzalloc(sizeof(*rx_buf), GFP_KERNEL);
if (!rx_buf) {
ret = -ENOMEM;
goto err_rxb;
}
/* Allocate URB */ /* Allocate URB */
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (urb == NULL) { if (urb == NULL) {
@ -914,11 +937,14 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev)
goto err_skb; goto err_skb;
} }
rx_buf->hif_dev = hif_dev;
rx_buf->skb = skb;
usb_fill_int_urb(urb, hif_dev->udev, usb_fill_int_urb(urb, hif_dev->udev,
usb_rcvintpipe(hif_dev->udev, usb_rcvintpipe(hif_dev->udev,
USB_REG_IN_PIPE), USB_REG_IN_PIPE),
skb->data, MAX_REG_IN_BUF_SIZE, skb->data, MAX_REG_IN_BUF_SIZE,
ath9k_hif_usb_reg_in_cb, skb, 1); ath9k_hif_usb_reg_in_cb, rx_buf, 1);
/* Anchor URB */ /* Anchor URB */
usb_anchor_urb(urb, &hif_dev->reg_in_submitted); usb_anchor_urb(urb, &hif_dev->reg_in_submitted);
@ -944,6 +970,8 @@ err_submit:
err_skb: err_skb:
usb_free_urb(urb); usb_free_urb(urb);
err_urb: err_urb:
kfree(rx_buf);
err_rxb:
ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev); ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev);
return ret; return ret;
} }

View file

@ -84,6 +84,11 @@ struct tx_buf {
struct list_head list; struct list_head list;
}; };
struct rx_buf {
struct sk_buff *skb;
struct hif_device_usb *hif_dev;
};
#define HIF_USB_TX_STOP BIT(0) #define HIF_USB_TX_STOP BIT(0)
#define HIF_USB_TX_FLUSH BIT(1) #define HIF_USB_TX_FLUSH BIT(1)

View file

@ -249,7 +249,7 @@ static const struct amd_pingroup kerncz_groups[] = {
{ {
.name = "uart0", .name = "uart0",
.pins = uart0_pins, .pins = uart0_pins,
.npins = 9, .npins = 5,
}, },
{ {
.name = "uart1", .name = "uart1",

View file

@ -353,7 +353,7 @@ store_spi_transport_##field(struct device *dev, \
struct spi_transport_attrs *tp \ struct spi_transport_attrs *tp \
= (struct spi_transport_attrs *)&starget->starget_data; \ = (struct spi_transport_attrs *)&starget->starget_data; \
\ \
if (i->f->set_##field) \ if (!i->f->set_##field) \
return -EINVAL; \ return -EINVAL; \
val = simple_strtoul(buf, NULL, 0); \ val = simple_strtoul(buf, NULL, 0); \
if (val > tp->max_##field) \ if (val > tp->max_##field) \

View file

@ -115,14 +115,22 @@ static int apci1032_cos_insn_config(struct comedi_device *dev,
unsigned int *data) unsigned int *data)
{ {
struct apci1032_private *devpriv = dev->private; struct apci1032_private *devpriv = dev->private;
unsigned int shift, oldmask; unsigned int shift, oldmask, himask, lomask;
switch (data[0]) { switch (data[0]) {
case INSN_CONFIG_DIGITAL_TRIG: case INSN_CONFIG_DIGITAL_TRIG:
if (data[1] != 0) if (data[1] != 0)
return -EINVAL; return -EINVAL;
shift = data[3]; shift = data[3];
oldmask = (1U << shift) - 1; if (shift < 32) {
oldmask = (1U << shift) - 1;
himask = data[4] << shift;
lomask = data[5] << shift;
} else {
oldmask = 0xffffffffu;
himask = 0;
lomask = 0;
}
switch (data[2]) { switch (data[2]) {
case COMEDI_DIGITAL_TRIG_DISABLE: case COMEDI_DIGITAL_TRIG_DISABLE:
devpriv->ctrl = 0; devpriv->ctrl = 0;
@ -145,8 +153,8 @@ static int apci1032_cos_insn_config(struct comedi_device *dev,
devpriv->mode2 &= oldmask; devpriv->mode2 &= oldmask;
} }
/* configure specified channels */ /* configure specified channels */
devpriv->mode1 |= data[4] << shift; devpriv->mode1 |= himask;
devpriv->mode2 |= data[5] << shift; devpriv->mode2 |= lomask;
break; break;
case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS: case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS:
if (devpriv->ctrl != (APCI1032_CTRL_INT_ENA | if (devpriv->ctrl != (APCI1032_CTRL_INT_ENA |
@ -163,8 +171,8 @@ static int apci1032_cos_insn_config(struct comedi_device *dev,
devpriv->mode2 &= oldmask; devpriv->mode2 &= oldmask;
} }
/* configure specified channels */ /* configure specified channels */
devpriv->mode1 |= data[4] << shift; devpriv->mode1 |= himask;
devpriv->mode2 |= data[5] << shift; devpriv->mode2 |= lomask;
break; break;
default: default:
return -EINVAL; return -EINVAL;

View file

@ -461,13 +461,14 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev,
struct apci1500_private *devpriv = dev->private; struct apci1500_private *devpriv = dev->private;
unsigned int trig = data[1]; unsigned int trig = data[1];
unsigned int shift = data[3]; unsigned int shift = data[3];
unsigned int hi_mask = data[4] << shift; unsigned int hi_mask;
unsigned int lo_mask = data[5] << shift; unsigned int lo_mask;
unsigned int chan_mask = hi_mask | lo_mask; unsigned int chan_mask;
unsigned int old_mask = (1 << shift) - 1; unsigned int old_mask;
unsigned int pm; unsigned int pm;
unsigned int pt; unsigned int pt;
unsigned int pp; unsigned int pp;
unsigned int invalid_chan;
if (trig > 1) { if (trig > 1) {
dev_dbg(dev->class_dev, dev_dbg(dev->class_dev,
@ -475,7 +476,20 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev,
return -EINVAL; return -EINVAL;
} }
if (chan_mask > 0xffff) { if (shift <= 16) {
hi_mask = data[4] << shift;
lo_mask = data[5] << shift;
old_mask = (1U << shift) - 1;
invalid_chan = (data[4] | data[5]) >> (16 - shift);
} else {
hi_mask = 0;
lo_mask = 0;
old_mask = 0xffff;
invalid_chan = data[4] | data[5];
}
chan_mask = hi_mask | lo_mask;
if (invalid_chan) {
dev_dbg(dev->class_dev, "invalid digital trigger channel\n"); dev_dbg(dev->class_dev, "invalid digital trigger channel\n");
return -EINVAL; return -EINVAL;
} }

View file

@ -288,14 +288,22 @@ static int apci1564_cos_insn_config(struct comedi_device *dev,
unsigned int *data) unsigned int *data)
{ {
struct apci1564_private *devpriv = dev->private; struct apci1564_private *devpriv = dev->private;
unsigned int shift, oldmask; unsigned int shift, oldmask, himask, lomask;
switch (data[0]) { switch (data[0]) {
case INSN_CONFIG_DIGITAL_TRIG: case INSN_CONFIG_DIGITAL_TRIG:
if (data[1] != 0) if (data[1] != 0)
return -EINVAL; return -EINVAL;
shift = data[3]; shift = data[3];
oldmask = (1U << shift) - 1; if (shift < 32) {
oldmask = (1U << shift) - 1;
himask = data[4] << shift;
lomask = data[5] << shift;
} else {
oldmask = 0xffffffffu;
himask = 0;
lomask = 0;
}
switch (data[2]) { switch (data[2]) {
case COMEDI_DIGITAL_TRIG_DISABLE: case COMEDI_DIGITAL_TRIG_DISABLE:
devpriv->ctrl = 0; devpriv->ctrl = 0;
@ -319,8 +327,8 @@ static int apci1564_cos_insn_config(struct comedi_device *dev,
devpriv->mode2 &= oldmask; devpriv->mode2 &= oldmask;
} }
/* configure specified channels */ /* configure specified channels */
devpriv->mode1 |= data[4] << shift; devpriv->mode1 |= himask;
devpriv->mode2 |= data[5] << shift; devpriv->mode2 |= lomask;
break; break;
case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS: case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS:
if (devpriv->ctrl != (APCI1564_DI_IRQ_ENA | if (devpriv->ctrl != (APCI1564_DI_IRQ_ENA |
@ -337,8 +345,8 @@ static int apci1564_cos_insn_config(struct comedi_device *dev,
devpriv->mode2 &= oldmask; devpriv->mode2 &= oldmask;
} }
/* configure specified channels */ /* configure specified channels */
devpriv->mode1 |= data[4] << shift; devpriv->mode1 |= himask;
devpriv->mode2 |= data[5] << shift; devpriv->mode2 |= lomask;
break; break;
default: default:
return -EINVAL; return -EINVAL;

View file

@ -341,7 +341,7 @@ static int ni6527_intr_insn_config(struct comedi_device *dev,
case COMEDI_DIGITAL_TRIG_ENABLE_EDGES: case COMEDI_DIGITAL_TRIG_ENABLE_EDGES:
/* check shift amount */ /* check shift amount */
shift = data[3]; shift = data[3];
if (shift >= s->n_chan) { if (shift >= 32) {
mask = 0; mask = 0;
rising = 0; rising = 0;
falling = 0; falling = 0;

View file

@ -60,11 +60,25 @@ static int prism2sta_probe_usb(struct usb_interface *interface,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
struct usb_device *dev; struct usb_device *dev;
const struct usb_endpoint_descriptor *epd;
const struct usb_host_interface *iface_desc = interface->cur_altsetting;
wlandevice_t *wlandev = NULL; wlandevice_t *wlandev = NULL;
hfa384x_t *hw = NULL; hfa384x_t *hw = NULL;
int result = 0; int result = 0;
if (iface_desc->desc.bNumEndpoints != 2) {
result = -ENODEV;
goto failed;
}
result = -EINVAL;
epd = &iface_desc->endpoint[1].desc;
if (!usb_endpoint_is_bulk_in(epd))
goto failed;
epd = &iface_desc->endpoint[2].desc;
if (!usb_endpoint_is_bulk_out(epd))
goto failed;
dev = interface_to_usbdev(interface); dev = interface_to_usbdev(interface);
wlandev = create_wlan(); wlandev = create_wlan();
if (wlandev == NULL) { if (wlandev == NULL) {

View file

@ -530,6 +530,7 @@ static void __init serial8250_isa_init_ports(void)
*/ */
up->mcr_mask = ~ALPHA_KLUDGE_MCR; up->mcr_mask = ~ALPHA_KLUDGE_MCR;
up->mcr_force = ALPHA_KLUDGE_MCR; up->mcr_force = ALPHA_KLUDGE_MCR;
serial8250_set_defaults(up);
} }
/* chain base port ops to support Remote Supervisor Adapter */ /* chain base port ops to support Remote Supervisor Adapter */
@ -553,7 +554,6 @@ static void __init serial8250_isa_init_ports(void)
port->membase = old_serial_port[i].iomem_base; port->membase = old_serial_port[i].iomem_base;
port->iotype = old_serial_port[i].io_type; port->iotype = old_serial_port[i].io_type;
port->regshift = old_serial_port[i].iomem_reg_shift; port->regshift = old_serial_port[i].iomem_reg_shift;
serial8250_set_defaults(up);
port->irqflags |= irqflag; port->irqflags |= irqflag;
if (serial8250_isa_config != NULL) if (serial8250_isa_config != NULL)

View file

@ -47,8 +47,21 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
struct uart_8250_port *up = struct uart_8250_port *up =
container_of(port, struct uart_8250_port, port); container_of(port, struct uart_8250_port, port);
/*
* Store the requested baud rate before calling the generic 8250
* set_termios method. Standard 8250 port expects bauds to be
* no higher than (uartclk / 16) so the baud will be clamped if it
* gets out of that bound. Mediatek 8250 port supports speed
* higher than that, therefore we'll get original baud rate back
* after calling the generic set_termios method and recalculate
* the speed later in this method.
*/
baud = tty_termios_baud_rate(termios);
serial8250_do_set_termios(port, termios, old); serial8250_do_set_termios(port, termios, old);
tty_termios_encode_baud_rate(termios, baud, baud);
/* /*
* Mediatek UARTs use an extra highspeed register (UART_MTK_HIGHS) * Mediatek UARTs use an extra highspeed register (UART_MTK_HIGHS)
* *
@ -91,6 +104,11 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
*/ */
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
/*
* Update the per-port timeout.
*/
uart_update_timeout(port, termios->c_cflag, baud);
/* set DLAB we have cval saved in up->lcr from the call to the core */ /* set DLAB we have cval saved in up->lcr from the call to the core */
serial_port_out(port, UART_LCR, up->lcr | UART_LCR_DLAB); serial_port_out(port, UART_LCR, up->lcr | UART_LCR_DLAB);
serial_dl_write(up, quot); serial_dl_write(up, quot);

View file

@ -2001,9 +2001,12 @@ static int gr_ep_init(struct gr_udc *dev, int num, int is_in, u32 maxplimit)
if (num == 0) { if (num == 0) {
_req = gr_alloc_request(&ep->ep, GFP_ATOMIC); _req = gr_alloc_request(&ep->ep, GFP_ATOMIC);
if (!_req)
return -ENOMEM;
buf = devm_kzalloc(dev->dev, PAGE_SIZE, GFP_DMA | GFP_ATOMIC); buf = devm_kzalloc(dev->dev, PAGE_SIZE, GFP_DMA | GFP_ATOMIC);
if (!_req || !buf) { if (!buf) {
/* possible _req freed by gr_probe via gr_remove */ gr_free_request(&ep->ep, _req);
return -ENOMEM; return -ENOMEM;
} }

View file

@ -1221,6 +1221,7 @@ static int __btrfs_find_all_roots(struct btrfs_trans_handle *trans,
if (ret < 0 && ret != -ENOENT) { if (ret < 0 && ret != -ENOENT) {
ulist_free(tmp); ulist_free(tmp);
ulist_free(*roots); ulist_free(*roots);
*roots = NULL;
return ret; return ret;
} }
node = ulist_next(tmp, &uiter); node = ulist_next(tmp, &uiter);

View file

@ -6693,6 +6693,14 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
mutex_lock(&uuid_mutex); mutex_lock(&uuid_mutex);
lock_chunks(root); lock_chunks(root);
/*
* It is possible for mount and umount to race in such a way that
* we execute this code path, but open_fs_devices failed to clear
* total_rw_bytes. We certainly want it cleared before reading the
* device items, so clear it here.
*/
root->fs_info->fs_devices->total_rw_bytes = 0;
/* /*
* Read all device items, and then all the chunk items. All * Read all device items, and then all the chunk items. All
* device items are found before any chunk item (their object id * device items are found before any chunk item (their object id

View file

@ -1737,7 +1737,6 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
FILE_UNIX_BASIC_INFO *info_buf_target; FILE_UNIX_BASIC_INFO *info_buf_target;
unsigned int xid; unsigned int xid;
int rc, tmprc; int rc, tmprc;
bool new_target = d_really_is_negative(target_dentry);
if (flags & ~RENAME_NOREPLACE) if (flags & ~RENAME_NOREPLACE)
return -EINVAL; return -EINVAL;
@ -1814,13 +1813,8 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry,
*/ */
unlink_target: unlink_target:
/* /* Try unlinking the target dentry if it's not negative */
* If the target dentry was created during the rename, try if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) {
* unlinking it if it's not negative
*/
if (new_target &&
d_really_is_positive(target_dentry) &&
(rc == -EACCES || rc == -EEXIST)) {
if (d_is_dir(target_dentry)) if (d_is_dir(target_dentry))
tmprc = cifs_rmdir(target_dir, target_dentry); tmprc = cifs_rmdir(target_dir, target_dentry);
else else

View file

@ -385,6 +385,8 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
if (write) if (write)
nfs_zap_mapping(inode, inode->i_mapping); nfs_zap_mapping(inode, inode->i_mapping);
inode_dio_end(inode);
if (dreq->iocb) { if (dreq->iocb) {
long res = (long) dreq->error; long res = (long) dreq->error;
if (!res) if (!res)
@ -394,10 +396,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
complete_all(&dreq->completion); complete_all(&dreq->completion);
igrab(inode);
nfs_direct_req_release(dreq); nfs_direct_req_release(dreq);
inode_dio_end(inode);
iput(inode);
} }
static void nfs_direct_readpage_release(struct nfs_page *req) static void nfs_direct_readpage_release(struct nfs_page *req)
@ -538,10 +537,8 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
* generic layer handle the completion. * generic layer handle the completion.
*/ */
if (requested_bytes == 0) { if (requested_bytes == 0) {
igrab(inode);
nfs_direct_req_release(dreq);
inode_dio_end(inode); inode_dio_end(inode);
iput(inode); nfs_direct_req_release(dreq);
return result < 0 ? result : -EIO; return result < 0 ? result : -EIO;
} }
@ -942,10 +939,8 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
* generic layer handle the completion. * generic layer handle the completion.
*/ */
if (requested_bytes == 0) { if (requested_bytes == 0) {
igrab(inode);
nfs_direct_req_release(dreq);
inode_dio_end(inode); inode_dio_end(inode);
iput(inode); nfs_direct_req_release(dreq);
return result < 0 ? result : -EIO; return result < 0 ? result : -EIO;
} }

View file

@ -82,7 +82,6 @@ nfs_file_release(struct inode *inode, struct file *filp)
dprintk("NFS: release(%pD2)\n", filp); dprintk("NFS: release(%pD2)\n", filp);
nfs_inc_stats(inode, NFSIOS_VFSRELEASE); nfs_inc_stats(inode, NFSIOS_VFSRELEASE);
inode_dio_wait(inode);
nfs_file_clear_open_context(filp); nfs_file_clear_open_context(filp);
return 0; return 0;
} }

View file

@ -793,6 +793,8 @@ xfs_bmap_extents_to_btree(
*logflagsp = 0; *logflagsp = 0;
if ((error = xfs_alloc_vextent(&args))) { if ((error = xfs_alloc_vextent(&args))) {
xfs_iroot_realloc(ip, -1, whichfork); xfs_iroot_realloc(ip, -1, whichfork);
ASSERT(ifp->if_broot == NULL);
XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS);
xfs_btree_del_cursor(cur, XFS_BTREE_ERROR); xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
return error; return error;
} }

View file

@ -211,7 +211,8 @@ struct tcp_sock {
u8 reord; /* reordering detected */ u8 reord; /* reordering detected */
} rack; } rack;
u16 advmss; /* Advertised MSS */ u16 advmss; /* Advertised MSS */
u8 unused; u8 tlp_retrans:1, /* TLP is a retransmission */
unused_1:7;
u8 nonagle : 4,/* Disable Nagle algorithm? */ u8 nonagle : 4,/* Disable Nagle algorithm? */
thin_lto : 1,/* Use linear timeouts for thin streams */ thin_lto : 1,/* Use linear timeouts for thin streams */
thin_dupack : 1,/* Fast retransmit on first dupack */ thin_dupack : 1,/* Fast retransmit on first dupack */
@ -225,7 +226,7 @@ struct tcp_sock {
syn_data_acked:1,/* data in SYN is acked by SYN-ACK */ syn_data_acked:1,/* data in SYN is acked by SYN-ACK */
save_syn:1, /* Save headers of SYN packet */ save_syn:1, /* Save headers of SYN packet */
is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */ is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */
u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ u32 tlp_high_seq; /* snd_nxt at the time of TLP */
/* RTT measurement */ /* RTT measurement */
u32 srtt_us; /* smoothed round trip time << 3 in usecs */ u32 srtt_us; /* smoothed round trip time << 3 in usecs */

View file

@ -4036,7 +4036,9 @@ EXPORT_SYMBOL_GPL(perf_event_read_value);
static int __perf_read_group_add(struct perf_event *leader, static int __perf_read_group_add(struct perf_event *leader,
u64 read_format, u64 *values) u64 read_format, u64 *values)
{ {
struct perf_event_context *ctx = leader->ctx;
struct perf_event *sub; struct perf_event *sub;
unsigned long flags;
int n = 1; /* skip @nr */ int n = 1; /* skip @nr */
int ret; int ret;
@ -4066,12 +4068,15 @@ static int __perf_read_group_add(struct perf_event *leader,
if (read_format & PERF_FORMAT_ID) if (read_format & PERF_FORMAT_ID)
values[n++] = primary_event_id(leader); values[n++] = primary_event_id(leader);
raw_spin_lock_irqsave(&ctx->lock, flags);
list_for_each_entry(sub, &leader->sibling_list, group_entry) { list_for_each_entry(sub, &leader->sibling_list, group_entry) {
values[n++] += perf_event_count(sub); values[n++] += perf_event_count(sub);
if (read_format & PERF_FORMAT_ID) if (read_format & PERF_FORMAT_ID)
values[n++] = primary_event_id(sub); values[n++] = primary_event_id(sub);
} }
raw_spin_unlock_irqrestore(&ctx->lock, flags);
return 0; return 0;
} }

View file

@ -1874,7 +1874,7 @@ static void handle_swbp(struct pt_regs *regs)
if (!uprobe) { if (!uprobe) {
if (is_swbp > 0) { if (is_swbp > 0) {
/* No matching uprobe; signal SIGTRAP. */ /* No matching uprobe; signal SIGTRAP. */
send_sig(SIGTRAP, current, 0); force_sig(SIGTRAP, current);
} else { } else {
/* /*
* Either we raced with uprobe_unregister() or we can't * Either we raced with uprobe_unregister() or we can't

View file

@ -4889,7 +4889,6 @@ static void __mem_cgroup_clear_mc(void)
if (!mem_cgroup_is_root(mc.to)) if (!mem_cgroup_is_root(mc.to))
page_counter_uncharge(&mc.to->memory, mc.moved_swap); page_counter_uncharge(&mc.to->memory, mc.moved_swap);
mem_cgroup_id_get_many(mc.to, mc.moved_swap);
css_put_many(&mc.to->css, mc.moved_swap); css_put_many(&mc.to->css, mc.moved_swap);
mc.moved_swap = 0; mc.moved_swap = 0;
@ -5067,7 +5066,8 @@ put: /* get_mctgt_type() gets the page */
ent = target.ent; ent = target.ent;
if (!mem_cgroup_move_swap_account(ent, mc.from, mc.to)) { if (!mem_cgroup_move_swap_account(ent, mc.from, mc.to)) {
mc.precharge--; mc.precharge--;
/* we fixup refcnts and charges later. */ mem_cgroup_id_get_many(mc.to, 1);
/* we fixup other refcnts and charges later. */
mc.moved_swap++; mc.moved_swap++;
} }
break; break;

View file

@ -1191,7 +1191,10 @@ static int __must_check ax25_connect(struct socket *sock,
if (addr_len > sizeof(struct sockaddr_ax25) && if (addr_len > sizeof(struct sockaddr_ax25) &&
fsa->fsa_ax25.sax25_ndigis != 0) { fsa->fsa_ax25.sax25_ndigis != 0) {
/* Valid number of digipeaters ? */ /* Valid number of digipeaters ? */
if (fsa->fsa_ax25.sax25_ndigis < 1 || fsa->fsa_ax25.sax25_ndigis > AX25_MAX_DIGIS) { if (fsa->fsa_ax25.sax25_ndigis < 1 ||
fsa->fsa_ax25.sax25_ndigis > AX25_MAX_DIGIS ||
addr_len < sizeof(struct sockaddr_ax25) +
sizeof(ax25_address) * fsa->fsa_ax25.sax25_ndigis) {
err = -EINVAL; err = -EINVAL;
goto out_release; goto out_release;
} }
@ -1510,7 +1513,10 @@ static int ax25_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
struct full_sockaddr_ax25 *fsa = (struct full_sockaddr_ax25 *)usax; struct full_sockaddr_ax25 *fsa = (struct full_sockaddr_ax25 *)usax;
/* Valid number of digipeaters ? */ /* Valid number of digipeaters ? */
if (usax->sax25_ndigis < 1 || usax->sax25_ndigis > AX25_MAX_DIGIS) { if (usax->sax25_ndigis < 1 ||
usax->sax25_ndigis > AX25_MAX_DIGIS ||
addr_len < sizeof(struct sockaddr_ax25) +
sizeof(ax25_address) * usax->sax25_ndigis) {
err = -EINVAL; err = -EINVAL;
goto out; goto out;
} }

View file

@ -999,7 +999,7 @@ static ssize_t show_trans_timeout(struct netdev_queue *queue,
trans_timeout = queue->trans_timeout; trans_timeout = queue->trans_timeout;
spin_unlock_irq(&queue->_xmit_lock); spin_unlock_irq(&queue->_xmit_lock);
return sprintf(buf, "%lu", trans_timeout); return sprintf(buf, fmt_ulong, trans_timeout);
} }
#ifdef CONFIG_XPS #ifdef CONFIG_XPS

View file

@ -3518,10 +3518,8 @@ static void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq)
} }
} }
/* This routine deals with acks during a TLP episode. /* This routine deals with acks during a TLP episode and ends an episode by
* We mark the end of a TLP episode on receiving TLP dupack or when * resetting tlp_high_seq. Ref: TLP algorithm in draft-ietf-tcpm-rack
* ack is after tlp_high_seq.
* Ref: loss detection algorithm in draft-dukkipati-tcpm-tcp-loss-probe.
*/ */
static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag) static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag)
{ {
@ -3530,7 +3528,10 @@ static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag)
if (before(ack, tp->tlp_high_seq)) if (before(ack, tp->tlp_high_seq))
return; return;
if (flag & FLAG_DSACKING_ACK) { if (!tp->tlp_retrans) {
/* TLP of new data has been acknowledged */
tp->tlp_high_seq = 0;
} else if (flag & FLAG_DSACKING_ACK) {
/* This DSACK means original and TLP probe arrived; no loss */ /* This DSACK means original and TLP probe arrived; no loss */
tp->tlp_high_seq = 0; tp->tlp_high_seq = 0;
} else if (after(ack, tp->tlp_high_seq)) { } else if (after(ack, tp->tlp_high_seq)) {

View file

@ -2271,6 +2271,11 @@ void tcp_send_loss_probe(struct sock *sk)
int pcount; int pcount;
int mss = tcp_current_mss(sk); int mss = tcp_current_mss(sk);
/* At most one outstanding TLP */
if (tp->tlp_high_seq)
goto rearm_timer;
tp->tlp_retrans = 0;
skb = tcp_send_head(sk); skb = tcp_send_head(sk);
if (skb) { if (skb) {
if (tcp_snd_wnd_test(tp, skb, mss)) { if (tcp_snd_wnd_test(tp, skb, mss)) {
@ -2293,10 +2298,6 @@ void tcp_send_loss_probe(struct sock *sk)
return; return;
} }
/* At most one outstanding TLP retransmission. */
if (tp->tlp_high_seq)
goto rearm_timer;
if (skb_still_in_host_queue(sk, skb)) if (skb_still_in_host_queue(sk, skb))
goto rearm_timer; goto rearm_timer;
@ -2317,10 +2318,12 @@ void tcp_send_loss_probe(struct sock *sk)
if (__tcp_retransmit_skb(sk, skb)) if (__tcp_retransmit_skb(sk, skb))
goto rearm_timer; goto rearm_timer;
tp->tlp_retrans = 1;
probe_sent:
/* Record snd_nxt for loss detection. */ /* Record snd_nxt for loss detection. */
tp->tlp_high_seq = tp->snd_nxt; tp->tlp_high_seq = tp->snd_nxt;
probe_sent:
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPLOSSPROBES); NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPLOSSPROBES);
/* Reset s.t. tcp_rearm_rto will restart timer from now */ /* Reset s.t. tcp_rearm_rto will restart timer from now */
inet_csk(sk)->icsk_pending = 0; inet_csk(sk)->icsk_pending = 0;

View file

@ -1564,7 +1564,7 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
/* /*
* UDP-Lite specific tests, ignored on UDP sockets * UDP-Lite specific tests, ignored on UDP sockets
*/ */
if ((is_udplite & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) { if ((up->pcflag & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {
/* /*
* MIB statistics other than incrementing the error count are * MIB statistics other than incrementing the error count are

View file

@ -1359,15 +1359,16 @@ static void ip6gre_destroy_tunnels(struct net *net, struct list_head *head)
static int __net_init ip6gre_init_net(struct net *net) static int __net_init ip6gre_init_net(struct net *net)
{ {
struct ip6gre_net *ign = net_generic(net, ip6gre_net_id); struct ip6gre_net *ign = net_generic(net, ip6gre_net_id);
struct net_device *ndev;
int err; int err;
ign->fb_tunnel_dev = alloc_netdev(sizeof(struct ip6_tnl), "ip6gre0", ndev = alloc_netdev(sizeof(struct ip6_tnl), "ip6gre0",
NET_NAME_UNKNOWN, NET_NAME_UNKNOWN, ip6gre_tunnel_setup);
ip6gre_tunnel_setup); if (!ndev) {
if (!ign->fb_tunnel_dev) {
err = -ENOMEM; err = -ENOMEM;
goto err_alloc_dev; goto err_alloc_dev;
} }
ign->fb_tunnel_dev = ndev;
dev_net_set(ign->fb_tunnel_dev, net); dev_net_set(ign->fb_tunnel_dev, net);
/* FB netdevice is special: we have one, and only one per netns. /* FB netdevice is special: we have one, and only one per netns.
* Allowing to move it to another netns is clearly unsafe. * Allowing to move it to another netns is clearly unsafe.
@ -1387,7 +1388,7 @@ static int __net_init ip6gre_init_net(struct net *net)
return 0; return 0;
err_reg_dev: err_reg_dev:
ip6gre_dev_free(ign->fb_tunnel_dev); ip6gre_dev_free(ndev);
err_alloc_dev: err_alloc_dev:
return err; return err;
} }

View file

@ -673,7 +673,7 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
/* /*
* UDP-Lite specific tests, ignored on UDP sockets (see net/ipv4/udp.c). * UDP-Lite specific tests, ignored on UDP sockets (see net/ipv4/udp.c).
*/ */
if ((is_udplite & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) { if ((up->pcflag & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {
if (up->pcrlen == 0) { /* full coverage was set */ if (up->pcrlen == 0) { /* full coverage was set */
net_dbg_ratelimited("UDPLITE6: partial coverage %d while full coverage %d requested\n", net_dbg_ratelimited("UDPLITE6: partial coverage %d while full coverage %d requested\n",

View file

@ -1964,6 +1964,7 @@ static int ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx)
static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc) static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc)
{ {
struct ieee80211_hdr *hdr = (void *)rx->skb->data;
struct sk_buff *skb = rx->skb; struct sk_buff *skb = rx->skb;
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
@ -1974,6 +1975,31 @@ static int ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc)
if (status->flag & RX_FLAG_DECRYPTED) if (status->flag & RX_FLAG_DECRYPTED)
return 0; return 0;
/* check mesh EAPOL frames first */
if (unlikely(rx->sta && ieee80211_vif_is_mesh(&rx->sdata->vif) &&
ieee80211_is_data(fc))) {
struct ieee80211s_hdr *mesh_hdr;
u16 hdr_len = ieee80211_hdrlen(fc);
u16 ethertype_offset;
__be16 ethertype;
if (!ether_addr_equal(hdr->addr1, rx->sdata->vif.addr))
goto drop_check;
/* make sure fixed part of mesh header is there, also checks skb len */
if (!pskb_may_pull(rx->skb, hdr_len + 6))
goto drop_check;
mesh_hdr = (struct ieee80211s_hdr *)(skb->data + hdr_len);
ethertype_offset = hdr_len + ieee80211_get_mesh_hdrlen(mesh_hdr) +
sizeof(rfc1042_header);
if (skb_copy_bits(rx->skb, ethertype_offset, &ethertype, 2) == 0 &&
ethertype == rx->sdata->control_port_protocol)
return 0;
}
drop_check:
/* Drop unencrypted frames if key is set. */ /* Drop unencrypted frames if key is set. */
if (unlikely(!ieee80211_has_protected(fc) && if (unlikely(!ieee80211_has_protected(fc) &&
!ieee80211_is_any_nullfunc(fc) && !ieee80211_is_any_nullfunc(fc) &&

View file

@ -533,7 +533,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
/* this should be in poll */ /* this should be in poll */
sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk); sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk);
if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN)) if (sk->sk_shutdown & SEND_SHUTDOWN)
return -EPIPE; return -EPIPE;
more = msg->msg_flags & MSG_MORE; more = msg->msg_flags & MSG_MORE;

View file

@ -78,7 +78,7 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
release_sock(&rx->sk); release_sock(&rx->sk);
if (continue_call) if (continue_call)
rxrpc_put_call(continue_call); rxrpc_put_call(continue_call);
return -ENODATA; return -EAGAIN;
} }
} }

View file

@ -63,8 +63,8 @@ parse_symbol() {
return return
fi fi
# Strip out the base of the path # Strip out the base of the path on each line
code=${code#$basepath/} code=$(while read -r line; do echo "${line#$basepath/}"; done <<< "$code")
# In the case of inlines, move everything to same line # In the case of inlines, move everything to same line
code=${code//$'\n'/' '} code=${code//$'\n'/' '}

View file

@ -664,7 +664,9 @@ int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len)
{ {
int c = -1; int c = -1;
if (snd_BUG_ON(!buffer || !buffer->buffer)) if (snd_BUG_ON(!buffer))
return 1;
if (!buffer->buffer)
return 1; return 1;
if (len <= 0 || buffer->stop || buffer->error) if (len <= 0 || buffer->stop || buffer->error)
return 1; return 1;

View file

@ -760,7 +760,7 @@
#define RT5670_PWR_VREF2_BIT 4 #define RT5670_PWR_VREF2_BIT 4
#define RT5670_PWR_FV2 (0x1 << 3) #define RT5670_PWR_FV2 (0x1 << 3)
#define RT5670_PWR_FV2_BIT 3 #define RT5670_PWR_FV2_BIT 3
#define RT5670_LDO_SEL_MASK (0x3) #define RT5670_LDO_SEL_MASK (0x7)
#define RT5670_LDO_SEL_SFT 0 #define RT5670_LDO_SEL_SFT 0
/* Power Management for Analog 2 (0x64) */ /* Power Management for Analog 2 (0x64) */

View file

@ -1246,7 +1246,7 @@ static int is_directory(const char *base_path, const struct dirent *dent)
char path[PATH_MAX]; char path[PATH_MAX];
struct stat st; struct stat st;
sprintf(path, "%s/%s", base_path, dent->d_name); scnprintf(path, PATH_MAX, "%s/%s", base_path, dent->d_name);
if (stat(path, &st)) if (stat(path, &st))
return 0; return 0;
@ -1427,8 +1427,8 @@ static int list_available_scripts(const struct option *opt __maybe_unused,
return -1; return -1;
for_each_lang(scripts_path, scripts_dir, lang_dirent) { for_each_lang(scripts_path, scripts_dir, lang_dirent) {
snprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path, scnprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path,
lang_dirent->d_name); lang_dirent->d_name);
lang_dir = opendir(lang_path); lang_dir = opendir(lang_path);
if (!lang_dir) if (!lang_dir)
continue; continue;
@ -1437,8 +1437,8 @@ static int list_available_scripts(const struct option *opt __maybe_unused,
script_root = get_script_root(script_dirent, REPORT_SUFFIX); script_root = get_script_root(script_dirent, REPORT_SUFFIX);
if (script_root) { if (script_root) {
desc = script_desc__findnew(script_root); desc = script_desc__findnew(script_root);
snprintf(script_path, MAXPATHLEN, "%s/%s", scnprintf(script_path, MAXPATHLEN, "%s/%s",
lang_path, script_dirent->d_name); lang_path, script_dirent->d_name);
read_script_info(desc, script_path); read_script_info(desc, script_path);
free(script_root); free(script_root);
} }
@ -1474,7 +1474,7 @@ static int check_ev_match(char *dir_name, char *scriptname,
int match, len; int match, len;
FILE *fp; FILE *fp;
sprintf(filename, "%s/bin/%s-record", dir_name, scriptname); scnprintf(filename, MAXPATHLEN, "%s/bin/%s-record", dir_name, scriptname);
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (!fp) if (!fp)
@ -1550,8 +1550,8 @@ int find_scripts(char **scripts_array, char **scripts_path_array)
} }
for_each_lang(scripts_path, scripts_dir, lang_dirent) { for_each_lang(scripts_path, scripts_dir, lang_dirent) {
snprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path, scnprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path,
lang_dirent->d_name); lang_dirent->d_name);
#ifdef NO_LIBPERL #ifdef NO_LIBPERL
if (strstr(lang_path, "perl")) if (strstr(lang_path, "perl"))
continue; continue;
@ -1606,8 +1606,8 @@ static char *get_script_path(const char *script_root, const char *suffix)
return NULL; return NULL;
for_each_lang(scripts_path, scripts_dir, lang_dirent) { for_each_lang(scripts_path, scripts_dir, lang_dirent) {
snprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path, scnprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path,
lang_dirent->d_name); lang_dirent->d_name);
lang_dir = opendir(lang_path); lang_dir = opendir(lang_path);
if (!lang_dir) if (!lang_dir)
continue; continue;
@ -1618,8 +1618,8 @@ static char *get_script_path(const char *script_root, const char *suffix)
free(__script_root); free(__script_root);
closedir(lang_dir); closedir(lang_dir);
closedir(scripts_dir); closedir(scripts_dir);
snprintf(script_path, MAXPATHLEN, "%s/%s", scnprintf(script_path, MAXPATHLEN, "%s/%s",
lang_path, script_dirent->d_name); lang_path, script_dirent->d_name);
return strdup(script_path); return strdup(script_path);
} }
free(__script_root); free(__script_root);

View file

@ -147,8 +147,8 @@ static int run_dir(const char *d, const char *perf)
if (verbose) if (verbose)
vcnt++; vcnt++;
snprintf(cmd, 3*PATH_MAX, PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s", scnprintf(cmd, 3*PATH_MAX, PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s",
d, d, perf, vcnt, v); d, d, perf, vcnt, v);
return system(cmd) ? TEST_FAIL : TEST_OK; return system(cmd) ? TEST_FAIL : TEST_OK;
} }

View file

@ -95,7 +95,7 @@ static char *test_format_dir_get(void)
struct test_format *format = &test_formats[i]; struct test_format *format = &test_formats[i];
FILE *file; FILE *file;
snprintf(name, PATH_MAX, "%s/%s", dir, format->name); scnprintf(name, PATH_MAX, "%s/%s", dir, format->name);
file = fopen(name, "w"); file = fopen(name, "w");
if (!file) if (!file)

View file

@ -1077,7 +1077,7 @@ int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize)
struct dso *dso = map->dso; struct dso *dso = map->dso;
char *filename = dso__build_id_filename(dso, NULL, 0); char *filename = dso__build_id_filename(dso, NULL, 0);
bool free_filename = true; bool free_filename = true;
char command[PATH_MAX * 2]; char *command;
FILE *file; FILE *file;
int err = 0; int err = 0;
char symfs_filename[PATH_MAX]; char symfs_filename[PATH_MAX];
@ -1192,7 +1192,7 @@ fallback:
strcpy(symfs_filename, tmp); strcpy(symfs_filename, tmp);
} }
snprintf(command, sizeof(command), err = asprintf(&command,
"%s %s%s --start-address=0x%016" PRIx64 "%s %s%s --start-address=0x%016" PRIx64
" --stop-address=0x%016" PRIx64 " --stop-address=0x%016" PRIx64
" -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand", " -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand",
@ -1205,6 +1205,11 @@ fallback:
symbol_conf.annotate_src ? "-S" : "", symbol_conf.annotate_src ? "-S" : "",
symfs_filename, filename); symfs_filename, filename);
if (err < 0) {
pr_err("Failure allocating memory for the command to run\n");
goto out_remove_tmp;
}
pr_debug("Executing: %s\n", command); pr_debug("Executing: %s\n", command);
file = popen(command, "r"); file = popen(command, "r");
@ -1214,7 +1219,7 @@ fallback:
* If we were using debug info should retry with * If we were using debug info should retry with
* original binary. * original binary.
*/ */
goto out_remove_tmp; goto out_free_command;
} }
nline = 0; nline = 0;
@ -1237,6 +1242,9 @@ fallback:
pclose(file); pclose(file);
out_free_command:
free(command);
out_remove_tmp: out_remove_tmp:
if (dso__needs_decompress(dso)) if (dso__needs_decompress(dso))
unlink(symfs_filename); unlink(symfs_filename);

View file

@ -64,7 +64,7 @@ static int open_cgroup(char *name)
if (cgroupfs_find_mountpoint(mnt, PATH_MAX + 1)) if (cgroupfs_find_mountpoint(mnt, PATH_MAX + 1))
return -1; return -1;
snprintf(path, PATH_MAX, "%s/%s", mnt, name); scnprintf(path, PATH_MAX, "%s/%s", mnt, name);
fd = open(path, O_RDONLY); fd = open(path, O_RDONLY);
if (fd == -1) if (fd == -1)

View file

@ -16,10 +16,13 @@ static void pager_preexec(void)
* have real input * have real input
*/ */
fd_set in; fd_set in;
fd_set exception;
FD_ZERO(&in); FD_ZERO(&in);
FD_ZERO(&exception);
FD_SET(0, &in); FD_SET(0, &in);
select(1, &in, NULL, &in, NULL); FD_SET(0, &exception);
select(1, &in, NULL, &exception, NULL);
setenv("LESS", "FRSX", 0); setenv("LESS", "FRSX", 0);
} }

View file

@ -194,8 +194,8 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config)
for_each_event(sys_dirent, evt_dir, evt_dirent) { for_each_event(sys_dirent, evt_dir, evt_dirent) {
snprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path, scnprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path,
evt_dirent->d_name); evt_dirent->d_name);
fd = open(evt_path, O_RDONLY); fd = open(evt_path, O_RDONLY);
if (fd < 0) if (fd < 0)
continue; continue;

View file

@ -302,7 +302,7 @@ static int pmu_aliases_parse(char *dir, struct list_head *head)
if (pmu_alias_info_file(name)) if (pmu_alias_info_file(name))
continue; continue;
snprintf(path, PATH_MAX, "%s/%s", dir, name); scnprintf(path, PATH_MAX, "%s/%s", dir, name);
file = fopen(path, "r"); file = fopen(path, "r");
if (!file) { if (!file) {

View file

@ -122,7 +122,7 @@ static struct symbol *__find_kernel_function(u64 addr, struct map **mapp)
return machine__find_kernel_function(host_machine, addr, mapp, NULL); return machine__find_kernel_function(host_machine, addr, mapp, NULL);
} }
static struct ref_reloc_sym *kernel_get_ref_reloc_sym(void) static struct ref_reloc_sym *kernel_get_ref_reloc_sym(struct map **pmap)
{ {
/* kmap->ref_reloc_sym should be set if host_machine is initialized */ /* kmap->ref_reloc_sym should be set if host_machine is initialized */
struct kmap *kmap; struct kmap *kmap;
@ -134,6 +134,10 @@ static struct ref_reloc_sym *kernel_get_ref_reloc_sym(void)
kmap = map__kmap(map); kmap = map__kmap(map);
if (!kmap) if (!kmap)
return NULL; return NULL;
if (pmap)
*pmap = map;
return kmap->ref_reloc_sym; return kmap->ref_reloc_sym;
} }
@ -145,7 +149,7 @@ static int kernel_get_symbol_address_by_name(const char *name, u64 *addr,
struct map *map; struct map *map;
/* ref_reloc_sym is just a label. Need a special fix*/ /* ref_reloc_sym is just a label. Need a special fix*/
reloc_sym = kernel_get_ref_reloc_sym(); reloc_sym = kernel_get_ref_reloc_sym(NULL);
if (reloc_sym && strcmp(name, reloc_sym->name) == 0) if (reloc_sym && strcmp(name, reloc_sym->name) == 0)
*addr = (reloc) ? reloc_sym->addr : reloc_sym->unrelocated_addr; *addr = (reloc) ? reloc_sym->addr : reloc_sym->unrelocated_addr;
else { else {
@ -618,6 +622,7 @@ static int post_process_probe_trace_events(struct probe_trace_event *tevs,
bool uprobe) bool uprobe)
{ {
struct ref_reloc_sym *reloc_sym; struct ref_reloc_sym *reloc_sym;
struct map *map;
char *tmp; char *tmp;
int i, skipped = 0; int i, skipped = 0;
@ -628,7 +633,7 @@ static int post_process_probe_trace_events(struct probe_trace_event *tevs,
if (module) if (module)
return add_module_to_probe_trace_events(tevs, ntevs, module); return add_module_to_probe_trace_events(tevs, ntevs, module);
reloc_sym = kernel_get_ref_reloc_sym(); reloc_sym = kernel_get_ref_reloc_sym(&map);
if (!reloc_sym) { if (!reloc_sym) {
pr_warning("Relocated base symbol is not found!\n"); pr_warning("Relocated base symbol is not found!\n");
return -EINVAL; return -EINVAL;
@ -637,9 +642,13 @@ static int post_process_probe_trace_events(struct probe_trace_event *tevs,
for (i = 0; i < ntevs; i++) { for (i = 0; i < ntevs; i++) {
if (!tevs[i].point.address || tevs[i].point.retprobe) if (!tevs[i].point.address || tevs[i].point.retprobe)
continue; continue;
/* If we found a wrong one, mark it by NULL symbol */ /*
* If we found a wrong one, mark it by NULL symbol.
* Since addresses in debuginfo is same as objdump, we need
* to convert it to addresses on memory.
*/
if (kprobe_warn_out_range(tevs[i].point.symbol, if (kprobe_warn_out_range(tevs[i].point.symbol,
tevs[i].point.address)) { map__objdump_2mem(map, tevs[i].point.address))) {
tmp = NULL; tmp = NULL;
skipped++; skipped++;
} else { } else {
@ -2553,7 +2562,7 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev,
/* Note that the symbols in the kmodule are not relocated */ /* Note that the symbols in the kmodule are not relocated */
if (!pev->uprobes && !pp->retprobe && !pev->target) { if (!pev->uprobes && !pp->retprobe && !pev->target) {
reloc_sym = kernel_get_ref_reloc_sym(); reloc_sym = kernel_get_ref_reloc_sym(NULL);
if (!reloc_sym) { if (!reloc_sym) {
pr_warning("Relocated base symbol is not found!\n"); pr_warning("Relocated base symbol is not found!\n");
ret = -EINVAL; ret = -EINVAL;

View file

@ -86,16 +86,30 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data)
bfd_vma pc, vma; bfd_vma pc, vma;
bfd_size_type size; bfd_size_type size;
struct a2l_data *a2l = data; struct a2l_data *a2l = data;
flagword flags;
if (a2l->found) if (a2l->found)
return; return;
if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0) #ifdef bfd_get_section_flags
flags = bfd_get_section_flags(abfd, section);
#else
flags = bfd_section_flags(section);
#endif
if ((flags & SEC_ALLOC) == 0)
return; return;
pc = a2l->addr; pc = a2l->addr;
#ifdef bfd_get_section_vma
vma = bfd_get_section_vma(abfd, section); vma = bfd_get_section_vma(abfd, section);
#else
vma = bfd_section_vma(section);
#endif
#ifdef bfd_get_section_size
size = bfd_get_section_size(section); size = bfd_get_section_size(section);
#else
size = bfd_section_size(section);
#endif
if (pc < vma || pc >= vma + size) if (pc < vma || pc >= vma + size)
return; return;