From: Dexuan Cui <decui(a)microsoft.com>
[ Upstream commit 685703b497bacea8765bb409d6b73455b73c540e ]
There is a race condition for an established connection that is being closed
by the guest: the refcnt is 4 at the end of hvs_release() (Note: here the
'remove_sock' is false):
1 for the initial value;
1 for the sk being in the bound list;
1 for the sk being in the connected list;
1 for the delayed close_work.
After hvs_release() finishes, __vsock_release() -> sock_put(sk) *may*
decrease the refcnt to 3.
Concurrently, hvs_close_connection() runs in another thread:
calls vsock_remove_sock() to decrease the refcnt by 2;
call sock_put() to decrease the refcnt to 0, and free the sk;
next, the "release_sock(sk)" may hang due to use-after-free.
In the above, after hvs_release() finishes, if hvs_close_connection() runs
faster than "__vsock_release() -> sock_put(sk)", then there is not any issue,
because at the beginning of hvs_close_connection(), the refcnt is still 4.
The issue can be resolved if an extra reference is taken when the
connection is established.
Fixes: a9eeb998c28d ("hv_sock: Add support for delayed close")
Signed-off-by: Dexuan Cui <decui(a)microsoft.com>
Reviewed-by: Sunil Muthuswamy <sunilmut(a)microsoft.com>
Signed-off-by: David S. Miller <davem(a)davemloft.net>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
net/vmw_vsock/hyperv_transport.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c
index 9c7da811d130f..98f193fd5315e 100644
--- a/net/vmw_vsock/hyperv_transport.c
+++ b/net/vmw_vsock/hyperv_transport.c
@@ -320,6 +320,11 @@ static void hvs_close_connection(struct vmbus_channel *chan)
lock_sock(sk);
hvs_do_close_lock_held(vsock_sk(sk), true);
release_sock(sk);
+
+ /* Release the refcnt for the channel that's opened in
+ * hvs_open_connection().
+ */
+ sock_put(sk);
}
static void hvs_open_connection(struct vmbus_channel *chan)
@@ -388,6 +393,9 @@ static void hvs_open_connection(struct vmbus_channel *chan)
}
set_per_channel_state(chan, conn_from_host ? new : sk);
+
+ /* This reference will be dropped by hvs_close_connection(). */
+ sock_hold(conn_from_host ? new : sk);
vmbus_set_chn_rescind_callback(chan, hvs_close_connection);
/* Set the pending send size to max packet size to always get
--
2.20.1
the type flag is stored in the chip->flags field not in the
client->flags field. This currently leads to never using the ti
specific health function as client->flags doesn't use that bit.
So it's always falling back to the general one.
Fixes: 76b16f4cdfb8 ("power: supply: sbs-battery: don't assume
MANUFACTURER_DATA formats")
Signed-off-by: Michael Nosthoff <committed(a)heine.so>
Reviewed-by: Brian Norris <briannorris(a)chromium.org>
Cc: <stable(a)vger.kernel.org>
---
Changes since v1:
* Changed comment according to Brian's suggestions
* Added Fixes tag
* Added reviewed and cc stable
drivers/power/supply/sbs-battery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 048d205d7074..2e86cc1e0e35 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -620,7 +620,7 @@ static int sbs_get_property(struct power_supply *psy,
switch (psp) {
case POWER_SUPPLY_PROP_PRESENT:
case POWER_SUPPLY_PROP_HEALTH:
- if (client->flags & SBS_FLAGS_TI_BQ20Z75)
+ if (chip->flags & SBS_FLAGS_TI_BQ20Z75)
ret = sbs_get_ti_battery_presence_and_health(client,
psp, val);
else
--
2.20.1
when the battery is set to sbs-mode and no gpio detection is enabled
"health" is always returning a value even when the battery is not present.
All other fields return "not present".
This leads to a scenario where the driver is constantly switching between
"present" and "not present" state. This generates a lot of constant
traffic on the i2c.
This commit changes the response of "health" to an error when the battery
is not responding leading to a consistent "not present" state.
Fixes: 76b16f4cdfb8 ("power: supply: sbs-battery: don't assume
MANUFACTURER_DATA formats")
Signed-off-by: Michael Nosthoff <committed(a)heine.so>
Cc: Brian Norris <briannorris(a)chromium.org>
Cc: <stable(a)vger.kernel.org>
---
drivers/power/supply/sbs-battery.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 2e86cc1e0e35..f8d74e9f7931 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -314,17 +314,22 @@ static int sbs_get_battery_presence_and_health(
{
int ret;
- if (psp == POWER_SUPPLY_PROP_PRESENT) {
- /* Dummy command; if it succeeds, battery is present. */
- ret = sbs_read_word_data(client, sbs_data[REG_STATUS].addr);
- if (ret < 0)
- val->intval = 0; /* battery disconnected */
- else
- val->intval = 1; /* battery present */
- } else { /* POWER_SUPPLY_PROP_HEALTH */
+ /* Dummy command; if it succeeds, battery is present. */
+ ret = sbs_read_word_data(client, sbs_data[REG_STATUS].addr);
+
+ if (ret < 0) { /* battery not present*/
+ if (psp == POWER_SUPPLY_PROP_PRESENT) {
+ val->intval = 0;
+ return 0;
+ }
+ return ret;
+ }
+
+ if (psp == POWER_SUPPLY_PROP_PRESENT)
+ val->intval = 1; /* battery present */
+ else /* POWER_SUPPLY_PROP_HEALTH */
/* SBS spec doesn't have a general health command. */
val->intval = POWER_SUPPLY_HEALTH_UNKNOWN;
- }
return 0;
}
@@ -626,6 +631,8 @@ static int sbs_get_property(struct power_supply *psy,
else
ret = sbs_get_battery_presence_and_health(client, psp,
val);
+
+ /* this can only be true if no gpio is used */
if (psp == POWER_SUPPLY_PROP_PRESENT)
return 0;
break;
--
2.20.1
The `uac_mixer_unit_descriptor` shown as below is read from the
device side. In `parse_audio_mixer_unit`, `baSourceID` field is
accessed from index 0 to `bNrInPins` - 1, the current implementation
assumes that descriptor is always valid (the length of descriptor
is no shorter than 5 + `bNrInPins`). If a descriptor read from
the device side is invalid, it may trigger out-of-bound memory
access.
```
struct uac_mixer_unit_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__u8 bDescriptorSubtype;
__u8 bUnitID;
__u8 bNrInPins;
__u8 baSourceID[];
}
```
This patch fixes the bug by add a sanity check on the length of
the descriptor.
CVE: CVE-2018-15117
Reported-by: Hui Peng <benquike(a)gmail.com>
Reported-by: Mathias Payer <mathias.payer(a)nebelwelt.net>
Signed-off-by: Hui Peng <benquike(a)gmail.com>
---
sound/usb/mixer.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 1f7eb3816cd7..10ddec76f906 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1628,6 +1628,7 @@ static int parse_audio_mixer_unit(struct mixer_build *state, int unitid,
int pin, ich, err;
if (desc->bLength < 11 || !(input_pins = desc->bNrInPins) ||
+ desc->bLength < sizeof(*desc) + desc->bNrInPins ||
!(num_outs = uac_mixer_unit_bNrChannels(desc))) {
usb_audio_err(state->chip,
"invalid MIXER UNIT descriptor %d\n",
--
2.17.1
This is the start of the stable review cycle for the 4.14.138 release.
There are 33 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Sat 10 Aug 2019 07:03:19 PM UTC.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.138-r…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.14.138-rc1
Lukas Wunner <lukas(a)wunner.de>
spi: bcm2835: Fix 3-wire mode if DMA is enabled
Tejun Heo <tj(a)kernel.org>
cgroup: Fix css_task_iter_advance_css_set() cset skip condition
Tejun Heo <tj(a)kernel.org>
cgroup: css_task_iter_skip()'d iterators must be advanced before accessed
Tejun Heo <tj(a)kernel.org>
cgroup: Include dying leaders with live threads in PROCS iterations
Tejun Heo <tj(a)kernel.org>
cgroup: Implement css_task_iter_skip()
Tejun Heo <tj(a)kernel.org>
cgroup: Call cgroup_release() before __exit_signal()
Sudarsana Reddy Kalluru <skalluru(a)marvell.com>
bnx2x: Disable multi-cos feature.
Matteo Croce <mcroce(a)redhat.com>
mvpp2: refactor MTU change code
Alexis Bauvin <abauvin(a)scaleway.com>
tun: mark small packets as owned by the tap sock
Ariel Levkovich <lariel(a)mellanox.com>
net/mlx5e: Prevent encap flow counter update async to user query
Arnd Bergmann <arnd(a)arndb.de>
compat_ioctl: pppoe: fix PPPOEIOCSFWD handling
Taras Kondratiuk <takondra(a)cisco.com>
tipc: compat: allow tipc commands without arguments
Johan Hovold <johan(a)kernel.org>
NFC: nfcmrvl: fix gpio-handling regression
Jia-Ju Bai <baijiaju1990(a)gmail.com>
net: sched: Fix a possible null-pointer dereference in dequeue_func()
René van Dorst <opensource(a)vdorst.com>
net: phylink: Fix flow control for fixed-link
Mark Zhang <markz(a)mellanox.com>
net/mlx5: Use reversed order when unregister devices
Jiri Pirko <jiri(a)mellanox.com>
net: fix ifindex collision during namespace removal
Nikolay Aleksandrov <nikolay(a)cumulusnetworks.com>
net: bridge: mcast: don't delete permanent entries when fast leave is enabled
Nikolay Aleksandrov <nikolay(a)cumulusnetworks.com>
net: bridge: delete local fdb on device init failure
Haishuang Yan <yanhaishuang(a)cmss.chinamobile.com>
ip6_tunnel: fix possible use-after-free on xmit
Cong Wang <xiyou.wangcong(a)gmail.com>
ife: error out when nla attributes are empty
Gustavo A. R. Silva <gustavo(a)embeddedor.com>
atm: iphase: Fix Spectre v1 vulnerability
Josh Poimboeuf <jpoimboe(a)redhat.com>
objtool: Add rewind_stack_do_exit() to the noreturn list
Josh Poimboeuf <jpoimboe(a)redhat.com>
objtool: Add machine_real_restart() to the noreturn list
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
IB: directly cast the sockaddr union to aockaddr
Jason Gunthorpe <jgg(a)mellanox.com>
RDMA: Directly cast the sockaddr union to sockaddr
Sebastian Parschauer <s.parschauer(a)gmx.de>
HID: Add quirk for HP X1200 PIXART OEM mouse
Aaron Armstrong Skomra <skomra(a)gmail.com>
HID: wacom: fix bit shift for Cintiq Companion 2
Will Deacon <will(a)kernel.org>
arm64: cpufeature: Fix feature comparison for CTR_EL0.{CWG,ERG}
Eric Dumazet <edumazet(a)google.com>
tcp: be more careful in tcp_fragment()
Adam Ford <aford173(a)gmail.com>
ARM: dts: Add pinmuxing for i2c2 and i2c3 for LogicPD torpedo
Adam Ford <aford173(a)gmail.com>
ARM: dts: Add pinmuxing for i2c2 and i2c3 for LogicPD SOM-LV
Hannes Reinecke <hare(a)suse.de>
scsi: fcoe: Embed fc_rport_priv in fcoe_rport structure
-------------
Diffstat:
Makefile | 4 +-
arch/arm/boot/dts/logicpd-som-lv.dtsi | 16 ++++
arch/arm/boot/dts/logicpd-torpedo-som.dtsi | 16 ++++
arch/arm64/include/asm/cpufeature.h | 7 +-
arch/arm64/kernel/cpufeature.c | 8 +-
drivers/atm/iphase.c | 8 +-
drivers/hid/hid-ids.h | 1 +
drivers/hid/usbhid/hid-quirks.c | 1 +
drivers/hid/wacom_wac.c | 12 +--
drivers/infiniband/core/addr.c | 15 ++-
drivers/infiniband/core/sa_query.c | 10 +-
drivers/infiniband/hw/ocrdma/ocrdma_ah.c | 5 +-
drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 5 +-
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 +-
drivers/net/ethernet/marvell/mvpp2.c | 41 +++-----
drivers/net/ethernet/mellanox/mlx5/core/dev.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 4 +-
.../net/ethernet/mellanox/mlx5/core/fs_counters.c | 5 +
drivers/net/phy/phylink.c | 2 +
drivers/net/ppp/pppoe.c | 3 +
drivers/net/ppp/pppox.c | 13 +++
drivers/net/ppp/pptp.c | 3 +
drivers/net/tun.c | 1 +
drivers/nfc/nfcmrvl/main.c | 4 +-
drivers/nfc/nfcmrvl/uart.c | 4 +-
drivers/nfc/nfcmrvl/usb.c | 1 +
drivers/scsi/fcoe/fcoe_ctlr.c | 51 ++++------
drivers/scsi/libfc/fc_rport.c | 5 +-
drivers/spi/spi-bcm2835.c | 3 +-
fs/compat_ioctl.c | 3 -
include/linux/cgroup-defs.h | 1 +
include/linux/cgroup.h | 4 +
include/linux/if_pppox.h | 3 +
include/linux/mlx5/fs.h | 1 +
include/net/tcp.h | 17 ++++
include/scsi/libfcoe.h | 1 +
kernel/cgroup/cgroup.c | 106 +++++++++++++++------
kernel/exit.c | 2 +-
net/bridge/br_multicast.c | 3 +
net/bridge/br_vlan.c | 5 +
net/core/dev.c | 2 +
net/ipv4/tcp_output.c | 11 ++-
net/ipv6/ip6_tunnel.c | 6 +-
net/l2tp/l2tp_ppp.c | 3 +
net/sched/act_ife.c | 3 +
net/sched/sch_codel.c | 6 +-
net/tipc/netlink_compat.c | 11 ++-
tools/objtool/check.c | 2 +
48 files changed, 293 insertions(+), 149 deletions(-)