Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751924AbbB1K2t (ORCPT ); Sat, 28 Feb 2015 05:28:49 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:37170 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751104AbbB1K2o (ORCPT ); Sat, 28 Feb 2015 05:28:44 -0500 From: Brian Norris To: Richard Weinberger , Artem Bityutskiy Cc: Brian Norris , , , kernel-janitors@vger.kernel.org Subject: [PATCH 2/5] UBI: fix out of bounds write Date: Sat, 28 Feb 2015 02:23:26 -0800 Message-Id: <1425119009-28634-3-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1425119009-28634-1-git-send-email-computersforpeace@gmail.com> References: <1425119009-28634-1-git-send-email-computersforpeace@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 954 Lines: 32 If aeb->len >= vol->reserved_pebs, we should not be writing aeb into the PEB->LEB mapping. Caught by Coverity, CID #711212. Signed-off-by: Brian Norris --- drivers/mtd/ubi/eba.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index da4c79259f67..6442d3fbcb73 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c @@ -1418,7 +1418,8 @@ int ubi_eba_init(struct ubi_device *ubi, struct ubi_attach_info *ai) * during re-size. */ ubi_move_aeb_to_list(av, aeb, &ai->erase); - vol->eba_tbl[aeb->lnum] = aeb->pnum; + else + vol->eba_tbl[aeb->lnum] = aeb->pnum; } } -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/