Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp532846ybh; Sun, 12 Jul 2020 14:37:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrj+CJFx6Tsz3APn+/czXscjJpSUkeBW0gWTSoxCPMVsNY8oJn5hoa0+PrgbGK7mjVms6M X-Received: by 2002:a17:907:4240:: with SMTP id oi24mr69096494ejb.23.1594589835669; Sun, 12 Jul 2020 14:37:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594589835; cv=none; d=google.com; s=arc-20160816; b=ll9RWpdj270bq1E9TP7doQw1yBTHPit7mb8FiZzXgeuvhOYEQzJTczi5/9kmNEpd5K q8TI6z6mq2WalktLbo1GJN7MxzsBD6YYG/72cbUeoM9TokEdcze7bVw4AqrhtWXxuJnv NsL+W7gxaZnjrLHxNhobGx3KXD7h4zUzrCgnmFBE0FM15DYibL3Vu2XUtUndgN6jsEQY 5vd5Hi7ss/85kaPTgV6vyYpXAdXno+s0q3Zox1k6h9Q2MXXkVevG9kU06kbBwjFy/DNL /vLKfhnhQOl75n1tzhDjMcp/wC357yIB0dB+CxRqaNB3eRBMy8qbnpZ2RkLQBOUs1ir2 uCSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ZkO+t5dbjcJLbnR/qS+Q5R9LlkYLG9ghrCbxZXCZ2qI=; b=q3llBJUAkOkAYW+6jWcheI0RTtIVaIbm6PvDd/AS9ickNA4O5C+LMQNQLLVqxBle+s 0mn1QfyljaaLVAChhrJzuLtJMqAGJy8DoJpVEerHjzjmZbdCMxI/4I0PHwq2gXgH3PJe t0pyxQbo6xbydtJDB1uPb57MWmNur78h6bWWGk0TwIzJYUL2GJXkveQDPlbj4kQq6FtC t9/smcnKuXGTRwJ0PkGz/XscB2IbgTWj8Y5GLZCCIlHCWSU7PhQ3UCkNBodmpSsFDSlU xxaS5afRNjWDUAbmXn1sO8DYNMLqZ5a1NPfb1k4LSrkQqBcVunjvJ49jHvOIzOiWqXgd uUow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kyM2cyiE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j8si8117957ejs.237.2020.07.12.14.36.38; Sun, 12 Jul 2020 14:37:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kyM2cyiE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729459AbgGLVge (ORCPT + 99 others); Sun, 12 Jul 2020 17:36:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:42712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729020AbgGLVgd (ORCPT ); Sun, 12 Jul 2020 17:36:33 -0400 Received: from sol.localdomain (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 229BA20674; Sun, 12 Jul 2020 21:36:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594589793; bh=LaukERu2pv75LoRhGqzTdKknNVP0Uslzw4bshPJDjGU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kyM2cyiEITBrG5oIVpYyR4sxM6ZHAlQtrGYEedEQtuZUVF8OxssMF9d/SiWt2H7Bx W7xyNnYvIxxfOVRxpUNs1t5hO9OZcEQorI5Qbom3a1RV3HcJwby6lDBJU2Fa+riMch TW88A8oZWfecMj0VbvXNhDGfRK9kXwhaKsRQsXSc= Date: Sun, 12 Jul 2020 14:36:31 -0700 From: Eric Biggers To: Peilin Ye Cc: "David S . Miller" , Jakub Kicinski , Navid Emamdoost , Christophe JAILLET , Greg Kroah-Hartman , Dan Carpenter , netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com, linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org Subject: Re: [Linux-kernel-mentees] [PATCH net] qrtr: Fix ZERO_SIZE_PTR deref in qrtr_tun_write_iter() Message-ID: <20200712213631.GA809@sol.localdomain> References: <20200712210300.200399-1-yepeilin.cs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200712210300.200399-1-yepeilin.cs@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 12, 2020 at 05:03:00PM -0400, Peilin Ye wrote: > qrtr_tun_write_iter() is dereferencing `ZERO_SIZE_PTR`s when `from->count` > equals to zero. Fix it by rejecting zero-length kzalloc() requests. > > This patch fixes the following syzbot bug: > > https://syzkaller.appspot.com/bug?id=f56bbe6668873ee245986bbd23312b895fa5a50a > > Reported-by: syzbot+03e343dbccf82a5242a2@syzkaller.appspotmail.com > Signed-off-by: Peilin Ye > --- > net/qrtr/tun.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/net/qrtr/tun.c b/net/qrtr/tun.c > index 15ce9b642b25..5465e94ba8e5 100644 > --- a/net/qrtr/tun.c > +++ b/net/qrtr/tun.c > @@ -80,6 +80,9 @@ static ssize_t qrtr_tun_write_iter(struct kiocb *iocb, struct iov_iter *from) > ssize_t ret; > void *kbuf; > > + if (!len) > + return -EINVAL; > + > kbuf = kzalloc(len, GFP_KERNEL); > if (!kbuf) > return -ENOMEM; Wasn't this already fixed by: commit 8ff41cc21714704ef0158a546c3c4d07fae2c952 Author: Dan Carpenter Date: Tue Jun 30 14:46:15 2020 +0300 net: qrtr: Fix an out of bounds read qrtr_endpoint_post()