Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4821746ybl; Wed, 22 Jan 2020 05:24:05 -0800 (PST) X-Google-Smtp-Source: APXvYqx5ZZeHoSt9qBvAS0cRpUEdfILyX5Pky9UXegkwgqScrUuteen9nEYUw/UzEn0OK+pxs5fp X-Received: by 2002:a9d:7cd9:: with SMTP id r25mr6857656otn.326.1579699445212; Wed, 22 Jan 2020 05:24:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579699445; cv=none; d=google.com; s=arc-20160816; b=OaAzqXTCzbSmodlAA+MKFUU3kxlf0qvbwg/OmHRDvwxpWXBdOANIixCmTblUaOyL8D TRmpH+9dSojcAIhB5rrM8lDCSCcfFR+7yfWXOW6HTevQqUVWFKE0IF3Zvjc0b1Ru6RzX 9ytTHT1IsfMKXReLw3jKLn1o4KBC4Ks2AT2twrTsGYxQEzE1n8wIv0z9I61D3Uns6d9q mIFZjf0XTbjobc2zEa5gaheH8nWbgdTGxv4m7SsJ9yR8eVbXJvA4/UbxnLpVjt4iBv8F gRQaqD13W+iRiUQPmeBgqdTHiJfmh6a17ApeWnLmN6qXTT4QGoOf8D1EAHEJAhaaK6vz CSMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1SiISg5p5HEIWyW7YFukekAo2mDjxlNSeFoE9PloTFI=; b=UKZlSRTOfYK1OAl126I2KdROuxDQYSDxRTRHLqfKpvnLZHzn1o/8y/mCcWMKKXag73 oIneNheCSRvYnT8eZKMsDs4LZvWH7snNGj2W53iokPHizbGaO0U2BPyMqN6/28KhbS3H 5h34rhevkONUzfIeO1XJ9h/Rrr2f9RKkOAPS746U0OzqI7T3Al9IaHdGU7QZl4Hydtft 94Y3VRkmDz6BH0chn2o0TAeidU+hY/jDCg5nPUg/t6e3dX/gJE1LC5h4nzXFgdJDl3Fw 9j3A7Ll2tO45bPULBwBqdvBxAhPH70+Wc0m40n4SpegaVaBJ6UFHlfB5csd/SShJ/c5n K7IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gMMI4rMm; 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 f204si18186328oia.43.2020.01.22.05.23.53; Wed, 22 Jan 2020 05:24:05 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=gMMI4rMm; 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 S1730635AbgAVNWm (ORCPT + 99 others); Wed, 22 Jan 2020 08:22:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:40438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729425AbgAVNWl (ORCPT ); Wed, 22 Jan 2020 08:22:41 -0500 Received: from localhost (unknown [84.241.205.26]) (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 6D49B2468C; Wed, 22 Jan 2020 13:22:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699361; bh=G5oThlaiHggG4BtupsoslD6PHZ8zb7l3LumKJofs4bo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gMMI4rMmH2whEprWlpMW8Bjl8daeuIsK1XeFUcrhK9tTa7damSrHTjl0GThrn/r+e qkbq3cXgatMnPkg51e6AnjAYx091xRmwrb3FUZO/KdKmQxCi2Bgo/VO1nF6cqWQ9rz cVtLF/j/TlTJqEEBGi4aNZ//cJFRT4QKoEjmV/X4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Johannes Berg Subject: [PATCH 5.4 121/222] cfg80211: fix page refcount issue in A-MSDU decap Date: Wed, 22 Jan 2020 10:28:27 +0100 Message-Id: <20200122092842.401964700@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092833.339495161@linuxfoundation.org> References: <20200122092833.339495161@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Felix Fietkau commit 81c044fc3bdc5b7be967cd3682528ea94b58c06a upstream. The fragments attached to a skb can be part of a compound page. In that case, page_ref_inc will increment the refcount for the wrong page. Fix this by using get_page instead, which calls page_ref_inc on the compound head and also checks for overflow. Fixes: 2b67f944f88c ("cfg80211: reuse existing page fragments in A-MSDU rx") Cc: stable@vger.kernel.org Signed-off-by: Felix Fietkau Link: https://lore.kernel.org/r/20200113182107.20461-1-nbd@nbd.name Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/wireless/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -564,7 +564,7 @@ __frame_add_frag(struct sk_buff *skb, st struct skb_shared_info *sh = skb_shinfo(skb); int page_offset; - page_ref_inc(page); + get_page(page); page_offset = ptr - page_address(page); skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size); }