Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1967722ima; Thu, 25 Oct 2018 07:42:35 -0700 (PDT) X-Google-Smtp-Source: AJdET5fLWxfdSjs+jCB623GqUEY1bK9zuMB5DRePGLFrGVzAzJGqcnYgr/y/HM6QIgGg1LLujul6 X-Received: by 2002:a63:ac46:: with SMTP id z6mr1743655pgn.162.1540478555448; Thu, 25 Oct 2018 07:42:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540478555; cv=none; d=google.com; s=arc-20160816; b=t/eG34+XYAaVVw8i8q9Aj/skoXdn8MZkpEAePTia9j5gEnB82N3G3apgpDNTQQcmhV mkt2NfxuEQzQ6QOvQ4Lu+FuG9j40uaGFc1b0Jj1jVRK+l1judwZOYG4+m7VBTN3TSUPj VXmYaRl3bXqA2v4DJMP/gPSBynPc9qEEWqsiBSjT3kx1NunUjK7vkOxBuOGSFHhzVNJh eNeZ7yP8XnUkOWMXpQY9Jx6Ov8nxuldk7CrBeqFa1rcSJQibMAtevuN4pk/Kbc29VMD3 X9gTxSwFaAzzcHCvVvdUdhWDuPDly/jCNsFOMAkrm61GcWSh07SCibhw3XnunxbZl5p8 AiQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=+cjBrMe9lQU8GQX8o2bXMWSm9iHp3C5ow2FfP6Q+WYk=; b=sIXYAp7W5dcM9wvHVpr4xern8qX9gdng+lCAqOSPFJhnwCgKMgB1EEJaRzGfzWZiVj g5s/UOQkDUEX3ARRxlHNXpXK7NsoKD8Pi+FqFUI4T/XsTM2oiyU9uYE6hS9OjoYB2nzq oxXrs23hWvp/LFpFH8obZM0zuab346Zdo3mSQZKae/uACOTjNdTKiaNADANg9GxG/gwA EkCHOG01dsZ1+imKPexdhp+GN5D552eWUYvz5Ch7bt41cIPrSI6E4bpO/N8+MLoO3tOn GXLVOscyWnHcA9ct/W1XV8VMuiNe0UHAEIAf+m6N5t54yq4pUdPrLl4tfjbDRr2RJ3xS htaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TEEQK4p5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12-v6si7786987pls.367.2018.10.25.07.42.19; Thu, 25 Oct 2018 07:42:35 -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; dkim=pass header.i=@kernel.org header.s=default header.b=TEEQK4p5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728092AbeJYXMf (ORCPT + 99 others); Thu, 25 Oct 2018 19:12:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:57680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728229AbeJYWst (ORCPT ); Thu, 25 Oct 2018 18:48:49 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DB9FF2085B; Thu, 25 Oct 2018 14:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540476952; bh=x//4R1wPQiwxgCoz3IQ/K3yEuZ724e6MlMZ0G+OECjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TEEQK4p5NT+74a0whh2FTPkoU1cO7lAOF6pvMMaQaVIDanITkR3SxJTwxGy0LC2SA XHAK89b5GujIn9ncMnxQlYXuQGl88zdKe8TiWmj3TNMxo9Y6oGnEtumloPePWLhqJi NzvRECJQtfljycrFEDVhKMk7GTXz3AV2xsiGXIDY= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Xin Long , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.9 60/98] sctp: use right member as the param of list_for_each_entry Date: Thu, 25 Oct 2018 10:13:45 -0400 Message-Id: <20181025141423.213774-60-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141423.213774-1-sashal@kernel.org> References: <20181025141423.213774-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xin Long [ Upstream commit a8dd397903a6e57157f6265911f7d35681364427 ] Commit d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues when migrating a sock") made a mistake that using 'list' as the param of list_for_each_entry to traverse the retransmit, sacked and abandoned queues, while chunks are using 'transmitted_list' to link into these queues. It could cause NULL dereference panic if there are chunks in any of these queues when peeling off one asoc. So use the chunk member 'transmitted_list' instead in this patch. Fixes: d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues when migrating a sock") Signed-off-by: Xin Long Acked-by: Marcelo Ricardo Leitner Acked-by: Neil Horman Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sctp/socket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 64d2d9ea2f8c..16aa8673f918 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -185,13 +185,13 @@ static void sctp_for_each_tx_datachunk(struct sctp_association *asoc, list_for_each_entry(chunk, &t->transmitted, transmitted_list) cb(chunk); - list_for_each_entry(chunk, &q->retransmit, list) + list_for_each_entry(chunk, &q->retransmit, transmitted_list) cb(chunk); - list_for_each_entry(chunk, &q->sacked, list) + list_for_each_entry(chunk, &q->sacked, transmitted_list) cb(chunk); - list_for_each_entry(chunk, &q->abandoned, list) + list_for_each_entry(chunk, &q->abandoned, transmitted_list) cb(chunk); list_for_each_entry(chunk, &q->out_chunk_list, list) -- 2.17.1