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

scsi: target: make the pi_prot_format ConfigFS path readable

pi_prot_format conversion to write-only caused userspace breakage. Make the
ConfigFS path readable again and hardcode the "0\n" content, matching
previous output.

Fixes: 6baca7601bde ("scsi: target: drop unused pi_prot_format attribute storage")
Link: https://bugzilla.redhat.com/show_bug.cgi?id=1667505
Reported-by: Lee Duncan <lduncan@suse.com>
Reported-by: Laura Abbott <labbott@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

David Disseldorp and committed by
Martin K. Petersen
b6cd7f34 42caa0ed

+7 -1
+7 -1
drivers/target/target_core_configfs.c
··· 852 852 return count; 853 853 } 854 854 855 + /* always zero, but attr needs to remain RW to avoid userspace breakage */ 856 + static ssize_t pi_prot_format_show(struct config_item *item, char *page) 857 + { 858 + return snprintf(page, PAGE_SIZE, "0\n"); 859 + } 860 + 855 861 static ssize_t pi_prot_format_store(struct config_item *item, 856 862 const char *page, size_t count) 857 863 { ··· 1138 1132 CONFIGFS_ATTR(, emulate_pr); 1139 1133 CONFIGFS_ATTR(, pi_prot_type); 1140 1134 CONFIGFS_ATTR_RO(, hw_pi_prot_type); 1141 - CONFIGFS_ATTR_WO(, pi_prot_format); 1135 + CONFIGFS_ATTR(, pi_prot_format); 1142 1136 CONFIGFS_ATTR(, pi_prot_verify); 1143 1137 CONFIGFS_ATTR(, enforce_pr_isids); 1144 1138 CONFIGFS_ATTR(, is_nonrot);