From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 568BFC2D0DB for ; Wed, 22 Jan 2020 09:44:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1DCCB2468E for ; Wed, 22 Jan 2020 09:44:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579686253; bh=3rHlzasWHcPAFaggQC/NRvYs/QBTLjHsJ2g+/APZs0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gbQ5rIt7x1XVjVNtXXInv+X7J3O1azlbnh5WTIxokdF2Qnd6zbOyRc2csYLQabxbp ihNMcPsYtVzFGXBXQi9ho8+dEwZGrYSwsyDCC35kaB+HgBt/eHWx0GIYheyThBYjJQ GOP+QYgM0GAMKC8tBhjbRQjHUMWSLKutRqTkDins= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388010AbgAVJoM (ORCPT ); Wed, 22 Jan 2020 04:44:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:37094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388002AbgAVJoJ (ORCPT ); Wed, 22 Jan 2020 04:44:09 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 3587E24689; Wed, 22 Jan 2020 09:44:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579686248; bh=3rHlzasWHcPAFaggQC/NRvYs/QBTLjHsJ2g+/APZs0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s6Z3qktDFGapnkOsL6ENGy6oXflMsozkk7iuIkhQ5pTNxbl0CRpgp4gA7QttBBYpY mD4TYFtIM1P4ooLhZs8JhJLgRoFutEinoUH3CSXcXYYhMuHX0jZcB5xHO8b8RnP1jl RHA8BpZiQexnNMXxWHKCZf1Iad4+ez7Vgwb/1W2U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , Johannes Berg Subject: [PATCH 4.19 058/103] cfg80211: fix page refcount issue in A-MSDU decap Date: Wed, 22 Jan 2020 10:29:14 +0100 Message-Id: <20200122092812.743594611@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092803.587683021@linuxfoundation.org> References: <20200122092803.587683021@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 @@ -537,7 +537,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); }