Received: by 10.213.65.68 with SMTP id h4csp911590imn; Tue, 27 Mar 2018 11:03:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx48l58tIDHYoShIGQe74l4YCdbxbcjIlUMu3bOHbaMUkR+t9wt5gAU4srVoKNd1u0Dcb7DHp X-Received: by 2002:a17:902:a607:: with SMTP id u7-v6mr281805plq.367.1522173803870; Tue, 27 Mar 2018 11:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522173803; cv=none; d=google.com; s=arc-20160816; b=Z4l9CAxDyNizVb+okv5GdbNJlu9RKXn22CwlkBHm9XNiKKkPf676Mmic2ocwJNh1F3 LbRhMZcoNe+GfEXJ6WAPG+kfOBbaBx87QBM/PEo1HVxdRCkAiQmZDla148j4KQ/6UJu3 V0QkKJ8Ogll8V3hcpVDThWSG6yQ0Kr0gtABCKHzMniU6QpWEhvNvMUmXMGBWlvtHJRcl 2o5PSDHF1lX/6sfZ4dt3x+xpchQMMpZAx5YBZGZ3dxVkvSnxPX77cmnWpOx7+D+JbVty uSRNb7JhH7H9LO4G9LJTzDrnOhCKW+JvhbTt8vdCkuwYgsFwx7SLjkKAoVsdHZPSDqdQ DRnQ== 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=f3HvRodcle/4p6ugWV8k/x/PWziHxgRobXOz24bPIh4=; b=Zmy+peyoIYGVJJvD1ctThS1ISAmstPaQKZTNNIbc0nutbo4XdP3K7rn8BuS7Vqm+V3 bIEtAZZ/hsS21K8txAICsvYCcy9Z3oFzi2GB4HEnwbHKYnA6/G07N9NDlHhO2hgs8jEO bTpcD+9kO40UXRghKxA+4eCWaJi3bA9sLW2IC/VGG4ifk7V4A/VDX1u7NKMgPcDpfk9b aAqaFBksVhPhxjRlFuLGYel39TqzNgkoyejFFL1Bzelmhio4VFnP5u/mgFyLHoK1EWLf +5CXVpbYJ+qLDA3HuQKzzTxQOmB8YZx91JPOfzNzuJfOS4k7KBx6Jbfrn1kQb8Y56JwC 3fXQ== 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 91-v6si1651500pld.396.2018.03.27.11.03.09; Tue, 27 Mar 2018 11:03:23 -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 S1752974AbeC0QaI (ORCPT + 99 others); Tue, 27 Mar 2018 12:30:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41616 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752923AbeC0QaF (ORCPT ); Tue, 27 Mar 2018 12:30:05 -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 4C6B81130; Tue, 27 Mar 2018 16:30:04 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+f7b556d1766502a69d85071d2ff08bd87be53d0f@syzkaller.appspotmail.com, Eric Biggers , Tejun Heo Subject: [PATCH 4.4 13/43] libata: remove WARN() for DMA or PIO command without data Date: Tue, 27 Mar 2018 18:27:17 +0200 Message-Id: <20180327162717.131571418@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162716.407986916@linuxfoundation.org> References: <20180327162716.407986916@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: Eric Biggers commit 9173e5e80729c8434b8d27531527c5245f4a5594 upstream. syzkaller hit a WARN() in ata_qc_issue() when writing to /dev/sg0. This happened because it issued a READ_6 command with no data buffer. Just remove the WARN(), as it doesn't appear indicate a kernel bug. The expected behavior is to fail the command, which the code does. Here's a reproducer that works in QEMU when /dev/sg0 refers to a disk of the default type ("82371SB PIIX3 IDE"): #include #include int main() { char buf[42] = { [36] = 0x8 /* READ_6 */ }; write(open("/dev/sg0", O_RDWR), buf, sizeof(buf)); } Fixes: f92a26365a72 ("libata: change ATA_QCFLAG_DMAMAP semantics") Reported-by: syzbot+f7b556d1766502a69d85071d2ff08bd87be53d0f@syzkaller.appspotmail.com Cc: # v2.6.25+ Signed-off-by: Eric Biggers Signed-off-by: Tejun Heo Signed-off-by: Greg Kroah-Hartman --- drivers/ata/libata-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5077,8 +5077,7 @@ void ata_qc_issue(struct ata_queued_cmd * We guarantee to LLDs that they will have at least one * non-zero sg if the command is a data command. */ - if (WARN_ON_ONCE(ata_is_data(prot) && - (!qc->sg || !qc->n_elem || !qc->nbytes))) + if (ata_is_data(prot) && (!qc->sg || !qc->n_elem || !qc->nbytes)) goto sys_err; if (ata_is_dma(prot) || (ata_is_pio(prot) &&