Received: by 10.192.165.156 with SMTP id m28csp1069972imm; Wed, 11 Apr 2018 11:52:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx49oGUo9cCMoa3Tkgzyc0atWNNPUNh47kbH69ZuSy/UqWTo5GAADygtPPOurZn5QzrvKVixn X-Received: by 2002:a17:902:32a2:: with SMTP id z31-v6mr6429305plb.41.1523472750675; Wed, 11 Apr 2018 11:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523472750; cv=none; d=google.com; s=arc-20160816; b=Ac/+x8H2hWERCnLVBwOoePPdQbygvjG7PnprA5cYB8REAE8Zn7lmjc/NKLv/Jh6Jfi tk+JhRyqadx3UkJGHorjL1AdNUPVH0f9sHA5GnIq0HnfM7hwehhcZeHAdJYAsdloDDj0 bJy5BDG5MiSGqS+638n0aQNblgo3pJAMURpgNJuTFOxIaI7V/JXzbrXlZhKoMSY0Cadn E+A+S4M2V6jyB332UIE8U+fJUgn9/4ygB7mzjRgKUnlQbPH8bkIu9LlygEXRX9TyOxIU vGIauDXbV+ni0pSmgmsjQn9I5mYB1O5mjSEtWNgfJWs8zOQP5fhtGw4OhgicMES9MF4n 39lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ATL+wgK2OPVaDRbJAY5fiXWgjpSrm55qOE6yVU54ooU=; b=NwJOkjsbq3L9Krkk7b0EzDE0xcAor5J4RdjKMEWpDOv5D3yCEQR3YPjEWxIoqkBoKQ 83HiYthdtyEdI9tmgCochBkgA46w2oxWHucGwh/l0GjsJU7VFxz1/pJiInUEqh6pkDSl J1/7NtuUtRtQaP336ClwmIjd5s+GqKL/1fRVdd/aFmwt1Ca/DUpEq/WA78AWaZwPDU9z 8QS4uuZ6KFohrZlII/IQSI1knA4wWeBb6eVSc15hcTOKSa9WF3OmaH2NF7rvLLFeXC2S sKdt7AUuUbB5AwLo7/8NRrmyzdda4kvdjpKUzWSJUxNj9/frd9Yt6oNX63JOtodlVLI5 3ncg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d70si1308612pfl.219.2018.04.11.11.51.53; Wed, 11 Apr 2018 11:52:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755533AbeDKSp3 (ORCPT + 99 others); Wed, 11 Apr 2018 14:45:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58594 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755500AbeDKSp0 (ORCPT ); Wed, 11 Apr 2018 14:45:26 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AD890CA5; Wed, 11 Apr 2018 18:45:25 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Sasha Levin Subject: [PATCH 4.4 046/190] USB: ene_usb6250: fix SCSI residue overwriting Date: Wed, 11 Apr 2018 20:34:52 +0200 Message-Id: <20180411183552.878367495@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183550.114495991@linuxfoundation.org> References: <20180411183550.114495991@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alan Stern [ Upstream commit aa18c4b6e0e39bfb00af48734ec24bc189ac9909 ] In the ene_usb6250 sub-driver for usb-storage, the SCSI residue is not reported correctly. The residue is initialized to 0, but this value is overwritten whenever the driver sends firmware to the card reader before performing the current command. As a result, a valid READ or WRITE operation appears to have failed, causing the SCSI core to retry the command multiple times and eventually fail. This patch fixes the problem by resetting the SCSI residue to 0 after sending firmware to the device. Signed-off-by: Alan Stern Reported-and-tested-by: Andreas Hartmann Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/ene_ub6250.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/usb/storage/ene_ub6250.c +++ b/drivers/usb/storage/ene_ub6250.c @@ -1953,6 +1953,8 @@ static int ene_load_bincode(struct us_da bcb->CDB[0] = 0xEF; result = ene_send_scsi_cmd(us, FDIR_WRITE, buf, 0); + if (us->srb != NULL) + scsi_set_resid(us->srb, 0); info->BIN_FLAG = flag; kfree(buf);