Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3924436pxj; Mon, 21 Jun 2021 09:29:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvkFS2qohp+9e7ybQonQtEEi88zpYZ6HtJG4xifejuEq1GHBQmNECDezzcKBSd8TkTQCwr X-Received: by 2002:a17:907:c16:: with SMTP id ga22mr25868129ejc.116.1624292950978; Mon, 21 Jun 2021 09:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624292950; cv=none; d=google.com; s=arc-20160816; b=AaCJ0RqWf/i/RqQ4c+vO5euzQ1YIFTIB7NQZKc2G4qxHY0M64ZQFCnnPhv/n82CiWJ F4wgl37OT6WwUO8ktK0UvRFCMJoJfoXPzrpL6tPKh4ZTewbq46U3KSUDzq5+evvQGDOq U1fiFljyHxIfrLloc3GfcSYAQhd0sZxDLi7bjJBniWWigYwzlgbm4A7bou4eF/5Di2nG NqTy/hXmI7PHIgF/mP6ZuHHZhljgArlpQAY/Bgcc5K/CB3Wa39BUpW4WVwe/9HaTeC+k 0k8PALvuYhvcMzy01nHIj2IxzNF/NFPj/pp23CAvkqM51xQ07XnowjHYwC/eFgQ/Z6eA G/Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UdYzNbj2gR3gCI6/gyyiGZdIVPer8BLOZwte1c/V59w=; b=0dEwATFFKsIeNq6v0EkzMboxW1M4GC5CF89wXOR2eAEih48aD1LRUICuwaycbVW3mI q558aY2Vxp+YbcVA/VY3vtoZnlNfE+pXEcf4k4pppUnRpV+GQYY9YAX2pBfALd4MXp3L lBmHA/JK6+OHHE+t90IueKgykzug5R/PKJ8iNY+4/mZl+puJ43EMmHrkKYEZ7L84ODxp QrP7h3k8aMF23Veg6jLy6nne6wB2ETrFGY0+WhkAjS1erYG4txIyOIjIAPeSKDvkW/Di +AYjpc0yXiYdbPzQ0/UdmOmNE51QbdKPXgoA0SOWvMY4z3bKoqdBRAs5HFKcTLRHfjrs Of7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vlv7cRmt; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si18495247edc.207.2021.06.21.09.28.48; Mon, 21 Jun 2021 09:29:10 -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=@linuxfoundation.org header.s=korg header.b=Vlv7cRmt; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231209AbhFUQ3o (ORCPT + 99 others); Mon, 21 Jun 2021 12:29:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:49790 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232029AbhFUQ1g (ORCPT ); Mon, 21 Jun 2021 12:27:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1FC24613E8; Mon, 21 Jun 2021 16:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292579; bh=TQ8IPQXY75jtU1OWQu9A+36NPPEwaM6gv/UUn4Qn4DU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vlv7cRmtbJRfaAaZWi88uREd+bGSC1XuHbXGDfdTc9y+arzPE9UCC36RdvtRjuLFQ o8wEXJlNh2I6XMTtNETQ+yXPh4fmFR8wpiB1O009y22rqYZV2iMH2Dqg3P3ZA4luXJ aOuqovaLIe4fuqBIKt9+e29V1MHFYxFJUaJOuYU0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Bjorn Andersson , "David S. Miller" , Sasha Levin , syzbot+1917d778024161609247@syzkaller.appspotmail.com Subject: [PATCH 5.10 053/146] net: qrtr: fix OOB Read in qrtr_endpoint_post Date: Mon, 21 Jun 2021 18:14:43 +0200 Message-Id: <20210621154913.812385167@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154911.244649123@linuxfoundation.org> References: <20210621154911.244649123@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Skripkin [ Upstream commit ad9d24c9429e2159d1e279dc3a83191ccb4daf1d ] Syzbot reported slab-out-of-bounds Read in qrtr_endpoint_post. The problem was in wrong _size_ type: if (len != ALIGN(size, 4) + hdrlen) goto err; If size from qrtr_hdr is 4294967293 (0xfffffffd), the result of ALIGN(size, 4) will be 0. In case of len == hdrlen and size == 4294967293 in header this check won't fail and skb_put_data(skb, data + hdrlen, size); will read out of bound from data, which is hdrlen allocated block. Fixes: 194ccc88297a ("net: qrtr: Support decoding incoming v2 packets") Reported-and-tested-by: syzbot+1917d778024161609247@syzkaller.appspotmail.com Signed-off-by: Pavel Skripkin Reviewed-by: Bjorn Andersson Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/qrtr/qrtr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index 93a7edcff11e..0d9baddb9cd4 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -429,7 +429,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len) struct qrtr_sock *ipc; struct sk_buff *skb; struct qrtr_cb *cb; - unsigned int size; + size_t size; unsigned int ver; size_t hdrlen; -- 2.30.2