Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754531AbcCNRyg (ORCPT ); Mon, 14 Mar 2016 13:54:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43794 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754065AbcCNRyR (ORCPT ); Mon, 14 Mar 2016 13:54:17 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kent Overstreet , Ming Lei , Jens Axboe Subject: [PATCH 4.4 48/50] block: dont optimize for non-cloned bio in bio_get_last_bvec() Date: Mon, 14 Mar 2016 10:51:06 -0700 Message-Id: <20160314175020.196951340@linuxfoundation.org> X-Mailer: git-send-email 2.7.2 In-Reply-To: <20160314175013.403628835@linuxfoundation.org> References: <20160314175013.403628835@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1144 Lines: 38 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ming Lei commit 90d0f0f11588ec692c12f9009089b398be395184 upstream. For !BIO_CLONED bio, we can use .bi_vcnt safely, but it doesn't mean we can just simply return .bi_io_vec[.bi_vcnt - 1] because the start postion may have been moved in the middle of the bvec, such as splitting in the middle of bvec. Fixes: 7bcd79ac50d9(block: bio: introduce helpers to get the 1st and last bvec) Reported-by: Kent Overstreet Signed-off-by: Ming Lei Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- include/linux/bio.h | 5 ----- 1 file changed, 5 deletions(-) --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -320,11 +320,6 @@ static inline void bio_get_last_bvec(str struct bvec_iter iter = bio->bi_iter; int idx; - if (!bio_flagged(bio, BIO_CLONED)) { - *bv = bio->bi_io_vec[bio->bi_vcnt - 1]; - return; - } - if (unlikely(!bio_multiple_segments(bio))) { *bv = bio_iovec(bio); return;