Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'ubifs-for-linus-6.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs

Pull UBI fixes from Richard Weinberger:

- Fix failure to attach when vid_hdr offset equals the (sub)page size

- Fix for a deadlock in UBI's worker thread

* tag 'ubifs-for-linus-6.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
ubi: Fix failure attaching when vid_hdr offset equals to (sub)page size
ubi: Fix deadlock caused by recursively holding work_sem

+17 -8
+15 -6
drivers/mtd/ubi/build.c
··· 666 666 ubi->ec_hdr_alsize = ALIGN(UBI_EC_HDR_SIZE, ubi->hdrs_min_io_size); 667 667 ubi->vid_hdr_alsize = ALIGN(UBI_VID_HDR_SIZE, ubi->hdrs_min_io_size); 668 668 669 - if (ubi->vid_hdr_offset && ((ubi->vid_hdr_offset + UBI_VID_HDR_SIZE) > 670 - ubi->vid_hdr_alsize)) { 671 - ubi_err(ubi, "VID header offset %d too large.", ubi->vid_hdr_offset); 672 - return -EINVAL; 673 - } 674 - 675 669 dbg_gen("min_io_size %d", ubi->min_io_size); 676 670 dbg_gen("max_write_size %d", ubi->max_write_size); 677 671 dbg_gen("hdrs_min_io_size %d", ubi->hdrs_min_io_size); ··· 681 687 ~(ubi->hdrs_min_io_size - 1); 682 688 ubi->vid_hdr_shift = ubi->vid_hdr_offset - 683 689 ubi->vid_hdr_aloffset; 690 + } 691 + 692 + /* 693 + * Memory allocation for VID header is ubi->vid_hdr_alsize 694 + * which is described in comments in io.c. 695 + * Make sure VID header shift + UBI_VID_HDR_SIZE not exceeds 696 + * ubi->vid_hdr_alsize, so that all vid header operations 697 + * won't access memory out of bounds. 698 + */ 699 + if ((ubi->vid_hdr_shift + UBI_VID_HDR_SIZE) > ubi->vid_hdr_alsize) { 700 + ubi_err(ubi, "Invalid VID header offset %d, VID header shift(%d)" 701 + " + VID header size(%zu) > VID header aligned size(%d).", 702 + ubi->vid_hdr_offset, ubi->vid_hdr_shift, 703 + UBI_VID_HDR_SIZE, ubi->vid_hdr_alsize); 704 + return -EINVAL; 684 705 } 685 706 686 707 /* Similar for the data offset */
+2 -2
drivers/mtd/ubi/wl.c
··· 575 575 * @vol_id: the volume ID that last used this PEB 576 576 * @lnum: the last used logical eraseblock number for the PEB 577 577 * @torture: if the physical eraseblock has to be tortured 578 - * @nested: denotes whether the work_sem is already held in read mode 578 + * @nested: denotes whether the work_sem is already held 579 579 * 580 580 * This function returns zero in case of success and a %-ENOMEM in case of 581 581 * failure. ··· 1131 1131 int err1; 1132 1132 1133 1133 /* Re-schedule the LEB for erasure */ 1134 - err1 = schedule_erase(ubi, e, vol_id, lnum, 0, false); 1134 + err1 = schedule_erase(ubi, e, vol_id, lnum, 0, true); 1135 1135 if (err1) { 1136 1136 spin_lock(&ubi->wl_lock); 1137 1137 wl_entry_destroy(ubi, e);