]> git.baikalelectronics.ru Git - 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)
commitb472e5fe56d5303030dd7b47b3abb1539cafceb8
tree13b9ab66fe1553126777b6afb114612743b6778c
parentb7a31ea379e672048cd04255d27306c97d980b41
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