From patchwork Tue Jul 25 19:29:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108666 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp939208qge; Tue, 25 Jul 2017 12:29:28 -0700 (PDT) X-Received: by 10.98.9.135 with SMTP id 7mr20740659pfj.15.1501010968271; Tue, 25 Jul 2017 12:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501010968; cv=none; d=google.com; s=arc-20160816; b=gHQXq+9TmS681vEvbLtdcx02hp/s721fk9aJmf1HUBa9vhrSipz7huAxyG8Dy/lRKm I1IYbkhUe8zhfxQC+YlCVmsEp6KkQc3JVcy2vMUI8bqqpwgK2DmAYTjGANFnV/ylsMN3 mcFuZx7DfZhAqcTGJ9r2zZ/4KGlFdI226PlWFwbDxg41CDt94AU26fPu3OhZvcQHYpkx 4ZVANBtcrQciA2LOuQt0X3gosh90GVgM4I6aOA+cQFns5yYl5CuXngBPireJmnKDepol N+hO+VDQ5D1xLQ/apWnjitu5wtYYn70OfkouiBSbP8wTGiZs66kHwDx3QBONMQHSYBJB zGEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=X+JEAS6RzxTeJyASA/2/bficor9gh0qTD26+W9mbf+c=; b=nkcmbsTzjku69Z1p/T/XgVrVVuOi5TyRoGTAEaw3WSqGRP54IXEjqf0JNGCQoU/uAI PdFoXmtodlUw822jGNOqgzzURa0L/jsG1fWCP7sSqOU8ld6TYYVpwHMBw+1p8MR0vdby B6wRcFGun/BJRNW8rJQY1Zb2Hc8ZKoM02wd1VP54i2PLxKxTKET9Ep78+cgJoiJx6jdz 8zv7a1lP1qDRdfG0xRx331beIvjJsdGQM/JZ4I/PQqSCEUixaZfgZby8dgIHEhDaPnpO ImjZUZlRXfGd59d/03Q/R5FG1sePwAVR67sSu+3UKpSxZvNv/cjk3vgVI9SpNrML86WH 8SBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=ihrZU0Ao; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o129si8605553pga.543.2017.07.25.12.29.28; Tue, 25 Jul 2017 12:29:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=ihrZU0Ao; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754353AbdGYT30 (ORCPT + 6 others); Tue, 25 Jul 2017 15:29:26 -0400 Received: from mail-pg0-f44.google.com ([74.125.83.44]:36725 "EHLO mail-pg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754342AbdGYT3Y (ORCPT ); Tue, 25 Jul 2017 15:29:24 -0400 Received: by mail-pg0-f44.google.com with SMTP id 125so74108319pgi.3 for ; Tue, 25 Jul 2017 12:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=X+JEAS6RzxTeJyASA/2/bficor9gh0qTD26+W9mbf+c=; b=ihrZU0AoXT22pK/uB0JgIr9PuNsUU9hryuLERDc2rIjd6A5XhQXi99JZMu8JTb0BEe Y/9SQPzgvu+qD012ndzfyX4/dNj2BgVMyXm9SN4PFgT5JY/YwrCHL0L9qaamfyLA/UC0 mrpdOj8UKriaARN5755baOymyzwGw3X5/Fy4M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=X+JEAS6RzxTeJyASA/2/bficor9gh0qTD26+W9mbf+c=; b=Shi0Xa5jo00eqh1nN4eyuaJtkmmnT8nplrImbpqhSIY/Ck40e3cEfTjdAtRlxOONfr BidRbMjCLePT1B/avWBOW8HLtubn1fLjIoOmY86WcLkXz/lBnKNqsS/Nx2X/Y0NYXpk1 CCQyTvGj2U4vIXuxGcamzklBQc7O3+phnwbm6GgVcNdURoZhf0yWfZykqBciciSrh23C 3X5T3lyy4HWE0+3+xqsZFJm2vJ5IVQA+lniBd21wZDPqnQEPv3lNQK2PihqEyDUUT0j6 Q3pFRB9flwIA6lQxgVcX1+B2G8NCim/Gg5nlY9ZioZh35+e1ZSpt5w/L/Zuj6d/G5pKu 56jQ== X-Gm-Message-State: AIVw113z2REMvZypCzhNLmB6DxSYLtRIfAt6+BUTNOykSegLLkRsMfvV 3d9dRsIxnaLVuNBS X-Received: by 10.84.169.67 with SMTP id g61mr22527599plb.155.1501010963718; Tue, 25 Jul 2017 12:29:23 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id 85sm30371425pfr.90.2017.07.25.12.29.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 12:29:22 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , OGAWA Hirofumi , Samuel Ortiz Subject: [PATCH for-4.9 01/10] nfc: Fix hangup of RC-S380* in port100_send_ack() Date: Wed, 26 Jul 2017 00:59:07 +0530 Message-Id: <1501010956-27944-2-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> References: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: OGAWA Hirofumi commit 2497128133f8169b24b928852ba6eae34fc495e5 upstream. If port100_send_ack() was called twice or more, it has race to hangup. port100_send_ack() port100_send_ack() init_completion() [...] dev->cmd_cancel = true /* this removes previous from completion */ init_completion() [...] dev->cmd_cancel = true wait_for_completion() /* never be waked up */ wait_for_completion() Like above race, this code is not assuming port100_send_ack() is called twice or more. To fix, this checks dev->cmd_cancel to know if prior cancel is in-flight or not. And never be remove prior task from completion by using reinit_completion(), so this guarantees to be waked up properly soon or later. Signed-off-by: OGAWA Hirofumi Signed-off-by: Samuel Ortiz Signed-off-by: Amit Pundir --- drivers/nfc/port100.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) -- 2.7.4 diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c index 2b2330b235e6..073e4a478c89 100644 --- a/drivers/nfc/port100.c +++ b/drivers/nfc/port100.c @@ -725,23 +725,33 @@ static int port100_submit_urb_for_ack(struct port100 *dev, gfp_t flags) static int port100_send_ack(struct port100 *dev) { - int rc; + int rc = 0; mutex_lock(&dev->out_urb_lock); - init_completion(&dev->cmd_cancel_done); + /* + * If prior cancel is in-flight (dev->cmd_cancel == true), we + * can skip to send cancel. Then this will wait the prior + * cancel, or merged into the next cancel rarely if next + * cancel was started before waiting done. In any case, this + * will be waked up soon or later. + */ + if (!dev->cmd_cancel) { + reinit_completion(&dev->cmd_cancel_done); - usb_kill_urb(dev->out_urb); + usb_kill_urb(dev->out_urb); - dev->out_urb->transfer_buffer = ack_frame; - dev->out_urb->transfer_buffer_length = sizeof(ack_frame); - rc = usb_submit_urb(dev->out_urb, GFP_KERNEL); + dev->out_urb->transfer_buffer = ack_frame; + dev->out_urb->transfer_buffer_length = sizeof(ack_frame); + rc = usb_submit_urb(dev->out_urb, GFP_KERNEL); - /* Set the cmd_cancel flag only if the URB has been successfully - * submitted. It will be reset by the out URB completion callback - * port100_send_complete(). - */ - dev->cmd_cancel = !rc; + /* + * Set the cmd_cancel flag only if the URB has been + * successfully submitted. It will be reset by the out + * URB completion callback port100_send_complete(). + */ + dev->cmd_cancel = !rc; + } mutex_unlock(&dev->out_urb_lock); @@ -928,8 +938,8 @@ static void port100_send_complete(struct urb *urb) struct port100 *dev = urb->context; if (dev->cmd_cancel) { + complete_all(&dev->cmd_cancel_done); dev->cmd_cancel = false; - complete(&dev->cmd_cancel_done); } switch (urb->status) { @@ -1543,6 +1553,7 @@ static int port100_probe(struct usb_interface *interface, PORT100_COMM_RF_HEAD_MAX_LEN; dev->skb_tailroom = PORT100_FRAME_TAIL_LEN; + init_completion(&dev->cmd_cancel_done); INIT_WORK(&dev->cmd_complete_work, port100_wq_cmd_complete); /* The first thing to do with the Port-100 is to set the command type From patchwork Tue Jul 25 19:29:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108667 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp939232qge; Tue, 25 Jul 2017 12:29:30 -0700 (PDT) X-Received: by 10.84.132.78 with SMTP id 72mr22012334ple.98.1501010970573; Tue, 25 Jul 2017 12:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501010970; cv=none; d=google.com; s=arc-20160816; b=rwhwA1A++FQQkj6bE2mtX8m6dfUPeUjrxhZ+O21M/QfnupkhPjb450wasgR1LzGMJG dyTcaE82aoE+UhD3tgdjpRp+AhqPVA1f4LTAqbbqEu2tiuFGC7s4hWi91fIXvGy70cUi MC8BDry1210MRp31jMrHd7jchGkvySU45e+EoKsSRacEaLKf4nVgln8aPd8WvcUGH/cd YDLyrHLe5mKV96LThGp+mAH4isVDOrZSvjLeGWmZoBVds5MewUrhyCu+wcuXwII5XHlM sCb7g1iEDY4Ug+6LJd5G7rDriYA3MHvu+K0AwBozlDo5L4zHxPMnckUHtj7RXZ9b56L7 lFCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=PcEzEgUvAa9tj0k7FRgzhFlqKvRchKnAw9TLL0OTJTs=; b=UN2HVTM/O/t9s89LclgkpWD4/pcFggGyyoA5hAAeADwth0dwp9XippLoXtr7BZi0qG ALj1EXBlGYXRRRzPvpGWm22yMWqGkZ6Mu+KKGz5Uzm+kt0Wf3dTfvfxwYYlYAFCtVzqQ Dt48YR4fUWHo8ArF2xTR/ENsILVpBfBVKguCPSzG2Ykm6ckLzt6Qpj8kyMDXYcp4xB2A /ZrBb4X7CmVWIsBYkqGXjmer0gcBwEheQu8KGKHtD1Vd+9P40Fpd4BCZEhFdBgQHxaAT ffbQrfjIE0ajUcHWvf/XbXYLlPzxKLZMvXtG4Y9Cb7ZEaK96JeQhSx8wPHS/lQM3tjL5 nm9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=HxuUgNRY; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o129si8605553pga.543.2017.07.25.12.29.30; Tue, 25 Jul 2017 12:29:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=HxuUgNRY; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754501AbdGYT32 (ORCPT + 6 others); Tue, 25 Jul 2017 15:29:28 -0400 Received: from mail-pg0-f41.google.com ([74.125.83.41]:36733 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754432AbdGYT31 (ORCPT ); Tue, 25 Jul 2017 15:29:27 -0400 Received: by mail-pg0-f41.google.com with SMTP id 125so74108730pgi.3 for ; Tue, 25 Jul 2017 12:29:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PcEzEgUvAa9tj0k7FRgzhFlqKvRchKnAw9TLL0OTJTs=; b=HxuUgNRY5vgQS3/zZ0BtGXQfUlUf9/HZJc5NfDhqHS1xPK9ReshoAYLztswuugGPlX 4dUbkhWgZvT+a4zck2Uxyzj9lZsuC8vhVHY7MENPnnEDhQntFYjZXm9jgjwkPZY33AQx aMuY5Ym7qvWmhBWm0JC8qACOzWL5BjQZY4nB4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PcEzEgUvAa9tj0k7FRgzhFlqKvRchKnAw9TLL0OTJTs=; b=D1Cxgh53GpdKenl3a/vrsz/iYFB0aNwUBMrrWhaykrVRebUVY8iEpcrVrCZ3tVdOY1 fd6+FGLbFfechaQRX4xqVK+K+o5MK+XbErwrhi+BEzYNmTEChIGa1ejoIy7dV812lQbu kACacrg+H3+nRIYPxQ0iKY2jsDAjRkJHuFFFsFsBnU3CU2Q6ACOBmubPKqaIMsIZaCy8 X4ZucHz/r3LpiyCFbFgQ+qtL+j9gmLiBfIfGJZwWe88lPw2Vfakazas+SfiwkNRjBR1H 4z1VhRXQ2DH3bQZODYt2tb1sb2EcCVsCWAgj/b2t1grqvuj/dlEKjFeOdblMoVv/q41/ 5iMg== X-Gm-Message-State: AIVw112WdAgvuMdHeiUIYW7O3kPe0fYMajd+gXHtjgyphEs4aKpHxGBo bEdYi3AgzpKPLw69 X-Received: by 10.84.232.143 with SMTP id i15mr22700140plk.248.1501010966649; Tue, 25 Jul 2017 12:29:26 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id 85sm30371425pfr.90.2017.07.25.12.29.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 12:29:25 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Florian Fainelli , "David S . Miller" Subject: [PATCH for-4.9 02/10] net: phy: Do not perform software reset for Generic PHY Date: Wed, 26 Jul 2017 00:59:08 +0530 Message-Id: <1501010956-27944-3-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> References: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Florian Fainelli commit 0878fff1f42c18e448ab5b8b4f6a3eb32365b5b6 upstream. The Generic PHY driver is a catch-all PHY driver and it should preserve whatever prior initialization has been done by boot loader or firmware agents. For specific PHY device configuration it is expected that a specialized PHY driver would take over that role. Resetting the generic PHY was a bad idea that has lead to several complaints and downstream workarounds e.g: in OpenWrt/LEDE so restore the behavior prior to 87aa9f9c61ad ("net: phy: consolidate PHY reset in phy_init_hw()"). Reported-by: Felix Fietkau Fixes: 87aa9f9c61ad ("net: phy: consolidate PHY reset in phy_init_hw()") Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Amit Pundir --- drivers/net/phy/phy_device.c | 2 +- include/linux/phy.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 32b555a72e13..9e7b7836774f 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1792,7 +1792,7 @@ static struct phy_driver genphy_driver[] = { .phy_id = 0xffffffff, .phy_id_mask = 0xffffffff, .name = "Generic PHY", - .soft_reset = genphy_soft_reset, + .soft_reset = genphy_no_soft_reset, .config_init = genphy_config_init, .features = PHY_GBIT_FEATURES | SUPPORTED_MII | SUPPORTED_AUI | SUPPORTED_FIBRE | diff --git a/include/linux/phy.h b/include/linux/phy.h index 6c9b1e0006ee..8431c8c0c320 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -799,6 +799,10 @@ int genphy_read_status(struct phy_device *phydev); int genphy_suspend(struct phy_device *phydev); int genphy_resume(struct phy_device *phydev); int genphy_soft_reset(struct phy_device *phydev); +static inline int genphy_no_soft_reset(struct phy_device *phydev) +{ + return 0; +} void phy_driver_unregister(struct phy_driver *drv); void phy_drivers_unregister(struct phy_driver *drv, int n); int phy_driver_register(struct phy_driver *new_driver, struct module *owner); From patchwork Tue Jul 25 19:29:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108668 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp939256qge; Tue, 25 Jul 2017 12:29:32 -0700 (PDT) X-Received: by 10.99.125.11 with SMTP id y11mr20507990pgc.19.1501010972828; Tue, 25 Jul 2017 12:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501010972; cv=none; d=google.com; s=arc-20160816; b=iSW1hmrK2649ZgIHfDZIFovzy3fslTxO66kzfNDLNKtqy8S2FKGKR8s88VdvmL8NUz wcWHGhMIdNTyr7ZCGVOviuPVtPq36Y1VZQxsoodrvFMpAkagO/eVdnIttqnWXYtAhNWb wKure4IQ89LJ/mIv+HcUh93fBAQh/T5hzae9P6eYY33i8atJpcz/Sz62c6cR47Ur7GnC oRAeC+QTUsNPLnC4mM385vxT6FZ+i+zlcPOMXGfEOO6CMuXQQvTGV9tn+EaTpT8q8phG s4hJ00eD5fTJFq3nZFfUT8+6Isg+UxJY6F2MO7ZwxgX+PEZJAWk8Q5RiK16Vf7s1H8Uw youg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=xXWz0AoXVadCrmW0vr1TiHHn1jmsAfTq7THtlb+9LrA=; b=aA+KjWji5Yti+CFcYKghT3hnKxF1BLWzCIMNrRIEb6PW8O3cDK9IZfrqNijGWPfDkQ 0aXk9ll/kRmZBSQmMrQVH5LtkSgx3JwuGbAAoMlCxAwmzjCA3/fUbDrxDQJo2Xy26sih 0qS52FLykRIQWZBdmPOi1lv8ZmVBrUH6vHxLqisEcMvR+R/P3RXbTaZqabbNzTiz6gTO EF46lhWJ5VKjDO1H8Qy5pqMtzKFPcPz5gaA5PDVk0aTMp+LKSG8EPRkssrHxYnB/GkHX miX8kVaRSvHtX9O2kMmnXaF+Wc6ZVG7HjWzm5ASj2xQy8zgGNqsbH1HCQtHyCJjDaCL0 GqiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=DdjiVkAe; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o129si8605553pga.543.2017.07.25.12.29.32; Tue, 25 Jul 2017 12:29:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=DdjiVkAe; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751984AbdGYT3b (ORCPT + 6 others); Tue, 25 Jul 2017 15:29:31 -0400 Received: from mail-pf0-f175.google.com ([209.85.192.175]:33885 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754432AbdGYT3a (ORCPT ); Tue, 25 Jul 2017 15:29:30 -0400 Received: by mail-pf0-f175.google.com with SMTP id q85so62010235pfq.1 for ; Tue, 25 Jul 2017 12:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xXWz0AoXVadCrmW0vr1TiHHn1jmsAfTq7THtlb+9LrA=; b=DdjiVkAe9SBJJVaZZq5/EuUaLYEmVdFIATV+oXD+5m/HmC5IKMbULkoZFHmLnHB3ZA rBCHD9SyPcDQRcEu1CsqICN2QI5W0xTxMoCO0jVokRoOAqsEN3dHu+K8/6BErW1/mTMR V6ljnsnScpvqrAd2pzGXkLh9st6BIDxbTvC/g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xXWz0AoXVadCrmW0vr1TiHHn1jmsAfTq7THtlb+9LrA=; b=bWlPjSfepkFY2778Nbdh9bazu6sp1/Yf960EHOOdUlvyKb3Fo/2dMzaoceDEhFugts KmtaRWlpfDk2AGOYazhCirxlMhRjp1y0GLVVmanwVzxJK8yhzEnE2vYHayxMa2EGRcUr 3h5EyaSYEcF7zJYhK3RZZqPmLOPmNsIWFrPnUPOdKcE9YVKK8/qAy/e7KY4xGY7pwLpL mPW6iKNmeCLTvf3xTwPECNdjxdECEC4miX49M/moswgh1Ukgf9tZOdrATzmM0LIOX5fx 7C7ee1dhKqflAYVs0U2Cm4PC95+EVPtFGrbQsTV9Uniwjq7jr488kQjSkVtW26YuazPd eLjw== X-Gm-Message-State: AIVw1133GEXkdw22nndUotS5oPTyaF12OL26oGv4Je0eAl0sKzmmU6yx 6m/wDL4jlTjKW0Y5 X-Received: by 10.98.14.195 with SMTP id 64mr8205593pfo.10.1501010969735; Tue, 25 Jul 2017 12:29:29 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id 85sm30371425pfr.90.2017.07.25.12.29.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 12:29:28 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Sudip Mukherjee , Sudip Mukherjee , Samuel Ortiz Subject: [PATCH for-4.9 03/10] nfc: fdp: fix NULL pointer dereference Date: Wed, 26 Jul 2017 00:59:09 +0530 Message-Id: <1501010956-27944-4-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> References: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sudip Mukherjee commit b6355fb3f5f40bbce165847d277e64896cab8f95 upstream. We are checking phy after dereferencing it. We can print the debug information after checking it. If phy is NULL then we will get a good stack trace to tell us that we are in this irq handler. Signed-off-by: Sudip Mukherjee Signed-off-by: Samuel Ortiz Signed-off-by: Amit Pundir --- drivers/nfc/fdp/i2c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/nfc/fdp/i2c.c b/drivers/nfc/fdp/i2c.c index 5e797d5c38ed..712936f5d2d6 100644 --- a/drivers/nfc/fdp/i2c.c +++ b/drivers/nfc/fdp/i2c.c @@ -210,14 +210,14 @@ static irqreturn_t fdp_nci_i2c_irq_thread_fn(int irq, void *phy_id) struct sk_buff *skb; int r; - client = phy->i2c_dev; - dev_dbg(&client->dev, "%s\n", __func__); - if (!phy || irq != phy->i2c_dev->irq) { WARN_ON_ONCE(1); return IRQ_NONE; } + client = phy->i2c_dev; + dev_dbg(&client->dev, "%s\n", __func__); + r = fdp_nci_i2c_read(phy, &skb); if (r == -EREMOTEIO) From patchwork Tue Jul 25 19:29:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108669 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp939302qge; Tue, 25 Jul 2017 12:29:36 -0700 (PDT) X-Received: by 10.99.96.73 with SMTP id u70mr20635986pgb.345.1501010976349; Tue, 25 Jul 2017 12:29:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501010976; cv=none; d=google.com; s=arc-20160816; b=xnSgCP6O76sezPY6GhCPzpwD+SXSQRrKmOp4okU0Mu+5mQP+0sgke/pzgglsFHHdbp V/jUO4rPkqQZrA5le0XGXWLEDj+wKF90hQpHqlO6uys2LTItJ1/hH6sG/vFJd4MiZ+Ih EV/iru2zb2p1p3vyEzgZVzj7/H0RjNkxdkZI/VAV9pOWJ3pqOai5ZZojeVC9MSLM2EzU FpoILOPEKOnNWqkyhpLjJ39GdCf1phCCp0bFhTflflLAdGmrMj3SdpBSmsm75Z1MYwNe ARaOwKqiNuQu0U4adHgSMmikZanNJ7vE4riTM/NsdBmivZCBbvvqkhJ1KNBP41PTmmAB 7/6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=+IT8FuLYyNifhF7YAD4hYXJgW8YkQ4S8/FTml/GrQyI=; b=xYw25eEXKRQ4sXmA8SRDgPf9KPoSG2IwUWCSC21avkaFNfcRrqH7UA7wYbplQuIO1s lk4+hrJ6Qgf1qpn1SY7yCITSvIStLwpCjFbY/8VVT4bDyR0441IWzXlFPBKpw5vh7o9X wDApUouZ+LEYhDFmrWt3ki6pr7tDFEnNm5V7YKOnhOVYJNktlZlK5ZXszzyKYXxLY9Dl U38Aa2FQ7uZV22DmFX339SDwX50lwtWKNh30kmB2Wmf9JW0tZa++84soLrlVQ299Ylex PEF/j7XlhwCWsWMvIqeiiZqf181qgHjBAZ91SbgLEpGGnRtdY63DXPMlavkMoS7/nZ4I IKxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=f0RRSP+F; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o129si8605553pga.543.2017.07.25.12.29.36; Tue, 25 Jul 2017 12:29:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=f0RRSP+F; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754321AbdGYT3e (ORCPT + 6 others); Tue, 25 Jul 2017 15:29:34 -0400 Received: from mail-pg0-f41.google.com ([74.125.83.41]:36752 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752544AbdGYT3d (ORCPT ); Tue, 25 Jul 2017 15:29:33 -0400 Received: by mail-pg0-f41.google.com with SMTP id 125so74109663pgi.3 for ; Tue, 25 Jul 2017 12:29:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+IT8FuLYyNifhF7YAD4hYXJgW8YkQ4S8/FTml/GrQyI=; b=f0RRSP+FlCDryfeXQpB5eFU/8MiulnwWRr15GOcOvHOYNiuY2z+kMIjttJxuB40Svq DY3y/A1iKwLFvmBXrHIj83g240za0hMV9EcQ2vn/exDCRH+EfhdZs3W4y3cwOyrCA89S HRuAQkZpSzhWeUNnbxbK7x572jtqD39z1J68k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+IT8FuLYyNifhF7YAD4hYXJgW8YkQ4S8/FTml/GrQyI=; b=h317eEhAh9HLcoAMUr30IpzSfd9ErW8JLxa+M9GwTlQVtH2KrJ2p9fhoQ588SmDddX QY1oSvu4mGfBYfhq1waX3jtJlkJpuw35pkg63qbozO/Pb2QKs3VfbWC5eZZc6VulYjeI s0utAJ6ftnNblY/Njh0ZxffzPoRWkmgjaDtdbu12m+pHl9/O3Wl4pRVbqkO0ooWPQmUK +qSfDCNmCr5lE5+qZFzgYozIJjG2ryKnCAbX7N0cuxBAXMgrF47sTKwQAGwxFNDCkYzx gNW5grTMLxoSnVJJwZjjf78yqnAi+hNU0WUqWrQqZ1ME2WnJTL3y13rwocY4UB/FTs+N nugA== X-Gm-Message-State: AIVw110yqy4jzNBzD8w03BKjr8E6zeUixSgEsb2A+Dee6CLK5Swlgnrv 2bJd9TCsHH/HOFnI X-Received: by 10.98.152.208 with SMTP id d77mr20382267pfk.210.1501010972573; Tue, 25 Jul 2017 12:29:32 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id 85sm30371425pfr.90.2017.07.25.12.29.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 12:29:31 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Jia-Ju Bai , "David S . Miller" Subject: [PATCH for-4.9 04/10] isdn: Fix a sleep-in-atomic bug Date: Wed, 26 Jul 2017 00:59:10 +0530 Message-Id: <1501010956-27944-5-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> References: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jia-Ju Bai commit e8f4ae85439f34bec3b0ab69223a41809dab28c9 upstream. The driver may sleep under a spin lock, the function call path is: isdn_ppp_mp_receive (acquire the lock) isdn_ppp_mp_reassembly isdn_ppp_push_higher isdn_ppp_decompress isdn_ppp_ccp_reset_trans isdn_ppp_ccp_reset_alloc_state kzalloc(GFP_KERNEL) --> may sleep To fixed it, the "GFP_KERNEL" is replaced with "GFP_ATOMIC". Signed-off-by: Jia-Ju Bai Signed-off-by: David S. Miller Signed-off-by: Amit Pundir --- drivers/isdn/i4l/isdn_ppp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 9c1e8adaf4fc..bf3fbd00a091 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c @@ -2364,7 +2364,7 @@ static struct ippp_ccp_reset_state *isdn_ppp_ccp_reset_alloc_state(struct ippp_s id); return NULL; } else { - rs = kzalloc(sizeof(struct ippp_ccp_reset_state), GFP_KERNEL); + rs = kzalloc(sizeof(struct ippp_ccp_reset_state), GFP_ATOMIC); if (!rs) return NULL; rs->state = CCPResetIdle; From patchwork Tue Jul 25 19:29:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108670 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp939343qge; Tue, 25 Jul 2017 12:29:39 -0700 (PDT) X-Received: by 10.99.125.11 with SMTP id y11mr20508232pgc.19.1501010979615; Tue, 25 Jul 2017 12:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501010979; cv=none; d=google.com; s=arc-20160816; b=LfrGUgHUWujW858lv8NyRKnNGVrwe9NfxJX0e1qPvWKiYAnp9zydik163hA9wPFerX ySsxVr6uJjXv5llWMMpaLzkni41h6MHN2suNRsDHrIaDD6ZWKISkM28Aa4+TdvqEPcjn pp91uPqrPnhZ92py2bR+h3fzAsax6Rj7AL9PMpt3PFb9/oRBOHunUbev1yj9JVMOYh72 P0iosbLF+Yu34OtZRe5GNOuiQpNHNoZEgkpa6H56o0pre/Hnev/77EBAHjLjz+XFKvSN B59EGBTMmf2DUaonJkBnSpWEAwu209otFD8tNR+b0HQAYiTXMTZR2RDLua17NK0qVrFr XYOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=orUC9GYZjjXBkv7fcR5tA6PQt+kQUpHqnM6k8/HTT94=; b=LReYlbaInkbO5/inpj8bkfu83SD7/9BhzJP0fpbPc77lf7kydUc19TBFNtk+emG2qN 8Vp8O85BpCRdi0ia+Ix1s4CEtJdfE43K/DEl7WVTLP+kMsBfBdpH01Kj9UtX+pXhIamO VLe8yaYNPU5aIEmS3SoJu7ilB/G7qJFx0mtyBSxnMbkvAXU8FGpMy+nbLwtUd5uitSps sGPZxobO0mrHJhDGKJ4ThtVgl0WpPgDS/nqzYeG2Mbbf8OPQTfkA8OGXKjWbKQ0jAlv3 8mJl1cxjAhNLk3tSbmgrIyV3EY6xWg7693nWMA4LQ0LrNCisroZkfj5VL87kczAv5o/k oMzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=E8jeCcBh; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o129si8605553pga.543.2017.07.25.12.29.39; Tue, 25 Jul 2017 12:29:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=E8jeCcBh; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751965AbdGYT3h (ORCPT + 6 others); Tue, 25 Jul 2017 15:29:37 -0400 Received: from mail-pg0-f45.google.com ([74.125.83.45]:36761 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754362AbdGYT3g (ORCPT ); Tue, 25 Jul 2017 15:29:36 -0400 Received: by mail-pg0-f45.google.com with SMTP id 125so74110140pgi.3 for ; Tue, 25 Jul 2017 12:29:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=orUC9GYZjjXBkv7fcR5tA6PQt+kQUpHqnM6k8/HTT94=; b=E8jeCcBhDRbxmJ7CtYxq0+tsXyWQAKErzkxn3YT+6M5RG6KYu2pJvR/Aup6bV3KzBk fPmgdes/Wewy7u2Q8Ik21aoOBWLrJq60P6Y2gCINQ4eqTWdkMIV87GF6WCc0RLF8VQWr 3ZiOPW81CWANW+TsEX95X4V5x9wx6knwIxIhY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=orUC9GYZjjXBkv7fcR5tA6PQt+kQUpHqnM6k8/HTT94=; b=eHcsuqAZEQjelxSY4XNwOGDVj9Dw3RCBAfJRxRuqtN3nySygqUQvO2c2fkD80CpXxB a5D/MVBDOb88VzXXi4f5oZ2EJPtyRHIoKPUk+JOQeSLq/Q9MKD9MZdQnJsMzGuZ37IyK byROHp3u484tpkLAhNCS6j8HHZZU57UafSrSCjaf46x+1gvVNP99JwgWbWvylcsxKyCt rhX2kMHcTPOMKHJHEikjRjkAS09EbSJetvNJSk36tTtjCJAcLNdhBjXsJQ+rTjpFwzVv Ptv0BeLdOY8E/Brhmh64vqZukOU8XDPBzrpzgoL/eIsC84Pf9sI1a76JGkJO/yyMVKnB dlmA== X-Gm-Message-State: AIVw113RJq0GccRg/KtVP6pxxDmn/uBDf2FVjEj+N8iE/zsTWcDsyQpp WKCGH6MITJHInlDrzduAJw== X-Received: by 10.84.151.3 with SMTP id i3mr22359465pli.377.1501010975399; Tue, 25 Jul 2017 12:29:35 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id 85sm30371425pfr.90.2017.07.25.12.29.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 12:29:34 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Michal Kazior , Kalle Valo Subject: [PATCH for-4.9 05/10] ath10k: fix null deref on wmi-tlv when trying spectral scan Date: Wed, 26 Jul 2017 00:59:11 +0530 Message-Id: <1501010956-27944-6-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> References: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Michal Kazior commit 18ae68fff392e445af3c2d8be9bef8a16e1c72a7 upstream. WMI ops wrappers did not properly check for null function pointers for spectral scan. This caused null dereference crash with WMI-TLV based firmware which doesn't implement spectral scan. The crash could be triggered with: ip link set dev wlan0 up echo background > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl The crash looked like this: [ 168.031989] BUG: unable to handle kernel NULL pointer dereference at (null) [ 168.037406] IP: [< (null)>] (null) [ 168.040395] PGD cdd4067 PUD fa0f067 PMD 0 [ 168.043303] Oops: 0010 [#1] SMP [ 168.045377] Modules linked in: ath10k_pci(O) ath10k_core(O) ath mac80211 cfg80211 [last unloaded: cfg80211] [ 168.051560] CPU: 1 PID: 1380 Comm: bash Tainted: G W O 4.8.0 #78 [ 168.054336] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014 [ 168.059183] task: ffff88000c460c00 task.stack: ffff88000d4bc000 [ 168.061736] RIP: 0010:[<0000000000000000>] [< (null)>] (null) ... [ 168.100620] Call Trace: [ 168.101910] [] ? ath10k_spectral_scan_config+0x96/0x200 [ath10k_core] [ 168.104871] [] ? filemap_fault+0xb2/0x4a0 [ 168.106696] [] write_file_spec_scan_ctl+0x116/0x280 [ath10k_core] [ 168.109618] [] full_proxy_write+0x51/0x80 [ 168.111443] [] __vfs_write+0x28/0x120 [ 168.113090] [] ? security_file_permission+0x3d/0xc0 [ 168.114932] [] ? percpu_down_read+0x12/0x60 [ 168.116680] [] vfs_write+0xb8/0x1a0 [ 168.118293] [] SyS_write+0x46/0xa0 [ 168.119912] [] entry_SYSCALL_64_fastpath+0x1a/0xa4 [ 168.121737] Code: Bad RIP value. [ 168.123318] RIP [< (null)>] (null) Signed-off-by: Michal Kazior Signed-off-by: Kalle Valo Signed-off-by: Amit Pundir --- drivers/net/wireless/ath/ath10k/wmi-ops.h | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h b/drivers/net/wireless/ath/ath10k/wmi-ops.h index c9a8bb1186f2..c7956e181f80 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-ops.h +++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h @@ -660,6 +660,9 @@ ath10k_wmi_vdev_spectral_conf(struct ath10k *ar, struct sk_buff *skb; u32 cmd_id; + if (!ar->wmi.ops->gen_vdev_spectral_conf) + return -EOPNOTSUPP; + skb = ar->wmi.ops->gen_vdev_spectral_conf(ar, arg); if (IS_ERR(skb)) return PTR_ERR(skb); @@ -675,6 +678,9 @@ ath10k_wmi_vdev_spectral_enable(struct ath10k *ar, u32 vdev_id, u32 trigger, struct sk_buff *skb; u32 cmd_id; + if (!ar->wmi.ops->gen_vdev_spectral_enable) + return -EOPNOTSUPP; + skb = ar->wmi.ops->gen_vdev_spectral_enable(ar, vdev_id, trigger, enable); if (IS_ERR(skb)) From patchwork Tue Jul 25 19:29:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108671 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp939377qge; Tue, 25 Jul 2017 12:29:42 -0700 (PDT) X-Received: by 10.99.45.194 with SMTP id t185mr19918945pgt.388.1501010982502; Tue, 25 Jul 2017 12:29:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501010982; cv=none; d=google.com; s=arc-20160816; b=N0AP1SnpwnU+nFWmssv85TIJUtkd4BtjprkiV9peJ6FE3yZzbMSKN+eV1PDQubiRF9 P9zyJbjq8/mCW0bDcxiiewjNSAFw/CvKuODutCctDOuwW6jP/B8rQD1xQldpwGfUypJL sOUpqR2fR5qEUk/K0W4EAM2ohxX+u4GOxIs0tYexlygV8N4hwhDM+QqUVau1Hywc7lO5 iqG9LJm76DqwJxVOEudG8Cm9Alj82UIBZbZkWEnGFwGStZic1fFPA/nZajr72LGEUvJS u2gEmZbAMZm3hWocU1sKvyj3/B8CHKoyR4ElfK/vruR2dRxpejCI3tDTkMk+OiryAD/r vAUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=L4m0NJYVqJLPWmcSo/mWibL+bKT6vlu62WHNznltx98=; b=SJAmjwhtnDBrZn9EycyBN7jbHI6La/IhoW9d1dkRKNczYtqNAZgBP0YClw0C1LDeC7 lWiSyjY/mYJhYxootQOKLzgw6C8gyANBmgDevHtiNhapKJOGvPaSRe+OAY/5HjsOblf0 3+mjtjvsYabInvQnfgXv0+q5AYyTyPrXSPHR2anJrFu/ssdqJh6ZwvbxUPjEwWO9BbWM d8m7I31fj76HtMoiWA+xTACBG8GnjgYq9dhp/m77aE9ny0jn+UAiEc/0k4vG3bNy7i51 LjOXBkN+4CM3cHAraak4rCHjOuIPtG3O2RKu2duLiurlcp5JfWAqEroUz1ixcU/TD3QJ rJbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=e/yl7J7G; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o129si8605553pga.543.2017.07.25.12.29.42; Tue, 25 Jul 2017 12:29:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=e/yl7J7G; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754202AbdGYT3l (ORCPT + 6 others); Tue, 25 Jul 2017 15:29:41 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:35189 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754362AbdGYT3i (ORCPT ); Tue, 25 Jul 2017 15:29:38 -0400 Received: by mail-pg0-f53.google.com with SMTP id v190so74108899pgv.2 for ; Tue, 25 Jul 2017 12:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=L4m0NJYVqJLPWmcSo/mWibL+bKT6vlu62WHNznltx98=; b=e/yl7J7G+7FIWfT5XP9z/Ew01dEVJEHpCypJGG+aiXUJhTc0+dzb37b3a0nAvmjAwC qdMTOfcQMWStgF8AtTg+FUkNSlgDBz8YUrxzOB3QCjd/KsFGnpsRzehIZxZO8DkDsC2Y boxtCsOjq0TcT97/C3xQ36ky/1gGWEMGyKBMA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=L4m0NJYVqJLPWmcSo/mWibL+bKT6vlu62WHNznltx98=; b=bAUGV626KolBgOJF6zxSI4ger6tb4BZgJpvXAdB69aLA5VSeQibrgZlFiSnrc8RTU5 7Tofs2IP6F7I4rA3pFJ9aG1M2y9C0fcjGYeARYFWxRJNBkh5nNCymVo7b3ZB+e2U0c5x hau7ELXmr8OmfcEx+IKndXUIXkl+HXxXUDc8v6wWSklu2LtQADQVhDPDu7aQRn4gET1V HGnvyv1/tQ0h8r+q3nBJkebCKNpcKnFmujtRSt1BEtbVjzIIHQ1ula/TMDTASpc3MaDC GSpt2nmX227GBAwB+kppzHF7+3XWRmqu5wxIKaoLasOJX0yJtUu0B+ewXBmWwwiexSmL SjYg== X-Gm-Message-State: AIVw112HoMgAWGOr6wB+XUO5+GTt4pC4qZXMu7jRVJgOjKiM0Jm81mKb Utq31Ihw73MA8Upj X-Received: by 10.84.236.4 with SMTP id q4mr17498211plk.423.1501010978283; Tue, 25 Jul 2017 12:29:38 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id 85sm30371425pfr.90.2017.07.25.12.29.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 12:29:37 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Lior David , Maya Erez , Kalle Valo Subject: [PATCH for-4.9 06/10] wil6210: fix deadlock when using fw_no_recovery option Date: Wed, 26 Jul 2017 00:59:12 +0530 Message-Id: <1501010956-27944-7-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> References: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lior David commit dfb5b098e0f40b68aa07f2ec55f4dd762efefbfa upstream. When FW crashes with no_fw_recovery option, driver waits for manual recovery with wil->mutex held, this can easily create deadlocks. Fix the problem by moving the wait outside the lock. Signed-off-by: Lior David Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Amit Pundir --- drivers/net/wireless/ath/wil6210/main.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index e7130b54d1d8..24b07a0ce6f7 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c @@ -384,18 +384,19 @@ static void wil_fw_error_worker(struct work_struct *work) wil->last_fw_recovery = jiffies; + wil_info(wil, "fw error recovery requested (try %d)...\n", + wil->recovery_count); + if (!no_fw_recovery) + wil->recovery_state = fw_recovery_running; + if (wil_wait_for_recovery(wil) != 0) + return; + mutex_lock(&wil->mutex); switch (wdev->iftype) { case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_P2P_CLIENT: case NL80211_IFTYPE_MONITOR: - wil_info(wil, "fw error recovery requested (try %d)...\n", - wil->recovery_count); - if (!no_fw_recovery) - wil->recovery_state = fw_recovery_running; - if (0 != wil_wait_for_recovery(wil)) - break; - + /* silent recovery, upper layers will see disconnect */ __wil_down(wil); __wil_up(wil); break; From patchwork Tue Jul 25 19:29:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108672 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp939410qge; Tue, 25 Jul 2017 12:29:44 -0700 (PDT) X-Received: by 10.98.87.195 with SMTP id i64mr19999032pfj.175.1501010984867; Tue, 25 Jul 2017 12:29:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501010984; cv=none; d=google.com; s=arc-20160816; b=fbF50N/5nntzVPAATYd52x1lIbpQPk3Cpwm7zktWB7Xv+DjpvCszD9F04dHnodsxxS T5eP1nl1YOA1O7H7RdeXPfIoRyghoz6ZcrSdUtD4RxRbVFauYnc1jam3EGW6bnKk3mut pCcIUHYX2VpHsyak6/rTjVAAHosATTRUZFkKAUgX5glFtnEqq54RGmsbqUTa8rOhNscx PS4fJcGmm2tF0FcqM+epDwySBPC/kwZ/qk8eX/cuQOZA9ixJNr1pmC7H0/V/fDxl4Ack tHTSgGLUKpxKprfEeqmMC8rvjKEtJ6TAirtmNnR9KCSkRqtXVfIEo9z6Vjqk+9gabpuz i0/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=/QkfGwx1qN+bH6UcWAZ8ICsmNcw0HgeMWJLpOBUNdDM=; b=b7xUjU/Ml+KUNVkNm5BjjkNFqFy+p0Uynfb5ZEcp5MTZpGYPNtG0Rw+ntNuqUwrDNS xkECjSQ5lwIYORSEsTdEH2XfXEGtQ2/OCs+WUSM4qwR5qA28q893rjUvVbpDBtvTCDpZ 1/vuPdhQYizutlPBVuLew00r70V9I1ycfKWtBSFRTU3Eun0OF2zF2zqwioTqA46iweS5 IbOzpDDtkVhiBxGng+7DWr1O+jMIQmvIQsWO0tjwpxH9gtVifHGgXcMSsGxBmmWHtsEf VEyb77tMDhWmWuyQ4dEIVH3Bt8CyB2NpMrpTHcDzDtDX6KZAbmcOyhDTUVCbIKfSSKtv 2q8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=Y1hJrsVX; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o129si8605553pga.543.2017.07.25.12.29.44; Tue, 25 Jul 2017 12:29:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=Y1hJrsVX; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754444AbdGYT3m (ORCPT + 6 others); Tue, 25 Jul 2017 15:29:42 -0400 Received: from mail-pg0-f45.google.com ([74.125.83.45]:33614 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754362AbdGYT3l (ORCPT ); Tue, 25 Jul 2017 15:29:41 -0400 Received: by mail-pg0-f45.google.com with SMTP id g14so25234640pgu.0 for ; Tue, 25 Jul 2017 12:29:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/QkfGwx1qN+bH6UcWAZ8ICsmNcw0HgeMWJLpOBUNdDM=; b=Y1hJrsVX36R6GD8rrUnoLr9RyGK/DfqWl8nBWaV68bqaf4P9XFBG/RA7QYWGYWzPhI xVm+7lyZFp7FIaWE82tGr9NBtxtlSqjAnTUWi+Erf5K9Kyk5Lqm1bEZJlZft8/lOoBs7 AURV/sTf4ohLsngxc3AT2Z+IkOAKInDm/EjXY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/QkfGwx1qN+bH6UcWAZ8ICsmNcw0HgeMWJLpOBUNdDM=; b=W1WrINr72EZwzEtX8A4EYrNlzM+7ukuv/Rkcy1OpAWo8uU8+kh3EUc1C9suscmy7tY NaPgG9sKrjWaJykWQs+HaP7A3TODQFxodhTvatGTUl5FKE3zx5nKR/YC77mPYt2n0/le w+9aNAkhxqOFhLOkcqXo+/ucNsShdM/t3M4NBbvT+aTxy7tiJBiChEslrKuckKo97p5D mNspt6xI4O/L81RBNDPVW+Xxv3h2OZ2va3gRb2r4crDRmoeAvxfY+IG14OTEh1fFbMF6 ExJfMLgf7Ejorok1GuNScLejGtBiTDVSf+m7QJxAL2kTkhQ0DRae9P2A/R9wf16xSuO+ 4lTw== X-Gm-Message-State: AIVw113FsvaBX0L4gJNVURhinheK6C+FO+NFORf7J0yNinI02b1zHA3h 3gor0qgsok8QfUWk X-Received: by 10.99.124.86 with SMTP id l22mr20022724pgn.344.1501010981009; Tue, 25 Jul 2017 12:29:41 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id 85sm30371425pfr.90.2017.07.25.12.29.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 12:29:40 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Sudeep Holla , Jassi Brar Subject: [PATCH for-4.9 07/10] mailbox: always wait in mbox_send_message for blocking Tx mode Date: Wed, 26 Jul 2017 00:59:13 +0530 Message-Id: <1501010956-27944-8-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> References: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sudeep Holla commit c61b781ee084e69855477d23dd33e7e6caad652c upstream. There exists a race when msg_submit return immediately as there was an active request being processed which may have completed just before it's checked again in mbox_send_message. This will result in return to the caller without waiting in mbox_send_message even when it's blocking Tx. This patch fixes the issue by waiting for the completion always if Tx is in blocking mode. Fixes: 2b6d83e2b8b7 ("mailbox: Introduce framework for mailbox") Reported-by: Alexey Klimov Signed-off-by: Sudeep Holla Reviewed-by: Alexey Klimov Signed-off-by: Jassi Brar Signed-off-by: Amit Pundir --- drivers/mailbox/mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 4a36632c236f..e9e6d6672967 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -261,7 +261,7 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg) msg_submit(chan); - if (chan->cl->tx_block && chan->active_req) { + if (chan->cl->tx_block) { unsigned long wait; int ret; From patchwork Tue Jul 25 19:29:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108673 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp939461qge; Tue, 25 Jul 2017 12:29:48 -0700 (PDT) X-Received: by 10.84.210.38 with SMTP id z35mr16939129plh.416.1501010988839; Tue, 25 Jul 2017 12:29:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501010988; cv=none; d=google.com; s=arc-20160816; b=ST9mXrZi+d/vWTp3Wam/LeXUfEzpC345yw6QZH9aJOkZgUnxTGAI7XqH8MBeHU10SN sKi5mu6ByZz/zrT1517WM6WxtNSlMaUx9yY31bJeSd7iySVHr34dMEVg01qjt8gLRtbJ QSnURCTVY6bPAwTTSrPBP0CvVeV6cOMi9MAmHKdiIn8awD35FSuTdluLq9v44tpNJVmU gdpQLeXYrFgDkNSH9VP6drLsjb6njU9WEaVMe8AJ2luLznykffR9SLG7rTPjBf0bFTv+ oDbe/klSLLzdyXWGUSHGGrcJEsAZorcBgYNIyDXAEmaMjcj6YleYQQsin8eTqJeSmGX6 rwsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=6IFgIby7D57QvOl0lmdYKnavz54HUz20je43/wyIIhg=; b=VelmAhWfLiqB+dVCfZl4uqyB6ADVFvJQhEHi0AO7R3flhQTPxWIvfh7fgUXwixBPzw 8HRN/BwfaWv1cbUeqe+M4Te5rqHpDlEBwVDKV4DgXi9gexYtb/yCKTTmHqfZF16K0IbJ lMaglol4fiWh/u9x3+bkXzsqjyu60Y0WDh5Ff1qBEPcb1mgv4hGakK7HhY4XgjXLhF8I 0D7iIG1Wsj0O9xoCezTagPWA0xf8lPPmNwAt0Q25SiE4klcVdeGTdeYDflmAc4QQsYwU AxC9wq4sO1ohCDaeJaWgzO9cReC8qzqZh7lIvj9pxUvPnc5r9n2F1a07dlcBUSAbG5aa rsPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=ezxq0vF/; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o129si8605553pga.543.2017.07.25.12.29.48; Tue, 25 Jul 2017 12:29:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=ezxq0vF/; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754505AbdGYT3q (ORCPT + 6 others); Tue, 25 Jul 2017 15:29:46 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:33491 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754316AbdGYT3o (ORCPT ); Tue, 25 Jul 2017 15:29:44 -0400 Received: by mail-pf0-f182.google.com with SMTP id s70so61993010pfs.0 for ; Tue, 25 Jul 2017 12:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6IFgIby7D57QvOl0lmdYKnavz54HUz20je43/wyIIhg=; b=ezxq0vF/jQqbUaheLHPllsaiaxLhgHA4j+3DZQH5X/CL8uvIYYA+I1eBCe9zskULqV My1EQHHj1j923FvRDNqYDp9obQPJE1dUlapzu7vE2LGHBJZ5Ub5fR1hsKTMjhb0Tiidl TYvs4M++Q8xGEqi1mQQ6CYIMGR8c9joSv/D28= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6IFgIby7D57QvOl0lmdYKnavz54HUz20je43/wyIIhg=; b=RnZwjOA15vTzzLDgSH2ZxNOw6JvOkuh6LfEt13aSwfWfkbP4jyP6JymffrSCk2eLGm 0vdhUsoUQwz+c4aK+upOVNll1bZvHLQXgenbdlj1aab8tShJPGnIEFHXTUpsBdIwjQ8y Y+qxNehcCCbotup8oG7+y9HEQSPdZUpW1qi1ZY4zZY8XIjjmWxg3RcwgzdyikhMhPAVP 0XfqoNzbG/x1XcEZ83FXgJhwb9QqJW+0GaEWXN2LehXZiW6kmFjHnTrLl/AiSfsAycPs 8OZLiwKt8ZqevZRcvKqc0H4YIJr9QGFyRZpdPaWJCI7fDs6GaSXWCUvQyTGdWq+gD5wV El+A== X-Gm-Message-State: AIVw1103iXVO8rfIrFyfjiWZX3bWkr0riDfOdFmw94nvkEeIaUaMsqoU os7gMusaVp9rD7kO X-Received: by 10.101.90.135 with SMTP id c7mr20158094pgt.168.1501010983794; Tue, 25 Jul 2017 12:29:43 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id 85sm30371425pfr.90.2017.07.25.12.29.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 12:29:42 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Sudeep Holla , Jassi Brar Subject: [PATCH for-4.9 08/10] mailbox: skip complete wait event if timer expired Date: Wed, 26 Jul 2017 00:59:14 +0530 Message-Id: <1501010956-27944-9-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> References: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sudeep Holla commit cc6eeaa3029a6dbcb4ad41b1f92876483bd88965 upstream. If a wait_for_completion_timeout() call returns due to a timeout, complete() can get called after returning from the wait which is incorrect and can cause subsequent transmissions on a channel to fail. Since the wait_for_completion_timeout() sees the completion variable is non-zero caused by the erroneous/spurious complete() call, and it immediately returns without waiting for the time as expected by the client. This patch fixes the issue by skipping complete() call for the timer expiry. Fixes: 2b6d83e2b8b7 ("mailbox: Introduce framework for mailbox") Reported-by: Alexey Klimov Signed-off-by: Sudeep Holla Signed-off-by: Jassi Brar Signed-off-by: Amit Pundir --- drivers/mailbox/mailbox.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index e9e6d6672967..77ac049e51b6 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -108,7 +108,7 @@ static void tx_tick(struct mbox_chan *chan, int r) if (mssg && chan->cl->tx_done) chan->cl->tx_done(chan->cl, mssg, r); - if (chan->cl->tx_block) + if (r != -ETIME && chan->cl->tx_block) complete(&chan->tx_complete); } @@ -272,8 +272,8 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg) ret = wait_for_completion_timeout(&chan->tx_complete, wait); if (ret == 0) { - t = -EIO; - tx_tick(chan, -EIO); + t = -ETIME; + tx_tick(chan, t); } } From patchwork Tue Jul 25 19:29:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108675 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp939720qge; Tue, 25 Jul 2017 12:30:06 -0700 (PDT) X-Received: by 10.84.140.107 with SMTP id 98mr22034131pls.97.1501011006305; Tue, 25 Jul 2017 12:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501011006; cv=none; d=google.com; s=arc-20160816; b=J7rquhOFkLbhpZrwM2f0/regvny2gEQQ3MAZtcdETZcoAZe+/UmzMYxzObKJT8djBa XxfxQdCq0hMGlmg8eHLuYCxRppNokjpYge95Mr24WYG4GLAXH6b4xZyS8I+00sxJVaKG OXn4xUpaCwmD2VsWgsKFo5izHmwAa7jOc07DU7uZRJMgbJuW7jMu8mdOzI+izwFKJCNj vvspgbWpnBsB5R8ror6vkdzDPEeNseq85MVL80C2ivwbub3s5HIjKNxH4c3A59T9Xfl1 CJAY7a4SsAkR9YUyGpYks3bqTSktFODmmaRm477bloEauXWAjuRRqWsVw+NQKxDr2Wo0 qC/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=fTRvvTJLcmSZRL/os8LfNz3eHQLtzt4cjPYTnsxJ35w=; b=a240PBC6eXeagCuBWwgG5FtJrnwspxcIpbLO9kVvsSY23TnIAkgLnKMB6GwURBy1qO B4di9cqjg4x0QNZdI9lo+Anh7JvHxycoi0z84hl1kUKKpzesRm1dm27griqbAnsTB4bb 7/qWEZCegmuHAd2chDAQQ2rtv8b4XGpCK5H321OQ+132DBROjDYPUAu6YhuFJjbA9W6c iZNpxm9A24OehfaNcfRdBgS+IsHonKaAwNsxAilQq7t0UI40U4vrA0jbAzYEnJwx/pCP af7epWH/KhNT5UVrZ0lXmHN6RBhvYlje/F0u5/Ao2VZJIjqLIID+zoTDRqo8kmHU5IJ7 xRug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=OL0B1G4w; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e66si8525288pgc.135.2017.07.25.12.30.05; Tue, 25 Jul 2017 12:30:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=OL0B1G4w; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753693AbdGYTaA (ORCPT + 6 others); Tue, 25 Jul 2017 15:30:00 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:34971 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754316AbdGYT3r (ORCPT ); Tue, 25 Jul 2017 15:29:47 -0400 Received: by mail-pf0-f170.google.com with SMTP id h29so26917332pfd.2 for ; Tue, 25 Jul 2017 12:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fTRvvTJLcmSZRL/os8LfNz3eHQLtzt4cjPYTnsxJ35w=; b=OL0B1G4wadnYRVN6vx3n+AfRApVlCp+5TIhj9PBWEFJO399P6muZpcPrmkMem24uNo uF4Qpa9thCs+JfG9oAJnUayl3LM25wYgWISROtvn22NpudVekUGx/AxaQ5NYOOyhdIYb XZXf3JggZVeNccWIBO9SZQu7Hlmhpc6BdA4zs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fTRvvTJLcmSZRL/os8LfNz3eHQLtzt4cjPYTnsxJ35w=; b=O96tlUgMvUsDzA+Sacw+vXKr4TX4RXZQVfGxDN1o6vt64WDAPe1yyBRV8rbgfHenYT Akrx6xsNcxKlKUuQCisLYEHgNRYwXEowBAtldte2uZa/ZTiYO15olum2aIU26jfdNOzi QT0jLChg7x9Dlo0+woagsCo1iy4kWV/xryqvgU8KZnWZdkigSR8wF2JH6M7mFRu2WNMA jIXUSa4L7GTOUNJmC6ZK3PFawQ/tVGegUrUXqx64t0Gn2sRrlmN/TejlHfgwZowQVq/u U0HHsMARDx8Lb8MUa+TWljZUTFS02LqHmgoDIDrd7Fy2oGL0pfD0KbKdKaQU0CajGeLP eeDg== X-Gm-Message-State: AIVw110N2p282lKP4hU7e9DrxqfFYCuZhjgiLwl5K5vgh6WMSTh56Isc m/NI7Eih8mAGQQke X-Received: by 10.99.44.206 with SMTP id s197mr20388034pgs.116.1501010986565; Tue, 25 Jul 2017 12:29:46 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id 85sm30371425pfr.90.2017.07.25.12.29.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 12:29:45 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Sudeep Holla , Jassi Brar Subject: [PATCH for-4.9 09/10] mailbox: handle empty message in tx_tick Date: Wed, 26 Jul 2017 00:59:15 +0530 Message-Id: <1501010956-27944-10-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> References: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sudeep Holla commit cb710ab1d8a23f68ff8f45aedf3e552bb90e70de upstream. We already check if the message is empty before calling the client tx_done callback. Calling completion on a wait event is also invalid if the message is empty. This patch moves the existing empty message check earlier. Fixes: 2b6d83e2b8b7 ("mailbox: Introduce framework for mailbox") Signed-off-by: Sudeep Holla Signed-off-by: Jassi Brar Signed-off-by: Amit Pundir --- drivers/mailbox/mailbox.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 77ac049e51b6..87ef465c6947 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -104,8 +104,11 @@ static void tx_tick(struct mbox_chan *chan, int r) /* Submit next message */ msg_submit(chan); + if (!mssg) + return; + /* Notify the client */ - if (mssg && chan->cl->tx_done) + if (chan->cl->tx_done) chan->cl->tx_done(chan->cl, mssg, r); if (r != -ETIME && chan->cl->tx_block) From patchwork Tue Jul 25 19:29:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108674 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp939577qge; Tue, 25 Jul 2017 12:29:55 -0700 (PDT) X-Received: by 10.84.232.135 with SMTP id i7mr22356933plk.193.1501010995724; Tue, 25 Jul 2017 12:29:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501010995; cv=none; d=google.com; s=arc-20160816; b=BM2q0ATRdffsx7FshRes7ZIRrYpRFy023RmMwUmryvRdmFasYwb1BnKsSRjp9ri1rj 8g3Ot/8w9owa/RZbf/2fP0sDp8mB/c7OONFLI0ch5KwhrAUATgH0YtkIg7Wck/loBTyU 1Da/wDqEhBL2ELfD8CKqYBw/3R5iH+FKylMdGqGxrqIRT82/UzJfrXXr1G1cO1MxIrHi pyM+vQ0jFxEOkYPKqNbInsxzwPj1DNvHHEKX15ZW48poDY6NMtMFhRW2AXSL6wErRWz8 vkP/5wxdjuDuYJNiV6Np0hD0pvi+lpYk4UsWvQVkwFInjjxditOvRmCdFN7oE0vOA+UX A+BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=NZU+wft7CbEO9JpYDeYAk3wtG0OrN9MuE4DoaJIf3Qs=; b=fOQqPyGt7z+mAs1d2VOwYIPLWWdl1irCeI2aJtKKUX2BK6hVDz4lw5j3Wpt4uxyXx4 gokII9Ab/Q105nCZ2XhVNjRAo4kRLIQxLAZ9hkCdLN/0togISyCn//wVD9l0yfJkSMRx SQx/WSlyhpVu5UVqA+McATI+6rIjPHVgIM2O7X+3gfD5ufqhqV6Tx0UePxSIr6m9F3Xj jzKpOYseYklHVU81YINRotvvjov3kNdGxf1W6nSHit53Kadt/68b1a27p29mp0/t1i2n Z7K5QX8een2U3/xYeQN8ndKiMnuB87JAMk+mYjBUBRYMr+Bza8Us6Yg0plsNxXTYlbYI +Rcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=gcgFaZGS; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o128si5866746pga.856.2017.07.25.12.29.55; Tue, 25 Jul 2017 12:29:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=gcgFaZGS; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753034AbdGYT3w (ORCPT + 6 others); Tue, 25 Jul 2017 15:29:52 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:36769 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754251AbdGYT3u (ORCPT ); Tue, 25 Jul 2017 15:29:50 -0400 Received: by mail-pf0-f181.google.com with SMTP id z129so22420988pfb.3 for ; Tue, 25 Jul 2017 12:29:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NZU+wft7CbEO9JpYDeYAk3wtG0OrN9MuE4DoaJIf3Qs=; b=gcgFaZGSOkfHCBY42I/9jLXNt0WJu6rVazZuMCXEKfybTx4n7yrcFtvOBEDo1OPVXU eKNBSSDb310FNGCJFjBBKdKVneOMEOXZoDCfqseoPdbgPjU5G1MZ/Q1Mp2HMdJbXHxnI ZCtXKZS1X1Ql42JXBBVhKP+VyolmPC5TbcLh0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NZU+wft7CbEO9JpYDeYAk3wtG0OrN9MuE4DoaJIf3Qs=; b=C91lGW93QqKjB7ZXeBe/3aLpG/NQ9YQUEclN8PrLfheSs+Ao4uzSyF92sAK+nC7odu l5g/SsFuc1dRMFdSigjrBuX98M30fEeN6b1qciNk4tLOwR2DLFeZ4IvQLtm30U8E3s5b TTrlGkotWGswzzYA6y6CA9ug/Bj+3KfjpMavp8hp4CSn7rR4kbgHSm3W7VmmIsCO9rmj kpjZehvd+VJ2wlcepcf6Qu50FgOb06wLWkEjh/N+LMwajXJIv07rgtkNNKQJ8HrnfewD QVXMOxkjqB7SvjGuOhfpSFVlwinxA9br+WH70G/qsMWmKjZldhzDFVNt2DiL8J5E3mrB F2SQ== X-Gm-Message-State: AIVw111binEekm11VOytpZ6gQ92q7R/lxwDkY2PaboW/0oc9q0voOJic iAi8g1sLzcO+c+1psmj0tA== X-Received: by 10.99.55.79 with SMTP id g15mr20511601pgn.28.1501010989468; Tue, 25 Jul 2017 12:29:49 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id 85sm30371425pfr.90.2017.07.25.12.29.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 12:29:48 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Herbert Xu , Steffen Klassert Subject: [PATCH for-4.9 10/10] af_key: Fix sadb_x_ipsecrequest parsing Date: Wed, 26 Jul 2017 00:59:16 +0530 Message-Id: <1501010956-27944-11-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> References: <1501010956-27944-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Herbert Xu commit 096f41d3a8fcbb8dde7f71379b1ca85fe213eded upstream. The parsing of sadb_x_ipsecrequest is broken in a number of ways. First of all we're not verifying sadb_x_ipsecrequest_len. This is needed when the structure carries addresses at the end. Worse we don't even look at the length when we parse those optional addresses. The migration code had similar parsing code that's better but it also has some deficiencies. The length is overcounted first of all as it includes the header itself. It also fails to check the length before dereferencing the sa_family field. This patch fixes those problems in parse_sockaddr_pair and then uses it in parse_ipsecrequest. Reported-by: Andrey Konovalov Signed-off-by: Herbert Xu Signed-off-by: Steffen Klassert Signed-off-by: Amit Pundir --- net/key/af_key.c | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) -- 2.7.4 diff --git a/net/key/af_key.c b/net/key/af_key.c index e67c28e614b9..d8d95b6415e4 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -65,6 +65,10 @@ struct pfkey_sock { } dump; }; +static int parse_sockaddr_pair(struct sockaddr *sa, int ext_len, + xfrm_address_t *saddr, xfrm_address_t *daddr, + u16 *family); + static inline struct pfkey_sock *pfkey_sk(struct sock *sk) { return (struct pfkey_sock *)sk; @@ -1922,19 +1926,14 @@ parse_ipsecrequest(struct xfrm_policy *xp, struct sadb_x_ipsecrequest *rq) /* addresses present only in tunnel mode */ if (t->mode == XFRM_MODE_TUNNEL) { - u8 *sa = (u8 *) (rq + 1); - int family, socklen; + int err; - family = pfkey_sockaddr_extract((struct sockaddr *)sa, - &t->saddr); - if (!family) - return -EINVAL; - - socklen = pfkey_sockaddr_len(family); - if (pfkey_sockaddr_extract((struct sockaddr *)(sa + socklen), - &t->id.daddr) != family) - return -EINVAL; - t->encap_family = family; + err = parse_sockaddr_pair( + (struct sockaddr *)(rq + 1), + rq->sadb_x_ipsecrequest_len - sizeof(*rq), + &t->saddr, &t->id.daddr, &t->encap_family); + if (err) + return err; } else t->encap_family = xp->family; @@ -1954,7 +1953,11 @@ parse_ipsecrequests(struct xfrm_policy *xp, struct sadb_x_policy *pol) if (pol->sadb_x_policy_len * 8 < sizeof(struct sadb_x_policy)) return -EINVAL; - while (len >= sizeof(struct sadb_x_ipsecrequest)) { + while (len >= sizeof(*rq)) { + if (len < rq->sadb_x_ipsecrequest_len || + rq->sadb_x_ipsecrequest_len < sizeof(*rq)) + return -EINVAL; + if ((err = parse_ipsecrequest(xp, rq)) < 0) return err; len -= rq->sadb_x_ipsecrequest_len; @@ -2417,7 +2420,6 @@ static int key_pol_get_resp(struct sock *sk, struct xfrm_policy *xp, const struc return err; } -#ifdef CONFIG_NET_KEY_MIGRATE static int pfkey_sockaddr_pair_size(sa_family_t family) { return PFKEY_ALIGN8(pfkey_sockaddr_len(family) * 2); @@ -2429,7 +2431,7 @@ static int parse_sockaddr_pair(struct sockaddr *sa, int ext_len, { int af, socklen; - if (ext_len < pfkey_sockaddr_pair_size(sa->sa_family)) + if (ext_len < 2 || ext_len < pfkey_sockaddr_pair_size(sa->sa_family)) return -EINVAL; af = pfkey_sockaddr_extract(sa, saddr); @@ -2445,6 +2447,7 @@ static int parse_sockaddr_pair(struct sockaddr *sa, int ext_len, return 0; } +#ifdef CONFIG_NET_KEY_MIGRATE static int ipsecrequests_to_migrate(struct sadb_x_ipsecrequest *rq1, int len, struct xfrm_migrate *m) { @@ -2452,13 +2455,14 @@ static int ipsecrequests_to_migrate(struct sadb_x_ipsecrequest *rq1, int len, struct sadb_x_ipsecrequest *rq2; int mode; - if (len <= sizeof(struct sadb_x_ipsecrequest) || - len < rq1->sadb_x_ipsecrequest_len) + if (len < sizeof(*rq1) || + len < rq1->sadb_x_ipsecrequest_len || + rq1->sadb_x_ipsecrequest_len < sizeof(*rq1)) return -EINVAL; /* old endoints */ err = parse_sockaddr_pair((struct sockaddr *)(rq1 + 1), - rq1->sadb_x_ipsecrequest_len, + rq1->sadb_x_ipsecrequest_len - sizeof(*rq1), &m->old_saddr, &m->old_daddr, &m->old_family); if (err) @@ -2467,13 +2471,14 @@ static int ipsecrequests_to_migrate(struct sadb_x_ipsecrequest *rq1, int len, rq2 = (struct sadb_x_ipsecrequest *)((u8 *)rq1 + rq1->sadb_x_ipsecrequest_len); len -= rq1->sadb_x_ipsecrequest_len; - if (len <= sizeof(struct sadb_x_ipsecrequest) || - len < rq2->sadb_x_ipsecrequest_len) + if (len <= sizeof(*rq2) || + len < rq2->sadb_x_ipsecrequest_len || + rq2->sadb_x_ipsecrequest_len < sizeof(*rq2)) return -EINVAL; /* new endpoints */ err = parse_sockaddr_pair((struct sockaddr *)(rq2 + 1), - rq2->sadb_x_ipsecrequest_len, + rq2->sadb_x_ipsecrequest_len - sizeof(*rq2), &m->new_saddr, &m->new_daddr, &m->new_family); if (err)