Received: by 10.192.165.156 with SMTP id m28csp1082822imm; Wed, 11 Apr 2018 12:05:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Db6PvPiWMCY4lpveMb1HhPZYXgV3KkVUv323N4dgMw9ClHjODxlOBOSm9v1njC0q8468d X-Received: by 2002:a17:902:9696:: with SMTP id n22-v6mr6390331plp.355.1523473535990; Wed, 11 Apr 2018 12:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523473535; cv=none; d=google.com; s=arc-20160816; b=jYrqBcioUNvRRYwllqLU6X8gPwhx6bA88KXugv94Yo1WBcDH7MintFzDhLM8Y9tnJk +QLDIrw/4zL/sOl2o/p+A9fXLDUlKsg8idpcHJsXZCAAw9UyNkIVMh59UngbvO2lmXXJ dqF6SC4HefIEqiTvMNcaX5XZaxcj3UhKqZ38Ctl6iMW4U/f2WitQ8qf39uEwQu7wGUdd 2OleOk9pFBpG/yqLo9XVVfoy3bnBTJE3HJbf/StBqGlNJlBKzgWFrqx7uqlwWRQV5hAA rJBRV3iTzE4cDd7h+sgPzYxZ4ED8TjRBpx+h38vi4G+lU7gGdneMpdsfgozSFx1WysiO y2UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=RcVG30jAscDuYHHPMD6ege9xAlu4NojbvCkwwMfvoFE=; b=v3KasuMvZbH5KPEpOfi3hS68IMm6q58ivdLOcf/Z/wGAY6v0BvIe/6AZvOr5U31RPr IYdFcSrYGO6RRv2Izt9MoUU5D8wTuaDqDw2YzbW1zaCxLJtKtg+eJ+7gESuzqJojfKhg t/88dWNezxPrlH28AR11YyBUMmf2Z75krXHSlzu8dKh8Hsi7h9xBbVmwooG2cTFJYVZ2 gHU/qawwiCPIGHE6BtsCSRRQokyYumUN1Dx4uwbVQJpej8jQzziV/KZUoukEdRz77h3K UDgAa43tfguBGeu2aju8ztGY4puTVzXkKp/+iZE9jl84tj9jf6tRcR9pzORyHWVSVVyZ DrhQ== ARC-Authentication-Results: i=1; mx.google.com; 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 f26si1294695pfn.269.2018.04.11.12.04.58; Wed, 11 Apr 2018 12:05: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; 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 S933800AbeDKTA6 (ORCPT + 99 others); Wed, 11 Apr 2018 15:00:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37960 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756825AbeDKTA4 (ORCPT ); Wed, 11 Apr 2018 15:00:56 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 48DCBD9D; Wed, 11 Apr 2018 19:00:55 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Jeremy Kerr , Sasha Levin Subject: [PATCH 4.9 174/310] powerpc/spufs: Fix coredump of SPU contexts Date: Wed, 11 Apr 2018 20:35:13 +0200 Message-Id: <20180411183630.114903916@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Ellerman [ Upstream commit 99acc9bede06bbb2662aafff51f5b9e529fa845e ] If a process dumps core while it has SPU contexts active then we have code to also dump information about the SPU contexts. Unfortunately it's been broken for 3 1/2 years, and we didn't notice. In commit 7b1f4020d0d1 ("spufs: get rid of dump_emit() wrappers") the nread variable was removed and rc used instead. That means when the loop exits successfully, rc has the number of bytes read, but it's then used as the return value for the function, which should return 0 on success. So fix it by setting rc = 0 before returning in the success case. Fixes: 7b1f4020d0d1 ("spufs: get rid of dump_emit() wrappers") Signed-off-by: Michael Ellerman Acked-by: Jeremy Kerr Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/cell/spufs/coredump.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/powerpc/platforms/cell/spufs/coredump.c +++ b/arch/powerpc/platforms/cell/spufs/coredump.c @@ -175,6 +175,8 @@ static int spufs_arch_write_note(struct skip = roundup(cprm->pos - total + sz, 4) - cprm->pos; if (!dump_skip(cprm, skip)) goto Eio; + + rc = 0; out: free_page((unsigned long)buf); return rc;