Skip to contentSkip to conversation

usb: gadget: f_mass_storage: restore address range on exit

PATCH In review Sanjay Singh Rawat 2 participants 2 messages Dec 5, 2014 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: f_mass_storage: restore address range on exit

At the start of the thread we are changing the address limit, restoring it to the default while exiting.

---
 drivers/usb/gadget/function/f_mass_storage.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/gadget/function/f_mass_storage.c +2 -0
index 811929c..c4a2ded 100644
@@ -2489,6 +2489,7 @@ static void handle_exception(struct fsg_common *common)
 static int fsg_main_thread(void *common_)
 {
 	struct fsg_common	*common = common_;
+	mm_segment_t fs = get_fs();
 
 	/*
 	 * Allow the thread to be killed by a signal, but set the signal mask
@@ -2567,6 +2568,7 @@ static int fsg_main_thread(void *common_)
 		up_write(&common->filesem);
 	}
 
+	set_fs(fs);
 	/* Let fsg_unbind() know the thread has exited */
 	complete_and_exit(&common->thread_notifier, 0);
 }
Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 2 lines · Sanjay Singh Rawat

At the start of the thread we are changing the address limit, restoring it to the default while exiting.

What for? The thread is about to exit anyway. Who cares what the address limit is set to?

Alan Stern