From patchwork Wed Feb 28 17:50:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 10249099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A25A660211 for ; Wed, 28 Feb 2018 17:50:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D922205FC for ; Wed, 28 Feb 2018 17:50:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71DBD2239C; Wed, 28 Feb 2018 17:50:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA0CC205FC for ; Wed, 28 Feb 2018 17:50:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932485AbeB1RuL (ORCPT ); Wed, 28 Feb 2018 12:50:11 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:38353 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932464AbeB1RuK (ORCPT ); Wed, 28 Feb 2018 12:50:10 -0500 Received: by mail-wr0-f195.google.com with SMTP id n7so3341873wrn.5 for ; Wed, 28 Feb 2018 09:50:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=nUCwA7CNS2FE3596Yfb3s+POuUJZ6tdkYoUWQLai91Y=; b=bP1AV3XLEvxZpeTBJ6gaa2CBGpzfnnnOzIE1BzZ7iZL955ijXgyvy+6UGbrN2YTLJV NfLPIPelIAz1uxch2RkPK+w9ZyvTzIYRKYhhND0QqRTRCoRtxsx6lE77G8c1yOYSgCP2 zSc3RIjAaoBZsHJX4PmxqWRqyBMPhv6MUYMdF4DTlyb6z/GAbn7i5iRgUoEr9RecrkA/ Dr2irQma2qb6x8rNBHDZrZR283A7sekuIwCBHqPOyhFC5hf2A5NUMDpGWZsbSXM2Sxsr MqhIkNOlpHzS9uCGKCRz9b6K/8ykTcWPeXDRtlbeZpP5fd7ppnSGLJ/54xuLHspMeFAw CSoQ== X-Gm-Message-State: APf1xPDvJjX+fp75VS7X6L4WBnnKzlAMhhsOdIts+A4v12iUQWINCSOw Sbe5foeumZmpvqJPh6w3Rmc= X-Google-Smtp-Source: AH8x227yyzwfhMz/8ORc6jVLKaDm1TyTSSYTKK87lV6VmFFWPpPTbpsr9XbQTAATzAQheKLLNSUS6w== X-Received: by 10.223.138.251 with SMTP id z56mr16681595wrz.196.1519840209597; Wed, 28 Feb 2018 09:50:09 -0800 (PST) Received: from [10.0.0.5] ([207.232.55.62]) by smtp.gmail.com with ESMTPSA id p78sm3356862wmg.47.2018.02.28.09.50.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 09:50:09 -0800 (PST) Subject: Re: [PATCH] Use bio_endio instead of bio_put in error path of blk_rq_append_bio To: Jiri Palecek , Ming Lei References: <20171218074044.1369-3-ming.lei@redhat.com> <87o9lcp1aq.fsf@debian.i-did-not-set--mail-host-address--so-tickle-me> <2c6a3916-57b8-20cb-f081-bb1b907a1a8a@web.de> <20180131052448.GB9985@ming.t460p> <87h8qbptzz.fsf@debian.i-did-not-set--mail-host-address--so-tickle-me> <8be6c1f5-0359-8de4-22b3-d5e779ae7c12@electrozaur.com> <058e8999-3f89-ae20-ee38-229c78d6d1c8@web.de> <24729d65-c531-dcc5-3eca-900d65961092@electrozaur.com> Cc: Ming Lei , linux-block , Jens Axboe , Christoph Hellwig , "James E.J. Bottomley" , "Martin K. Petersen" , "Nicholas A. Bellinger" From: Boaz Harrosh Message-ID: <269e0999-599f-cdb6-8dc8-0a5cdc521eae@electrozaur.com> Date: Wed, 28 Feb 2018 19:50:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <24729d65-c531-dcc5-3eca-900d65961092@electrozaur.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 28/02/18 19:38, Boaz Harrosh wrote: <> > Based on v4.15 code feel free to add to your patchset > where needed > Sorry is what happens when you work on so many Linux versions at the same time. This one is based on v4.15 > ---- > Don't leak the request if blk_rq_append_bio fails > > Sign-of-by: Boaz Harrosh > ---- diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index e188771..58782dc 100644 --- a/drivers/scsi/osd/osd_initiator.c +++ b/drivers/scsi/osd/osd_initiator.c @@ -1579,8 +1579,10 @@ static struct request *_make_request(struct request_queue *q, bool has_write, struct bio *bounce_bio = bio; ret = blk_rq_append_bio(req, &bounce_bio); - if (ret) + if (ret) { + _put_request(req); return ERR_PTR(ret); + } } return req;