Skip to content

Commit

Permalink
Merge tag 'v4.9.65' into linux-4.9.x-unofficial_grsec
Browse files Browse the repository at this point in the history
This is the 4.9.65 stable release
  • Loading branch information
minipli committed Nov 24, 2017
2 parents 963c044 + 133e6cc commit 74ff6e0
Show file tree
Hide file tree
Showing 28 changed files with 107 additions and 68 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION = 4
PATCHLEVEL = 9
SUBLEVEL = 64
SUBLEVEL = 65
EXTRAVERSION =
NAME = Roaring Lionus

Expand Down
34 changes: 15 additions & 19 deletions crypto/dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,12 @@ struct dh_ctx {
MPI xa;
};

static inline void dh_clear_params(struct dh_ctx *ctx)
static void dh_clear_ctx(struct dh_ctx *ctx)
{
mpi_free(ctx->p);
mpi_free(ctx->g);
ctx->p = NULL;
ctx->g = NULL;
}

static void dh_free_ctx(struct dh_ctx *ctx)
{
dh_clear_params(ctx);
mpi_free(ctx->xa);
ctx->xa = NULL;
memset(ctx, 0, sizeof(*ctx));
}

/*
Expand Down Expand Up @@ -71,10 +64,8 @@ static int dh_set_params(struct dh_ctx *ctx, struct dh *params)
return -EINVAL;

ctx->g = mpi_read_raw_data(params->g, params->g_size);
if (!ctx->g) {
mpi_free(ctx->p);
if (!ctx->g)
return -EINVAL;
}

return 0;
}
Expand All @@ -84,19 +75,24 @@ static int dh_set_secret(struct crypto_kpp *tfm, void *buf, unsigned int len)
struct dh_ctx *ctx = dh_get_ctx(tfm);
struct dh params;

/* Free the old MPI key if any */
dh_clear_ctx(ctx);

if (crypto_dh_decode_key(buf, len, &params) < 0)
return -EINVAL;
goto err_clear_ctx;

if (dh_set_params(ctx, &params) < 0)
return -EINVAL;
goto err_clear_ctx;

ctx->xa = mpi_read_raw_data(params.key, params.key_size);
if (!ctx->xa) {
dh_clear_params(ctx);
return -EINVAL;
}
if (!ctx->xa)
goto err_clear_ctx;

return 0;

err_clear_ctx:
dh_clear_ctx(ctx);
return -EINVAL;
}

static int dh_compute_value(struct kpp_request *req)
Expand Down Expand Up @@ -154,7 +150,7 @@ static void dh_exit_tfm(struct crypto_kpp *tfm)
{
struct dh_ctx *ctx = dh_get_ctx(tfm);

dh_free_ctx(ctx);
dh_clear_ctx(ctx);
}

static struct kpp_alg dh = {
Expand Down
10 changes: 6 additions & 4 deletions drivers/char/ipmi/ipmi_msghandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -4029,7 +4029,8 @@ smi_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg,
}

static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent,
struct list_head *timeouts, long timeout_period,
struct list_head *timeouts,
unsigned long timeout_period,
int slot, unsigned long *flags,
unsigned int *waiting_msgs)
{
Expand All @@ -4042,8 +4043,8 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent,
if (!ent->inuse)
return;

ent->timeout -= timeout_period;
if (ent->timeout > 0) {
if (timeout_period < ent->timeout) {
ent->timeout -= timeout_period;
(*waiting_msgs)++;
return;
}
Expand Down Expand Up @@ -4109,7 +4110,8 @@ static void check_msg_timeout(ipmi_smi_t intf, struct seq_table *ent,
}
}

static unsigned int ipmi_timeout_handler(ipmi_smi_t intf, long timeout_period)
static unsigned int ipmi_timeout_handler(ipmi_smi_t intf,
unsigned long timeout_period)
{
struct list_head timeouts;
struct ipmi_recv_msg *msg, *msg2;
Expand Down
1 change: 1 addition & 0 deletions drivers/dma/dmatest.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ static int dmatest_func(void *data)
* free it this time?" dancing. For now, just
* leave it dangling.
*/
WARN(1, "dmatest: Kernel stack may be corrupted!!\n");
dmaengine_unmap_put(um);
result("test timed out", total_tests, src_off, dst_off,
len, 0);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3217,7 +3217,7 @@ u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb)
hash ^= (hash >> 16);
hash ^= (hash >> 8);

return hash;
return hash >> 1;
}

/*-------------------------- Device entry points ----------------------------*/
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/fealnx.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ enum rx_desc_status_bits {
RXFSD = 0x00000800, /* first descriptor */
RXLSD = 0x00000400, /* last descriptor */
ErrorSummary = 0x80, /* error summary */
RUNT = 0x40, /* runt packet received */
LONG = 0x20, /* long packet received */
RUNTPKT = 0x40, /* runt packet received */
LONGPKT = 0x20, /* long packet received */
FAE = 0x10, /* frame align error */
CRC = 0x08, /* crc error */
RXER = 0x04, /* receive error */
Expand Down Expand Up @@ -1633,7 +1633,7 @@ static int netdev_rx(struct net_device *dev)
dev->name, rx_status);

dev->stats.rx_errors++; /* end of a packet. */
if (rx_status & (LONG | RUNT))
if (rx_status & (LONGPKT | RUNTPKT))
dev->stats.rx_length_errors++;
if (rx_status & RXER)
dev->stats.rx_frame_errors++;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/usb/asix_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ static int asix_suspend(struct usb_interface *intf, pm_message_t message)
struct usbnet *dev = usb_get_intfdata(intf);
struct asix_common_private *priv = dev->driver_priv;

if (priv->suspend)
if (priv && priv->suspend)
priv->suspend(dev);

return usbnet_suspend(intf, message);
Expand Down Expand Up @@ -676,7 +676,7 @@ static int asix_resume(struct usb_interface *intf)
struct usbnet *dev = usb_get_intfdata(intf);
struct asix_common_private *priv = dev->driver_priv;

if (priv->resume)
if (priv && priv->resume)
priv->resume(dev);

return usbnet_resume(intf);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/usb/cdc_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
goto bad_desc;
}

if (header.usb_cdc_ether_desc) {
if (header.usb_cdc_ether_desc && info->ether->wMaxSegmentSize) {
dev->hard_mtu = le16_to_cpu(info->ether->wMaxSegmentSize);
/* because of Zaurus, we may be ignoring the host
* side link address we were given.
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/usb/qmi_wwan.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
return 1;
}
if (rawip) {
skb_reset_mac_header(skb);
skb->dev = dev->net; /* normally set by eth_type_trans */
skb->protocol = proto;
return 1;
Expand Down Expand Up @@ -386,7 +387,7 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
}

/* errors aren't fatal - we can live with the dynamic address */
if (cdc_ether) {
if (cdc_ether && cdc_ether->wMaxSegmentSize) {
dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize);
usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/vrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ static int vrf_fib_rule(const struct net_device *dev, __u8 family, bool add_it)
frh->family = family;
frh->action = FR_ACT_TO_TBL;

if (nla_put_u32(skb, FRA_L3MDEV, 1))
if (nla_put_u8(skb, FRA_L3MDEV, 1))
goto nla_put_failure;

if (nla_put_u32(skb, FRA_PRIORITY, FIB_RULE_PREF))
Expand Down
3 changes: 3 additions & 0 deletions drivers/tty/serial/8250/8250_fintek.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ static int fintek_8250_enter_key(u16 base_port, u8 key)
if (!request_muxed_region(base_port, 2, "8250_fintek"))
return -EBUSY;

/* Force to deactive all SuperIO in this base_port */
outb(EXIT_KEY, base_port + ADDR_PORT);

outb(key, base_port + ADDR_PORT);
outb(key, base_port + ADDR_PORT);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/tty/serial/omap-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ static void serial_omap_set_mctrl(struct uart_port *port, unsigned int mctrl)
if ((mctrl & TIOCM_RTS) && (port->status & UPSTAT_AUTORTS))
up->efr |= UART_EFR_RTS;
else
up->efr &= UART_EFR_RTS;
up->efr &= ~UART_EFR_RTS;
serial_out(up, UART_EFR, up->efr);
serial_out(up, UART_LCR, lcr);

Expand Down
3 changes: 1 addition & 2 deletions fs/coda/upcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,7 @@ int venus_fsync(struct super_block *sb, struct CodaFid *fid)
UPARG(CODA_FSYNC);

inp->coda_fsync.VFid = *fid;
error = coda_upcall(coda_vcp(sb), sizeof(union inputArgs),
&outsize, inp);
error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);

CODA_FREE(inp, insize);
return error;
Expand Down
1 change: 1 addition & 0 deletions fs/ocfs2/dlm/dlmrecovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -2419,6 +2419,7 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
dlm_lockres_put(res);
continue;
}
dlm_move_lockres_to_recovery_list(dlm, res);
} else if (res->owner == dlm->node_num) {
dlm_free_dead_locks(dlm, res, dead_node);
__dlm_lockres_calc_usage(dlm, res);
Expand Down
9 changes: 7 additions & 2 deletions fs/ocfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,13 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
}
size_change = S_ISREG(inode->i_mode) && attr->ia_valid & ATTR_SIZE;
if (size_change) {
/*
* Here we should wait dio to finish before inode lock
* to avoid a deadlock between ocfs2_setattr() and
* ocfs2_dio_end_io_write()
*/
inode_dio_wait(inode);

status = ocfs2_rw_lock(inode, 1);
if (status < 0) {
mlog_errno(status);
Expand All @@ -1186,8 +1193,6 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
if (status)
goto bail_unlock;

inode_dio_wait(inode);

if (i_size_read(inode) >= attr->ia_size) {
if (ocfs2_should_order_data(inode)) {
status = ocfs2_begin_ordered_truncate(inode,
Expand Down
3 changes: 2 additions & 1 deletion include/linux/mmzone.h
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,8 @@ typedef struct pglist_data {
* is the first PFN that needs to be initialised.
*/
unsigned long first_deferred_pfn;
unsigned long static_init_size;
/* Number of non-deferred pages */
unsigned long static_init_pgcnt;
#endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */

#ifdef CONFIG_TRANSPARENT_HUGEPAGE
Expand Down
7 changes: 7 additions & 0 deletions include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -3587,6 +3587,13 @@ static inline void nf_reset_trace(struct sk_buff *skb)
#endif
}

static inline void ipvs_reset(struct sk_buff *skb)
{
#if IS_ENABLED(CONFIG_IP_VS)
skb->ipvs_property = 0;
#endif
}

/* Note: This doesn't put any conntrack and bridge info in dst. */
static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src,
bool copy)
Expand Down
27 changes: 18 additions & 9 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,28 +285,37 @@ EXPORT_SYMBOL(nr_online_nodes);
int page_group_by_mobility_disabled __read_mostly;

#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT

/*
* Determine how many pages need to be initialized durig early boot
* (non-deferred initialization).
* The value of first_deferred_pfn will be set later, once non-deferred pages
* are initialized, but for now set it ULONG_MAX.
*/
static inline void reset_deferred_meminit(pg_data_t *pgdat)
{
unsigned long max_initialise;
unsigned long reserved_lowmem;
phys_addr_t start_addr, end_addr;
unsigned long max_pgcnt;
unsigned long reserved;

/*
* Initialise at least 2G of a node but also take into account that
* two large system hashes that can take up 1GB for 0.25TB/node.
*/
max_initialise = max(2UL << (30 - PAGE_SHIFT),
(pgdat->node_spanned_pages >> 8));
max_pgcnt = max(2UL << (30 - PAGE_SHIFT),
(pgdat->node_spanned_pages >> 8));

/*
* Compensate the all the memblock reservations (e.g. crash kernel)
* from the initial estimation to make sure we will initialize enough
* memory to boot.
*/
reserved_lowmem = memblock_reserved_memory_within(pgdat->node_start_pfn,
pgdat->node_start_pfn + max_initialise);
max_initialise += reserved_lowmem;
start_addr = PFN_PHYS(pgdat->node_start_pfn);
end_addr = PFN_PHYS(pgdat->node_start_pfn + max_pgcnt);
reserved = memblock_reserved_memory_within(start_addr, end_addr);
max_pgcnt += PHYS_PFN(reserved);

pgdat->static_init_size = min(max_initialise, pgdat->node_spanned_pages);
pgdat->static_init_pgcnt = min(max_pgcnt, pgdat->node_spanned_pages);
pgdat->first_deferred_pfn = ULONG_MAX;
}

Expand All @@ -333,7 +342,7 @@ static inline bool update_defer_init(pg_data_t *pgdat,
if (zone_end < pgdat_end_pfn(pgdat))
return true;
(*nr_initialised)++;
if ((*nr_initialised > pgdat->static_init_size) &&
if ((*nr_initialised > pgdat->static_init_pgcnt) &&
(pfn & (PAGES_PER_SECTION - 1)) == 0) {
pgdat->first_deferred_pfn = pfn;
return false;
Expand Down
6 changes: 5 additions & 1 deletion mm/pagewalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,12 @@ static int walk_hugetlb_range(unsigned long addr, unsigned long end,
do {
next = hugetlb_entry_end(h, addr, end);
pte = huge_pte_offset(walk->mm, addr & hmask);
if (pte && walk->hugetlb_entry)

if (pte)
err = walk->hugetlb_entry(pte, hmask, addr, next, walk);
else if (walk->pte_hole)
err = walk->pte_hole(addr, next, walk);

if (err)
break;
} while (addr = next, addr != end);
Expand Down
6 changes: 3 additions & 3 deletions net/8021q/vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
dev->name);
vlan_vid_add(dev, htons(ETH_P_8021Q), 0);
}
if (event == NETDEV_DOWN &&
(dev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
vlan_vid_del(dev, htons(ETH_P_8021Q), 0);

vlan_info = rtnl_dereference(dev->vlan_info);
if (!vlan_info)
Expand Down Expand Up @@ -423,9 +426,6 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
struct net_device *tmp;
LIST_HEAD(close_list);

if (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
vlan_vid_del(dev, htons(ETH_P_8021Q), 0);

/* Put all VLANs for this dev in the down state too. */
vlan_group_for_each_dev(grp, i, vlandev) {
flgs = vlandev->flags;
Expand Down
1 change: 1 addition & 0 deletions net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -4378,6 +4378,7 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet)
if (!xnet)
return;

ipvs_reset(skb);
skb_orphan(skb);
skb->mark = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/tcp_nv.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ static void tcpnv_acked(struct sock *sk, const struct ack_sample *sample)

/* rate in 100's bits per second */
rate64 = ((u64)sample->in_flight) * 8000000;
rate = (u32)div64_u64(rate64, (u64)(avg_rtt * 100));
rate = (u32)div64_u64(rate64, (u64)(avg_rtt ?: 1) * 100);

/* Remember the maximum rate seen during this RTT
* Note: It may be more than one RTT. This function should be
Expand Down
Loading

0 comments on commit 74ff6e0

Please sign in to comment.