]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
dm integrity: change memcmp to strncmp in dm_integrity_ctr
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 13 Mar 2019 11:56:02 +0000 (07:56 -0400)
committerMike Snitzer <snitzer@redhat.com>
Mon, 1 Apr 2019 20:11:11 +0000 (16:11 -0400)
commit0d74e6a3b6421d98eeafbed26f29156d469bc0b5
tree13b9ab66fe1553126777b6afb114612743b6778c
parent79a3aaa7b82e3106be97842dedfd8429248896e6
dm integrity: change memcmp to strncmp in dm_integrity_ctr

If the string opt_string is small, the function memcmp can access bytes
that are beyond the terminating nul character. In theory, it could cause
segfault, if opt_string were located just below some unmapped memory.

Change from memcmp to strncmp so that we don't read bytes beyond the end
of the string.

Cc: stable@vger.kernel.org # v4.12+
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-integrity.c