tag | 6abb535c26f86decc3b72a03b37513f3e162a0a3 | |
---|---|---|
tagger | Todd Kjos <tkjos@google.com> | Fri Aug 06 10:10:22 2021 -0700 |
object | e39c9adc6268c5cc598364195d4cd82b48709567 |
android12-5.10 July 2021 release 2 Artifacts kernel: https://ci.android.com/builds/submitted/7587602/kernel_aarch64/latest boot.img: https://ci.android.com/builds/submitted/7589983/gsi_arm64-user/latest
commit | e39c9adc6268c5cc598364195d4cd82b48709567 | [log] [tgz] |
---|---|---|
author | Bart Van Assche <bvanassche@google.com> | Mon Jul 19 15:20:40 2021 -0700 |
committer | Jaegeuk Kim <jaegeuk@google.com> | Mon Jul 26 17:03:49 2021 +0000 |
tree | 39fcc3cf8b6606a451b78eeccedcd46a75c07ba8 | |
parent | 2f5ebb3ed430c8ec2ce1cac655c6f759084bf711 [diff] |
FROMLIST: scsi: ufs: Fix memory corruption by ufshcd_read_desc_param() Running the following commands on my test setup triggers stack corruption: cd /sys/devices/platform/14700000.ufs/host0/target0:0:0 && for f in $(ls */unit_descriptor/hpb_pinned_region_start_offset | sort); do grep -aH . $f done The above commands trigger stack corruption because these commands assign the value 37 to the variable 'param_offset' and the value 35 to 'buff_len'. The following code changes param_size from 2 into 254 since 'param_size' has type u8: if (param_offset + param_size > buff_len) param_size = buff_len - param_offset; The next statement triggers stack corruption since 'param_read_buf' points at a two-byte stack array: memcpy(param_read_buf, &desc_buf[param_offset], param_size); With this patch applied, the output of the above command on my test setup is as follows: 0:0:0:0/unit_descriptor/hpb_pinned_region_start_offset:0x0000 0:0:0:1/unit_descriptor/hpb_pinned_region_start_offset:0x0000 0:0:0:2/unit_descriptor/hpb_pinned_region_start_offset:0x0000 0:0:0:3/unit_descriptor/hpb_pinned_region_start_offset:0x0000 grep: 0:0:0:49456/unit_descriptor/hpb_pinned_region_start_offset: Invalid argument grep: 0:0:0:49476/unit_descriptor/hpb_pinned_region_start_offset: Invalid argument grep: 0:0:0:49488/unit_descriptor/hpb_pinned_region_start_offset: Invalid argument Link: https://lore.kernel.org/linux-scsi/20210719231127.869088-1-bvanassche@acm.org/T/#u Bug: 194045295 Change-Id: I305c15b20f3ac3d6e3e97592566fcc51058195bb Signed-off-by: Bart Van Assche <bvanassche@google.com>
BEST: Make all of your changes to upstream Linux. If appropriate, backport to the stable releases. These patches will be merged automatically in the corresponding common kernels. If the patch is already in upstream Linux, post a backport of the patch that conforms to the patch requirements below.
EXPORT_SYMBOL_GPL()
require an in-tree modular driver that uses the symbol -- so include the new driver or changes to an existing driver in the same patchset as the export.LESS GOOD: Develop your patches out-of-tree (from an upstream Linux point-of-view). Unless these are fixing an Android-specific bug, these are very unlikely to be accepted unless they have been coordinated with kernel-team@android.com. If you want to proceed, post a patch that conforms to the patch requirements below.
script/checkpatch.pl
UPSTREAM:
, BACKPORT:
, FROMGIT:
, FROMLIST:
, or ANDROID:
.Change-Id:
tag (see https://gerrit-review.googlesource.com/Documentation/user-changeid.html)Bug:
tag.Signed-off-by:
tag by the author and the submitterAdditional requirements are listed below based on patch type
UPSTREAM:
, BACKPORT:
UPSTREAM:
.(cherry picked from commit ...)
lineimportant patch from upstream This is the detailed description of the important patch Signed-off-by: Fred Jones <fred.jones@foo.org>
- then Joe Smith would upload the patch for the common kernel as
UPSTREAM: important patch from upstream This is the detailed description of the important patch Signed-off-by: Fred Jones <fred.jones@foo.org> Bug: 135791357 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01 (cherry picked from commit c31e73121f4c1ec41143423ac6ce3ce6dafdcec1) Signed-off-by: Joe Smith <joe.smith@foo.org>
BACKPORT:
instead of UPSTREAM:
.UPSTREAM:
(cherry picked from commit ...)
lineBACKPORT: important patch from upstream This is the detailed description of the important patch Signed-off-by: Fred Jones <fred.jones@foo.org> Bug: 135791357 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01 (cherry picked from commit c31e73121f4c1ec41143423ac6ce3ce6dafdcec1) [joe: Resolved minor conflict in drivers/foo/bar.c ] Signed-off-by: Joe Smith <joe.smith@foo.org>
FROMGIT:
, FROMLIST:
,FROMGIT:
(cherry picked from commit <sha1> <repo> <branch>)
. This must be a stable maintainer branch (not rebased, so don't use linux-next
for example).BACKPORT: FROMGIT:
important patch from upstream This is the detailed description of the important patch Signed-off-by: Fred Jones <fred.jones@foo.org>
- then Joe Smith would upload the patch for the common kernel as
FROMGIT: important patch from upstream This is the detailed description of the important patch Signed-off-by: Fred Jones <fred.jones@foo.org> Bug: 135791357 (cherry picked from commit 878a2fd9de10b03d11d2f622250285c7e63deace https://git.kernel.org/pub/scm/linux/kernel/git/foo/bar.git test-branch) Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01 Signed-off-by: Joe Smith <joe.smith@foo.org>
FROMLIST:
Link:
tag with a link to the submittal on lore.kernel.orgBug:
tag with the Android bug (required for patches not accepted into a maintainer tree)BACKPORT: FROMLIST:
FROMLIST: important patch from upstream This is the detailed description of the important patch Signed-off-by: Fred Jones <fred.jones@foo.org> Bug: 135791357 Link: https://lore.kernel.org/lkml/20190619171517.GA17557@someone.com/ Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01 Signed-off-by: Joe Smith <joe.smith@foo.org>
ANDROID:
ANDROID:
Fixes:
tag that cites the patch with the bugANDROID: fix android-specific bug in foobar.c This is the detailed description of the important fix Fixes: 1234abcd2468 ("foobar: add cool feature") Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01 Signed-off-by: Joe Smith <joe.smith@foo.org>
ANDROID:
Bug:
tag with the Android bug (required for android-specific features)