From patchwork Tue Apr 28 03:27:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jann Horn X-Patchwork-Id: 11513707 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F0FE692A for ; Tue, 28 Apr 2020 03:28:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BCE602073C for ; Tue, 28 Apr 2020 03:28:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="I3TqNZ+o" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BCE602073C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DFF8A8E0007; Mon, 27 Apr 2020 23:28:06 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DAEE08E0001; Mon, 27 Apr 2020 23:28:06 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CED0A8E0007; Mon, 27 Apr 2020 23:28:06 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id BC0E08E0001 for ; Mon, 27 Apr 2020 23:28:06 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 77388582D for ; Tue, 28 Apr 2020 03:28:06 +0000 (UTC) X-FDA: 76755830172.13.ducks21_46c1b1107ae2a X-Spam-Summary: 2,0,0,20e02a0dc62a8a56,d41d8cd98f00b204,3xaknxgukckqnerrlksskpi.gsqpmryb-qqozego.svk@flex--jannh.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1534:1539:1568:1593:1594:1711:1714:1730:1747:1777:1792:2393:2559:2562:2895:3138:3139:3140:3141:3142:3152:3865:3866:3867:4321:5007:6261:6653:6742:9969:10004:10400:11658:11914:12296:12297:12555:12679:12895:13069:13311:13357:14181:14394:14659:14721:21080:21444:21451:21627:21990:30054:30070,0,RBL:209.85.219.73:@flex--jannh.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: ducks21_46c1b1107ae2a X-Filterd-Recvd-Size: 3758 Received: from mail-qv1-f73.google.com (mail-qv1-f73.google.com [209.85.219.73]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Tue, 28 Apr 2020 03:28:06 +0000 (UTC) Received: by mail-qv1-f73.google.com with SMTP id r10so21071222qvw.23 for ; Mon, 27 Apr 2020 20:28:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=oz1fQ07v4YKej2hlWP6qWEvyAtsuOx0qHOmBf6H8EEU=; b=I3TqNZ+omoMhei62DCjjFhvToBgLQ/mzKXtTiQk26/Z5mE9W3slhueOYb+z8GilAMC uJiJnXNo6zMWUJK5fxe8p2Clt0BrANXorqf5ejL3fjOyojaAeijiBitnGvTxkfmUvtk5 Oo7NlfGIo6V3y/5pocLkkx6t8Ss8qBGDmgrARr+67qmzWEXVLYp/RFVVh/KoqwASWwPE LeSD+Oj61O/Z74sMssGhSL5Fu1c3GwuoL3JonPdkpa7ffE2p5AG02vHLj7jS4QiYw7q5 cGhGmYlwlCMnZ+TzyelO2CkY4EzLolMoho7DCGot0I1FyuWa+tJ3zOEFil++xSYeEETq eZBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=oz1fQ07v4YKej2hlWP6qWEvyAtsuOx0qHOmBf6H8EEU=; b=n75wfsN/t0Ck8AGvW9cFHgFM4h/VWFxBuhYiKx4B4kdIYP0HnER61KAqveosJGIVKN IzSk20mtZffMREOKwdl5xRY7LSXna1W3oSkZlT+VVrK747apQqvXVG7q3xYBVLAXHl4O f1FbJKbp2VnEqeIBQdQvYDY30qSIX1Up09HSh0cW0zN3iRQVlKi6aiZASAvTyThFJ9Eu 9BSpXViXMIuzOUm5/z/c2W6xXBizqty3ClG1Qps/CjcTU5ipOTl6lxGrC4Y1nNYrNONG bAqMCOKnvYy1hxhaZB3s1OcDq50p7kj7F49MH5FZ7W8aCcBOuDr1zlPZKFPStkqiTCV0 7XZw== X-Gm-Message-State: AGi0Puaej8tEsfwrRdnn+90XKMVrdAiOJ7rQJWsTQuTlvk99yqAvnsHs S64wicSnrlwLe4vtidx0lYWMKLGirQ== X-Google-Smtp-Source: APiQypJE2oducFJ7QqE/S1GqpExEa0j+XC+oVynygSXLNhNvPC4n0hoqiHIFqgoaUYcyeTNIUgqu5F2EbA== X-Received: by 2002:a0c:8b48:: with SMTP id d8mr26408306qvc.195.1588044485433; Mon, 27 Apr 2020 20:28:05 -0700 (PDT) Date: Tue, 28 Apr 2020 05:27:42 +0200 In-Reply-To: <20200428032745.133556-1-jannh@google.com> Message-Id: <20200428032745.133556-3-jannh@google.com> Mime-Version: 1.0 References: <20200428032745.133556-1-jannh@google.com> X-Mailer: git-send-email 2.26.2.303.gf8c07b1a785-goog Subject: [PATCH 2/5] coredump: Fix handling of partial writes in dump_emit() From: Jann Horn To: Andrew Morton Cc: Linus Torvalds , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Alexander Viro , "Eric W . Biederman" , Oleg Nesterov , Russell King , linux-arm-kernel@lists.infradead.org, Mark Salter , Aurelien Jacquiot , linux-c6x-dev@linux-c6x.org, Yoshinori Sato , Rich Felker , linux-sh@vger.kernel.org X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: After a partial write, we have to update the input buffer pointer. Fixes: 2507a4fbd48a ("make dump_emit() use vfs_write() instead of banging at ->f_op->write directly") Cc: stable@vger.kernel.org Signed-off-by: Jann Horn --- fs/coredump.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/coredump.c b/fs/coredump.c index 408418e6aa131..047f5a11dbee7 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -833,6 +833,7 @@ int dump_emit(struct coredump_params *cprm, const void *addr, int nr) cprm->written += n; cprm->pos += n; nr -= n; + addr += n; } return 1; }